Multiple Device driver from single device driver????
Use multiple PCI cards in a system when the provided device driver assumes only one card will be present.
A reference design provides a device driver for a mini-PCI card. This device driver spans several loadable kernel modules (addressing different logical portions of the hardware) and each kernel module has dozens of source files. The device driver was written assuming _only_ one card would be present in the system at a time resulting in hardware/driver "state" variables sprinkled throughout all the source files.
Obviously the device driver could be completely rewritten by aggregating all of the state variables into some sort of structure and then kmalloc'ing a number of them at kernel module load/init time (array or linked list, etc.). This looks to be rather hard (the state variables are everywhere and the chances of missing some are high) and tedious (> 100k LOC).
Is there another option by perhaps wrapping the device driver in a way to allow multiple cards?
Is there a smart _and_ lazy way to accomplish the goal?
You could load multiple instances of the same driver? using modprobe options like -o. you can see how it is done at this location which talks about bonding drivers : http://lwn.net/Articles/258538/
Hope this helped.
Linux kernel module global variables are all in one namespace, no?
How can this be prevented easily without a module rewrite?
The way it works is kernel gives each modules its own namespace, as long as you are not exporting symbols from the modules, you should be fine.
|All times are GMT -5. The time now is 07:49 AM.|