PCI fixes for 2.6.0-test3
Subsystems (4)
PATCH 1/1 PCI fixes for 2.6.0-test3
Hi,
Here are some tiny PCI patches against 2.6.0-test3. They fix a bug with code that shouldn't have gotten into setup-bus.c and allow pci drivers to properly propagate their probe() errors up to the driver core (which now reports them.) I've also moved the pci_pretty_name() macro to pci.h as two different archs already created the same macro for themselves, and created the PCI_DEVICE() and PCI_DEVICE_CLASS() macro to make the pci_device_id lists in drivers a lot simpler to use.
I also added two compile bug fixes for video drivers, but you already beat me to them in your tree, so they merged away.
Please pull from:
bk://kernel.bkbits.net/gregkh/linux/pci-2.6
thanks,
greg k-h
p.s. I'll send these as patches in response to this email to lkml for those who want to see them.
arch/alpha/kernel/sys_marvel.c | 7 ------- arch/x86_64/kernel/pci-gart.c | 6 ------ drivers/media/video/saa7111.c | 2 +- drivers/pci/hotplug/cpqphp_core.c | 1 - drivers/pci/hotplug/cpqphp_nvram.c | 1 - drivers/pci/names.c | 6 +++--- drivers/pci/pci-driver.c | 6 ++---- drivers/pci/setup-bus.c | 5 ----- drivers/video/tridentfb.c | 2 +- include/linux/pci.h | 37 ++++++++++++++++++++++++++++++++++++- 10 files changed, 43 insertions(+), 30 deletions(-)
------
<janiceg:us.ibm.com>:
o PCI: testing for probe errors in pci-driver.c
Greg Kroah-Hartman:
o PCI: added the pci_pretty_name() macro to pci.h as 2 arches already had it
o FB: fix broken tridentfb.c driver due to device.name change
o Video: fix broken saa7111.c driver due to i2c structure changes
o PCI: add PCI_NAME_SIZE instead of using DEVICE_NAME_SIZE
o PCI: remove #include <linux/miscdevice.h> from some pci hotplug drivers
o PCI: add PCI_DEVICE_CLASS() macro to match PCI_DEVICE() macro
o PCI: add PCI_DEVICE() macro to make pci_device_id tables easier to read
Ivan Kokshaysky:
o PCI: undo recent pci_setup_bridge() change
PATCH 1/1 PCI fixes for 2.6.0-test3
ChangeSet 1.1123.21.1, 2003/08/13 10:45:56-07:00, [email protected]
[PATCH] PCI: add PCI_DEVICE() macro to make pci_device_id tables easier to read.
include/linux/pci.h | 12 ++++++++++++ 1 files changed, 12 insertions(+)
include/linux/pci.h +12 -0
@@ -524,6 +524,18 @@#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
ChangeSet 1.1123.21.2, 2003/08/13 17:42:56-07:00, [email protected]
[PATCH] PCI: testing for probe errors in pci-driver.c
Currently if __pci_device_probe locates the correct device driver, but receives an error from the static drv->probe function, this error is not reported.
The attached patch reports the above error condition to the caller. Only when a match for the device in the static tables is not found, is the dynamic driver table searched.
drivers/pci/pci-driver.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/pci/pci-driver.c +2 -4
@@ -122,10 +122,8 @@if (!pci_dev->driver && drv->probe) { error =pci_device_probe_static (drv, pci_dev); -if (error >=0 ) -return error; - - error =pci_device_probe_dynamic (drv, pci_dev); +if (error == -ENODEV ) + error =pci_device_probe_dynamic (drv, pci_dev); }return error; }
ChangeSet 1.1123.21.3, 2003/08/18 15:22:01-07:00, [email protected]
[PATCH] PCI: add PCI_DEVICE_CLASS() macro to match PCI_DEVICE() macro.
include/linux/pci.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+)
include/linux/pci.h +14 -0
@@ -537,6 +537,20 @@ .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
ChangeSet 1.1123.21.4, 2003/08/20 15:57:41-07:00, [email protected]
[PATCH] PCI: remove #include <linux/miscdevice.h> from some pci hotplug drivers.
It's not needed.
drivers/pci/hotplug/cpqphp_core.c | 1 - drivers/pci/hotplug/cpqphp_nvram.c | 1 - 2 files changed, 2 deletions(-)
drivers/pci/hotplug/cpqphp_core.c +0 -1
@@ -34,7 +34,6 @@#include <linux/kernel.h> #include <linux/types.h> #include <linux/proc_fs.h> -#include <linux/miscdevice.h> #include <linux/slab.h> #include <linux/workqueue.h> #include <linux/pci.h>
drivers/pci/hotplug/cpqphp_nvram.c +0 -1
@@ -31,7 +31,6 @@#include <linux/kernel.h> #include <linux/types.h> #include <linux/proc_fs.h> -#include <linux/miscdevice.h> #include <linux/slab.h> #include <linux/workqueue.h> #include <linux/pci.h>
ChangeSet 1.1285.1.2, 2003/08/20 16:33:09-07:00, [email protected]
[PATCH] PCI: undo recent pci_setup_bridge() change
That patch went into mainline by mistake - it was initial variant of a fix for the problem with disabled P2P bridges. Which has already been fixed properly in -test3.
drivers/pci/setup-bus.c | 5 ----- 1 files changed, 5 deletions(-)
drivers/pci/setup-bus.c +0 -5
@@ -203,11 +203,6 @@Enable ISA in either case (FIXME!). */ l = (bus->resource[0 ]->flags &IORESOURCE_BUS_HAS_VGA ) ?0x0c :0x04 ;pci_write_config_word (bridge,PCI_BRIDGE_CONTROL , l); - -/* Make sure the bridge COMMAND register has the appropriate -bits set, just in case... -*/ -pcibios_enable_device (bridge,0xfff ); }/* Check whether the bridge supports optional I/O and
ChangeSet 1.1285.1.3, 2003/08/20 16:48:01-07:00, [email protected]
[PATCH] PCI: add PCI_NAME_SIZE instead of using DEVICE_NAME_SIZE
based on a patch from OGAWA Hirofumi <[email protected]>
drivers/pci/names.c | 6 +++--- include/linux/pci.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/pci/names.c +3 -3
@@ -80,14 +80,14 @@ }/* 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;
include/linux/pci.h +3 -1
@@ -420,7 +420,9 @@ 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 };
ChangeSet 1.1285.1.4, 2003/08/20 16:49:58-07:00, [email protected]
Video: fix broken saa7111.c driver due to i2c structure changes.
drivers/media/video/saa7111.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/media/video/saa7111.c +1 -1
@@ -55,7 +55,7 @@#include <linux/i2c.h> #include <linux/i2c-dev.h> -#define I2C_NAME (s) (s)->dev.name +#define I2C_NAME (s) (s)->name#include <linux/video_decoder.h>
ChangeSet 1.1285.1.5, 2003/08/20 16:59:06-07:00, [email protected]
FB: fix broken tridentfb.c driver due to device.name change.
drivers/video/tridentfb.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/video/tridentfb.c +1 -1
@@ -1129,7 +1129,7 @@return -1 ; } -output ("%s board found\n" , dev->dev.name); +output ("%s board found\n" ,pci_name (dev));#if 0 output ("Trident board found : mem = %X,io = %X, mem_v = %X, io_v = %X\n" , tridentfb_fix.smem_start, tridentfb_fix.mmio_start, fb_info.screen_base, default_par.io_virt);
ChangeSet 1.1285.1.6, 2003/08/21 10:07:11-07:00, [email protected]
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(-)
arch/alpha/kernel/sys_marvel.c +0 -7
@@ -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.
arch/x86_64/kernel/pci-gart.c +0 -6
@@ -31,12 +31,6 @@#include <asm/kdebug.h> #include <asm/proto.h> -#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) */
include/linux/pci.h +7 -0
@@ -842,6 +842,13 @@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