Re: [PATCH] pci_ids.h: add new Atheros USB vendor ID

From: Joe Perches
Date: Thu Aug 06 2009 - 14:52:52 EST


On Thu, 2009-08-06 at 14:15 -0400, Dave Jones wrote:
> On Wed, Aug 05, 2009 at 10:09:32PM -0700, Greg Kroah-Hartman wrote:
> > > the closest we have is drivers/hid/hid-ids.h and we might just should
> > > have Greg create a usb-ids.h file.
> > Ick, no, there's no such file for a good reason. Put your device ids in
> > the driver files, no need to share it across the whole kernel.
> I agree. In fact, I'd go further, and say that the bulk of what we have
> in pci_ids.h is also pointlessly shared. Only a tiny fraction of the device
> entries in that file are used by multiple files in the kernel.

I created some scripts a while ago to go through the
kernel to convert struct pci_device definitions to use
PCI_VDEVICE and PCI_DEVICE.

I could move definitions out of the pci_ids.h file at
the same time and closer to their actual use if those
definitions were not globally used. Maybe move them
by module or by specific file.

Perhaps like this example unsigned, not to be applied,
patch below:

diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index d2ba04d..e978eb8 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -264,30 +264,12 @@ static void amd_iso_dev_put(void)

/* List of quirks for OHCI */
static const struct pci_device_id ohci_pci_quirks[] = {
- {
- PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x740c),
- .driver_data = (unsigned long)ohci_quirk_amd756,
- },
- {
- PCI_DEVICE(PCI_VENDOR_ID_OPTI, 0xc861),
- .driver_data = (unsigned long)ohci_quirk_opti,
- },
- {
- PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_ANY_ID),
- .driver_data = (unsigned long)ohci_quirk_ns,
- },
- {
- PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xa0f8),
- .driver_data = (unsigned long)ohci_quirk_zfmicro,
- },
- {
- PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA_2, 0x01b6),
- .driver_data = (unsigned long)ohci_quirk_toshiba_scc,
- },
- {
- PCI_DEVICE(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB),
- .driver_data = (unsigned long)ohci_quirk_nec,
- },
+ { PCI_UNNAMED_DEVICE(AMD, 0x740c), .driver_data = (unsigned long)ohci_quirk_amd756 },
+ { PCI_UNNAMED_DEVICE(OPTI, 0xc861), .driver_data = (unsigned long)ohci_quirk_opti },
+ { PCI_UNNAMED_DEVICE(NS, PCI_ANY_ID), .driver_data = (unsigned long)ohci_quirk_ns },
+ { PCI_UNNAMED_DEVICE(COMPAQ, 0xa0f8), .driver_data = (unsigned long)ohci_quirk_zfmicro },
+ { PCI_UNNAMED_DEVICE(TOSHIBA_2, 0x01b6), .driver_data = (unsigned long)ohci_quirk_toshiba_scc },
+ { PCI_NAMED_DEVICE(NEC, NEC_USB), .driver_data = (unsigned long)ohci_quirk_nec },
{
/* Toshiba portege 4000 */
.vendor = PCI_VENDOR_ID_AL,
@@ -296,22 +278,10 @@ static const struct pci_device_id ohci_pci_quirks[] = {
.subdevice = 0x0004,
.driver_data = (unsigned long) broken_suspend,
},
- {
- PCI_DEVICE(PCI_VENDOR_ID_ITE, 0x8152),
- .driver_data = (unsigned long) broken_suspend,
- },
- {
- PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4397),
- .driver_data = (unsigned long)ohci_quirk_amd700,
- },
- {
- PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4398),
- .driver_data = (unsigned long)ohci_quirk_amd700,
- },
- {
- PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399),
- .driver_data = (unsigned long)ohci_quirk_amd700,
- },
+ { PCI_UNNAMED_DEVICE(ITE, 0x8152), .driver_data = (kernel_ulong_t)broken_suspend },
+ { PCI_UNNAMED_DEVICE(ATI, 0x4397), .driver_data = (kernel_ulong_t)ohci_quirk_amd700 },
+ { PCI_UNNAMED_DEVICE(ATI, 0x4398), .driver_data = (kernel_ulong_t)ohci_quirk_amd700 },
+ { PCI_UNNAMED_DEVICE(ATI, 0x4399), .driver_data = (kernel_ulong_t)ohci_quirk_amd700 },

/* FIXME for some of the early AMD 760 southbridges, OHCI
* won't work at all. blacklist them.
diff --git a/drivers/usb/host/whci/hcd.c b/drivers/usb/host/whci/hcd.c
index e019a50..91e6563 100644
--- a/drivers/usb/host/whci/hcd.c
+++ b/drivers/usb/host/whci/hcd.c
@@ -351,7 +351,7 @@ static void __exit whci_hc_driver_exit(void)
module_exit(whci_hc_driver_exit);

/* PCI device ID's that we handle (so it gets loaded) */
-static struct pci_device_id whci_hcd_id_table[] = {
+static const struct pci_device_id whci_hcd_id_table[] = {
{ PCI_DEVICE_CLASS(PCI_CLASS_WIRELESS_WHCI, ~0) },
{ /* empty last entry */ }
};


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