Re: Question: initdata for modules....

Vladimir Dergachev (vdergach@sas.upenn.edu)
Sun, 20 Dec 1998 11:20:19 -0500 (EST)


On Sun, 20 Dec 1998, Rogier Wolff wrote:

>
> Hi everyone,
>
> I've written a driver for an intelligent multiport serial card.
> I've got the firmware for the card in a separate file.
>
> For "inside" the kernel, I should declare the firmware initdata and
> it will get freed after booting.
>
> For the module, I could link everything together (that's what I'm
> doing right now), but this means I'm wasting a few tens of kilobytes
> of unswappable kernel memory just for the firmware.
>
> What I'd like to do is to have the "firmware" as a separate module
> that can be unloaded after initializing the main driver.
>
> The drawback is that the usage count of the firmware module will stick
> at "1" if my main module is loaded. Can I decrease its usage count
> "by hand" to allow it to unload once I'm done with it?
>
> Anybody have any good tips about this?
>

One way around is to make a proc entry for you card, and then use
ioctl to pass the firmware to the drive. This way before the cards becomes
working a special program should upload firmware to the card (using this
ioctl).

The other way is as you suggested, create a module which exports one
function that returns the pointer to your firmware. You call it, get the
pointer, upload firmware and then unload the module. You would have to
tell the kernel that you don't need the second module after you uploaded
the firmware, otherwise it will think that the first module is still using
it.

Vladimir Dergachev

>
> For your information, take a look at the object files:
>
> Two firmware objects:
>
> -rw-r--r-- 1 wolff users 9324 Dec 19 17:08 si2_z280.o
> -rw-r--r-- 1 wolff users 20368 Dec 14 12:45 si3_t225.o
>
> and the two "code" objects:
>
> -rw-r--r-- 1 wolff users 7588 Dec 17 16:38 generic_serial.o
> -rw-r--r-- 1 wolff users 22860 Dec 20 09:49 sx.o
>
>
> For the module, I'll make the main module (sx.o) depend on the
> "generic_serial" module.
>
> If you have a Specialix SI/XIO or SX card, feel free to contact me to
> help beta-testing this driver. (sorry, no free cards this time: those
> have been given away already).
>
> (If you have an SI card, you might have been using Simon Allens
> driver. This is a completely new driver, and supports a few new
> features. (e.g. several cards in one computer))
>
> The new driver supports SX/ISA, SX/PCI and SI/ISA. Officially, the
> SI/EISA and SI/PCI won't be supported. If someone with one of those
> cards volunteers, it shouldn't be too hard to add support for them.
> No guarantees though.....
>
> Regards,
>
> Roger Wolff.
>
>
> Tomorrow: Only 9000 hours to Y2k
>
> --
> ** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
> *-- BitWizard writes Linux device drivers for any device you may have! --*
> * Never blow in a cat's ear because if you do, usually after three or *
> * four times, they will bite your lips! And they don't let go for at *
> * least a minute. -- Lisa Coburn, age 9
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/