Re: Linux Jobs as of 2.3.99pre6-5

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Tue Apr 25 2000 - 14:34:49 EST


Tim Waugh wrote:
>
> On Tue, Apr 25, 2000 at 06:28:12PM +0100, Alan Cox wrote:
>
> > Do we have ALL_BUT in the subvendor data yet ? So that we can exclude the
> > lanmedia from tulip
>
> I prefer that drivers explicitly list the devices that they support.
> I must admit I don't know the details with lanmedia/tulip though.

If lanmedia advertises a tulip PCI id and a unique subvendor/device id,
then both tulip and lanmedia drivers will try to grab the same device.

Currently the Tulip driver needs to either list all existing
subvendor/device ids (not feasible), or manually exclude specific
subvendor/device ids in the xxx_init_one method.

The more I think about the more I like adding an 'exclude_table' field
to struct pci_driver.

Does the attached patch look ok to everyone?

        Jeff

-- 
Jeff Garzik              | Nothing cures insomnia like the
Building 1024            | realization that it's time to get up.
MandrakeSoft, Inc.       |        -- random fortune

--- vanilla/linux-2.3.99-pre6-pre6/include/linux/module.h Tue Apr 11 20:31:26 2000 +++ linux_2_3/include/linux/module.h Tue Apr 25 15:20:32 2000 @@ -190,6 +190,19 @@ __attribute__((section(".modinfo"))) = \ "parm_desc_" __MODULE_STRING(var) "=" desc +/* + * MODULE_DEVICE_TABLE exports information about devices + * currently supported by this module. A device type, such as PCI, + * is a C-like identifier passed as the first arg to this macro. + * The second macro arg is the variable containing the device + * information being made public. + * + * The following is a list of known device types (arg 1), + * and the C types which are to be passed as arg 2. + * pci - struct pci_device_id - List of PCI ids supported by this module + * exclude_pci - struct pci_device_id - List of PCI ids NOT supported + * by this module + */ #define MODULE_DEVICE_TABLE(type,name) \ const struct type##_device_id * __module_##type##_device_table = name /* not put to .modinfo section to avoid section type conflicts */ --- vanilla/linux-2.3.99-pre6-pre6/include/linux/pci.h Tue Apr 11 20:31:28 2000 +++ linux_2_3/include/linux/pci.h Tue Apr 25 15:20:32 2000 @@ -530,6 +530,7 @@ struct list_head node; char *name; const struct pci_device_id *id_table; /* NULL if wants all devices */ + const struct pci_device_id *exclude_table; /* avoid these devices */ int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ void (*suspend)(struct pci_dev *dev); /* Device suspended */ --- vanilla/linux-2.3.99-pre6-pre6/drivers/pci/pci.c Tue Apr 25 15:21:03 2000 +++ linux_2_3/drivers/pci/pci.c Tue Apr 25 15:20:32 2000 @@ -303,6 +303,14 @@ return 0; } else id = NULL; + + if (drv->exclude_table) { + const struct pci_device_id *exclude = + pci_match_device(drv->exclude_table, dev); + if (exclude) + return 0; + } + if (drv->probe(dev, id) >= 0) { dev->driver = drv; return 1; --- vanilla/linux-2.3.99-pre6-pre6/Documentation/pci.txt Mon Feb 21 13:59:36 2000 +++ linux_2_3/Documentation/pci.txt Tue Apr 25 15:32:39 2000 @@ -43,7 +43,15 @@ name Name of the driver id_table Pointer to table of device ID's the driver is - interested in + interested in. Most drivers should export this + table using MODULE_DEVICE_TABLE(pci,...). + Set to NULL to call probe() function for every + PCI device known to the system [unless excluded + by exclude_table]. + exclude_table Pointer to table of device ID's the driver wants + to avoid. Most drivers should export this + table using MODULE_DEVICE_TABLE(exclude_pci,...). + Set to NULL to disable exclusion of PCI devices. probe Pointer to a probing function which gets called (during execution of pci_register_driver for already existing devices or later if a new device gets inserted) for all

- 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/



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:10 EST