From cf587ffca489455f8fa2dbc57e1cbbf77bf5d27f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 12 Aug 2003 20:45:56 -0700 Subject: [PATCH] PCI: add PCI_DEVICE() macro to make pci_device_id tables easier to read. --- include/linux/pci.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/linux') diff --git a/include/linux/pci.h b/include/linux/pci.h index a4c7a4c7965e..90619534463e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -524,6 +524,18 @@ struct pci_driver { #define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) +/** + * PCI_DEVICE - macro used to describe a specific pci device + * @vend: the 16 bit PCI Vendor ID + * @dev: the 16 bit PCI Device ID + * + * This macro is used to create a struct pci_device_id that matches a + * specific device. The subvendor and subdevice fields will be set to + * PCI_ANY_ID. + */ +#define PCI_DEVICE(vend,dev) \ + .vendor = (vend), .device = (dev), \ + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID /* these external functions are only available when PCI support is enabled */ #ifdef CONFIG_PCI -- cgit v1.2.3 From 7c8114e7088a4db8eea6383626a4232c7031fb80 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 18 Aug 2003 01:22:01 -0700 Subject: [PATCH] PCI: add PCI_DEVICE_CLASS() macro to match PCI_DEVICE() macro. --- include/linux/pci.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/linux') diff --git a/include/linux/pci.h b/include/linux/pci.h index 90619534463e..55e296dd57e3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -537,6 +537,20 @@ struct pci_driver { .vendor = (vend), .device = (dev), \ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID +/** + * PCI_DEVICE_CLASS - macro used to describe a specific pci device class + * @dev_class: the class, subclass, prog-if triple for this device + * @dev_class_mask: the class mask for this device + * + * This macro is used to create a struct pci_device_id that matches a + * specific PCI class. The vendor, device, subvendor, and subdevice + * fields will be set to PCI_ANY_ID. + */ +#define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \ + .class = (dev_class), .class_mask = (dev_class_mask), \ + .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID + /* these external functions are only available when PCI support is enabled */ #ifdef CONFIG_PCI -- cgit v1.2.3 From 75d01c2efed5f5fcb8d0e65619cb5829decd193d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 20 Aug 2003 02:48:01 -0700 Subject: [PATCH] PCI: add PCI_NAME_SIZE instead of using DEVICE_NAME_SIZE based on a patch from OGAWA Hirofumi --- drivers/pci/names.c | 6 +++--- include/linux/pci.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'include/linux') diff --git a/drivers/pci/names.c b/drivers/pci/names.c index 121ad4b52319..eb707bf79dda 100644 --- a/drivers/pci/names.c +++ b/drivers/pci/names.c @@ -80,14 +80,14 @@ void __devinit pci_name_device(struct pci_dev *dev) } /* Ok, found the vendor, but unknown device */ - sprintf(name, "PCI device %04x:%04x (%." DEVICE_NAME_HALF "s)", + sprintf(name, "PCI device %04x:%04x (%." PCI_NAME_HALF "s)", dev->vendor, dev->device, vendor_p->name); return; /* Full match */ match_device: { - char *n = name + sprintf(name, "%." DEVICE_NAME_HALF - "s %." DEVICE_NAME_HALF "s", + char *n = name + sprintf(name, "%." PCI_NAME_HALF + "s %." PCI_NAME_HALF "s", vendor_p->name, device_p->name); int nr = device_p->seen + 1; device_p->seen = nr; diff --git a/include/linux/pci.h b/include/linux/pci.h index 55e296dd57e3..287f8ebc4bf2 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -420,7 +420,9 @@ struct pci_dev { unsigned int transparent:1; /* Transparent PCI bridge */ unsigned int multifunction:1;/* Part of multi-function device */ #ifdef CONFIG_PCI_NAMES - char pretty_name[DEVICE_NAME_SIZE]; /* pretty name for users to see */ +#define PCI_NAME_SIZE 50 +#define PCI_NAME_HALF __stringify(20) /* less than half to handle slop */ + char pretty_name[PCI_NAME_SIZE]; /* pretty name for users to see */ #endif }; -- cgit v1.2.3 From c8480a1881f8a0422603ee56a95e079709d678a6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 20 Aug 2003 20:07:11 -0700 Subject: PCI: added the pci_pretty_name() macro to pci.h as 2 arches already had it. --- arch/alpha/kernel/sys_marvel.c | 7 ------- arch/x86_64/kernel/pci-gart.c | 6 ------ include/linux/pci.h | 7 +++++++ 3 files changed, 7 insertions(+), 13 deletions(-) (limited to 'include/linux') diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index c5b58f01a790..561122beae58 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c @@ -33,13 +33,6 @@ # error NR_IRQS < MARVEL_NR_IRQS !!! #endif -/* ??? Should probably be generic. */ -#ifdef CONFIG_PCI_NAMES -#define pci_pretty_name(x) ((x)->pretty_name) -#else -#define pci_pretty_name(x) "" -#endif - /* * Interrupt handling. diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index 6e97e0daa765..6842d5823465 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c @@ -31,12 +31,6 @@ #include #include -#ifdef CONFIG_PCI_NAMES -#define pci_pretty_name(dev) ((dev)->pretty_name) -#else -#define pci_pretty_name(dev) "" -#endif - dma_addr_t bad_dma_address; unsigned long iommu_bus_base; /* GART remapping area (physical) */ diff --git a/include/linux/pci.h b/include/linux/pci.h index 287f8ebc4bf2..3c4fc6c62773 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -842,6 +842,13 @@ static inline char *pci_name(struct pci_dev *pdev) return pdev->dev.bus_id; } +/* Some archs want to see the pretty pci name, so use this macro */ +#ifdef CONFIG_PCI_NAMES +#define pci_pretty_name(dev) ((dev)->pretty_name) +#else +#define pci_pretty_name(dev) "" +#endif + /* * The world is not perfect and supplies us with broken PCI devices. * For at least a part of these bugs we need a work-around, so both -- cgit v1.2.3