Re: Device driver attachment when using module(7)

2016-01-07 Thread Michael van Elst
thegl...@gmail.com ("T. Glass") writes:

>So my question is: are module device drivers supposed to configure a real
>device driver instance, or are they just a method of inserting the right
>autoconf glue, before the whole autoconfiguration process take place?

Apparently that depends on the driver and gets more twists when you
consider standard UNIX devices (i.e. devsw), pseudo devices and cloning.

I don't think that there is already a common understanding how this
is "supposed" to work.

Having experienced the recent modularization of raidframe(4), I also doubt
that all the existing modular drivers actually work when loaded from the command
line (or via autoload, as is done for devsw and filesystems).

-- 
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Device driver attachment when using module(7)

2016-01-06 Thread T. Glass
Hi all,

I have one question about how device drivers are supposed to be configured
when loaded as modules.
I've noticed this is the most commonly used method of attachment throughout
the kernel:

...
switch (cmd) {

 case MODULE_CMD_INIT:
#ifdef _MODULE
 error = config_init_component(cfdriver_ioconf_if_ath_pci,
   cfattach_ioconf_if_ath_pci, cfdata_ioconf_if_ath_pci);
#endif
 return error;
 case MODULE_CMD_FINI:
...

And so on.

Since I rarely used modules when looking for particular drivers, I just
noticed that by loading (and unloading) a module from the command line, no
new device is recognized or attached.

In some cases, especially in pci drivers, just a rescan message is shown
(both in console and dmesg).

So my question is: are module device drivers supposed to configure a real
device driver instance, or are they just a method of inserting the right
autoconf glue, before the whole autoconfiguration process take place?

Shouldn't a device driver module also perform some kind of bus enumeration
scan, and then attach a new real device instance (by calling config_attach,
or config_found, etc..), especially if requested from the command line?

Thanks in advance

T.G.