Subject: Re: Drivers with interrupts as LKMs
To: Jeremy Gale <jgale.work@gmail.com>
From: Jachym Holecek <freza@liberouter.org>
List: tech-kern
Date: 01/20/2005 02:02:05
> I'm wondering if it's possible to have a device driver that uses
> interrupts to be loadable as a kernel module.

Yes.

> I need the address and irq number to be passed in to the LKM somehow.
> 
> I've been unable to find any examples of this in the kernel source or
> on the web.

As of now, there is no way to pass "arguments" to LKM drivers, AFAIK.
Generally, the drivers for "indirect-config" buses such as ISA [*] do
their best find the device at standard locations (or places hinted by
the structure passed as an argument to driver's match() method). Failing
that, the user has to find out correct values of base address/intr/whatever
and supply them as locators in the kernel config file (these values
will then appear in abovementioned "hint" structure).

This scheme is independent of whether you work with an LKM or a compiled-in
driver -- provided that the bus in question has a function to locate device
on the bus (such as pci_find_device(9)).

In -current, there is some initial code to force rescan of buses that
support it (inluding locator passing) and perform other device driver
manipulation (detach driver from the device etc.). Look for drvctl(8)
and ${sys}/kern/kern_drvctl.c. This, again, should be independent of
whether your code is LKM vs. static.

To sum up, I think your best bet for the time being is a traditional
compiled-in driver...

	Hope this helps,
		-- Jachym Holecek

[*] I suppose you're dealing with this kind of bus, "direct-config" ones
    should be able to find and identify devices automatically.