Re: [PATCH] ISA PnP (2.4.0-test9)

From: Keith Owens (kaos@ocs.com.au)
Date: Sun Oct 08 2000 - 22:35:45 EST


On Sun, 8 Oct 2000 23:50:43 +0200 (MEST),
Jaroslav Kysela <perex@suse.cz> 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.

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 */
};

isapnp_card_devs is set to ISAPNP_CARD_DEVS for every struct isapnp_card_id.

Solution 2:

struct isapnp_card_id {
        unsigned short card_vendor, card_device;
        unsigned long driver_data; /* data private to the driver */
        struct {
                unsigned short vendor, function;
        } devs[ISAPNP_CARD_DEVS]; /* logical devices */
};

static int isapnp_card_devs = ISAPNP_CARD_DEVS;
EXPORT_SYMBOL(isapnp_card_devs);

isapnp_card_devs only has to be defined once, probably in isapnp.c.

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

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?

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



This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:11 EST