On Mon, 9 Oct 2000, Keith Owens wrote:

> On Sun, 8 Oct 2000 23:50:43 +0200 (MEST), 
> Jaroslav Kysela <[EMAIL PROTECTED]> wrote:
> >     this patch contains following fixes and enhancements to export ISA
> >PnP IDs outside the kernel module:
> >
> >* module.h - added MODULE_GENERIC_TABLE
> >* isapnp.h - added 'struct isapnp_device_id' for single devices
> >           - added ISAPNP_CARD_TABLE for complex devices
> >* isapnp.c - fixed NULL pointer dereference in input routine
> >           - fixed timeout (for old ALS100 card)
> >           - added isapnp_probe_devs() and isapnp_activate_dev()
> >* serial.c - the ISA PnP table was updated using new structure
> >        - the ISA PnP table is exported as well
> 
> I have add support for generating modules.isapnpmap to my modutils
> tree, basically a clone of modules.pcimap.  ISAPNP_CARD_TABLE is more
> of a problem.
> 
> struct isapnp_card_id {
>       unsigned short card_vendor, card_device;
>       struct {
>               unsigned short vendor, function;
>       } devs[ISAPNP_CARD_DEVS];       /* logical devices */
>       unsigned long driver_data;      /* data private to the driver */
> };
> 
> Modutils and the kernel are compiled from different headers, none of
> this #include <linux/xxx.h> business in modutils.  So you must never
> assume that the structures in modutils and in the kernel have the same
> specification.  Since ISAPNP_CARD_DEVS is #defined and can be changed,
> that value must be exported to user space.  Also putting driver_data
> after the array might cause parsing problems if the array size changes,
> driver_data should be before the array.

Although ISAPNP_CARD_DEVS is #defined, we may take this value as
a constant. I've never seen the cards with more than five logical
devices. I can add a comment that a change of the constant will
cause compatibility problems with modutils.

Another solution is to change ISAPNP_CARD_TABLE to:

#define ISAPNP_CARD_TABLE(name) \
                const int __module_isapnp_card_devs = ISAPNP_CARD_DEVS; \
                MODULE_GENERIC_TABLE(isapnp_card, name)

But, I think that we don't need this change at the time. If the situation
arises (we found an ISA PnP card with more than eight logical devices), we
may add a global variable to determine the structure change as well. The
change may be also determined with checking of the kernel version.
                
> Solution 1:
> 
> struct isapnp_card_id {
>       unsigned short card_vendor, card_device;
>       int isapnp_card_devs;
>       unsigned long driver_data;      /* data private to the driver */
>       struct {
>               unsigned short vendor, function;
>       } devs[ISAPNP_CARD_DEVS];       /* logical devices */
> };

Moving of driver_data to top of the structure is a good idea.
I'll proceed.

> In either case depmod can print modules.isapnp_cardmap data as
> 
> Print 1:
> 
> # module             cardvendor carddevice driver_data vendor     function ...
> eepro100             0x00008086 0x00001229 0x00000000  0x00008086 0x00001229 ... all 
>non-zero devs entries on one line

I prefer this solution (everything on one line). I don't think that
this format will cause problems for simple parsers.

> or as
> 
> Print 2:
> 
> # module             cardvendor carddevice driver_data vendor     function
> eepro100             0x00008086 0x00001229 0x00000000  0x00008086 0x00001229 one 
>line per non-zero devs entry
> 
> Which solution do you want?
> Which print format do you want?

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
SuSE Linux    http://www.suse.com
ALSA project  http://www.alsa-project.org


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to