PCI Hotplug changes for 2.5.50
PATCH 1/1 PCI Hotplug changes for 2.5.50
This also includes Adam's patch for pci.h
Pull from: bk://linuxusb.bkbits.net/pci_hp-2.5
thanks,
greg k-h
drivers/hotplug/Makefile | 9 ++++--- drivers/hotplug/cpci_hotplug_core.c | 15 +++--------- drivers/hotplug/cpci_hotplug_pci.c | 8 +++--- drivers/hotplug/ibmphp_ebda.c | 16 ++++++------- drivers/hotplug/pci_hotplug_core.c | 43 +++++++++++++++++++++++++----------- include/linux/pci.h | 22 ++++++++---------- 6 files changed, 62 insertions(+), 51 deletions(-)
-----
[email protected], 2002-12-01 23:09:28-08:00, [email protected]
Merge kroah.com:/home/linux/linux/BK/bleeding-2.5 into kroah.com:/home/linux/linux/BK/pci_hp-2.5
include/linux/pci.h | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
------
[email protected], 2002-11-30 01:28:13-08:00, [email protected]
PCI: changed pci_?et_drvdata to use the generic driver model functions
instead of accessing the data directly.
include/linux/pci.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
------
[email protected], 2002-11-30 01:18:05-08:00, [email protected]
[PATCH] Patch/resubmit(2.5.50): Eliminate pci_dev.driver_data
To review, this patch deletes pci_dev.driver_data, using the
existing pci_dev.device.driver_data field instead, thereby shrinking struct pci_dev by four bytes on 32-bit machines. The few device drivers that attempted to directly reference pci_dev.driver_data were fixed in a patch of mine that Jeff Garzik got into 2.5.45. Also, making this change should help with memory allocation improvements in the future, although that's a separate issue.
include/linux/pci.h | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
------
[email protected], 2002-11-26 11:26:14-08:00, [email protected]
[PATCH] C99 initializers for drivers/hotplug
Here's a small set of patches for switching drivers/hotplug to use C99 initializers. The patches are against 2.5.49.
drivers/hotplug/cpci_hotplug_pci.c | 8 ++++---- drivers/hotplug/ibmphp_ebda.c | 16 ++++++++-------- drivers/hotplug/pci_hotplug_core.c | 16 ++++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-)
------
[email protected], 2002-11-26 11:23:49-08:00, [email protected]
PCI hotplug: moved cpci_hotplug.o to be built into pci_hotplug.o if enabled.
drivers/hotplug/Makefile | 9 +++++---- drivers/hotplug/cpci_hotplug_core.c | 15 ++++----------- drivers/hotplug/pci_hotplug_core.c | 27 +++++++++++++++++++++++---- 3 files changed, 32 insertions(+), 19 deletions(-)
------
PATCH 1/1 PCI Hotplug changes for 2.5.50
ChangeSet 1.871.3.1, 2002/11/26 11:23:49-08:00, [email protected]
PCI hotplug: moved cpci_hotplug.o to be built into pci_hotplug.o if enabled.
drivers/hotplug/Makefile +5 -4
@@ -8,13 +8,17 @@ obj-$(CONFIG_HOTPLUG_PCI_COMPAQ) += cpqphp.o obj-$(CONFIG_HOTPLUG_PCI_IBM) += ibmphp.o obj-$(CONFIG_HOTPLUG_PCI_ACPI) += acpiphp.o -obj-$(CONFIG_HOTPLUG_PCI_CPCI) += cpci_hotplug.o obj-$(CONFIG_HOTPLUG_PCI_CPCI_ZT5550) += cpcihp_zt5550.o obj-$(CONFIG_HOTPLUG_PCI_CPCI_GENERIC) += cpcihp_generic.o pci_hotplug-objs := pci_hotplug_core.o \ pci_hotplug_util.o +ifdef CONFIG_HOTPLUG_PCI_CPCI +pci_hotplug-objs += cpci_hotplug_core.o \ + cpci_hotplug_pci.o +endif + cpqphp-objs := cpqphp_core.o \ cpqphp_ctrl.o \ cpqphp_proc.o \
@@ -30,9 +34,6 @@ acpiphp_glue.o \ acpiphp_pci.o \ acpiphp_res.o - -cpci_hotplug-objs := cpci_hotplug_core.o \ - cpci_hotplug_pci.o ifdef CONFIG_HOTPLUG_PCI_ACPI EXTRA_CFLAGS += -D_LINUX -I$(TOPDIR)/drivers/acpi
drivers/hotplug/cpci_hotplug_core.c +4 -11
@@ -891,16 +891,17 @@return ; } -static int __init -cpci_hotplug_init (void ) +int __init +cpci_hotplug_init (int debug) {spin_lock_init (&list_lock); + cpci_debug = debug;info (DRIVER_DESC " version: " DRIVER_VERSION );return 0 ; } -static void __exit +void __exitcpci_hotplug_exit (void ) {/*
@@ -909,14 +910,6 @@cleanup_slots (); } -module_init (cpci_hotplug_init); -module_exit (cpci_hotplug_exit); - -MODULE_AUTHOR (DRIVER_AUTHOR ); -MODULE_DESCRIPTION (DRIVER_DESC ); -MODULE_LICENSE ("GPL" ); -MODULE_PARM (cpci_debug,"i" ); -MODULE_PARM_DESC (cpci_debug,"Debugging mode" );EXPORT_SYMBOL_GPL (cpci_hp_register_controller);EXPORT_SYMBOL_GPL (cpci_hp_unregister_controller);
drivers/hotplug/pci_hotplug_core.c +23 -4
@@ -60,8 +60,8 @@/* local variables */ static int debug; -#define DRIVER_VERSION "0.4" -#define DRIVER_AUTHOR "Greg Kroah-Hartman <[email protected]>" +#define DRIVER_VERSION "0.5" +#define DRIVER_AUTHOR "Greg Kroah-Hartman <[email protected]>, Scott Murray <[email protected]>"#define DRIVER_DESC "PCI Hot Plug PCI Core"
@@ -89,7 +89,7 @@static spinlock_t mount_lock;/* protects our mount_count */ static spinlock_t list_lock; -LIST_HEAD (pci_hotplug_slot_list); +static LIST_HEAD (pci_hotplug_slot_list);/* these strings match up with the values in pci_bus_speed */ static char *pci_bus_speed_strings[] = {
@@ -121,6 +121,14 @@static const char *slotdir_name ="slots" ;#endif +#ifdef CONFIG_HOTPLUG_PCI_CPCI +extern int cpci_hotplug_init (int debug); +extern void cpci_hotplug_exit (void ); +#else +static inline int cpci_hotplug_init (int debug) {return 0 ; } +static inline void cpci_hotplug_exit (void ) { } +#endif +static struct inode *pcihpfs_get_inode (struct super_block *sb,int mode,dev_t dev) {struct inode *inode =new_inode (sb);
@@ -1273,19 +1281,30 @@ goto exit; } + result =cpci_hotplug_init (debug); +if (result) { +err ("cpci_hotplug_init with error %d\n" , result); + goto error_fs; + } +#ifdef CONFIG_PROC_FS /* create mount point for pcihpfs */ slotdir =proc_mkdir (slotdir_name, proc_bus_pci_dir);#endif info (DRIVER_DESC " version: " DRIVER_VERSION "\n" ); - + goto exit; + +error_fs: +unregister_filesystem (&pcihpfs_type); exit:return result; } static void __exit pci_hotplug_exit (void) { +cpci_hotplug_exit (); +unregister_filesystem (&pcihpfs_type);#ifdef CONFIG_PROC_FS
ChangeSet 1.871.3.2, 2002/11/26 11:26:14-08:00, [email protected]
[PATCH] C99 initializers for drivers/hotplug
Here's a small set of patches for switching drivers/hotplug to use C99 initializers. The patches are against 2.5.49.
drivers/hotplug/cpci_hotplug_pci.c +4 -4
@@ -572,16 +572,16 @@ }static struct pci_visit configure_functions = { - visit_pci_dev:configure_visit_pci_dev, + .visit_pci_dev = configure_visit_pci_dev, };static struct pci_visit unconfigure_functions_phase1 = { - post_visit_pci_dev:unconfigure_visit_pci_dev_phase1 + .post_visit_pci_dev = unconfigure_visit_pci_dev_phase1 };static struct pci_visit unconfigure_functions_phase2 = { - post_visit_pci_bus:unconfigure_visit_pci_bus_phase2, - post_visit_pci_dev:unconfigure_visit_pci_dev_phase2 + .post_visit_pci_bus = unconfigure_visit_pci_bus_phase2, + .post_visit_pci_dev = unconfigure_visit_pci_dev_phase2 };
drivers/hotplug/ibmphp_ebda.c +8 -8
@@ -1240,11 +1240,11 @@static struct pci_device_id id_table[]__devinitdata = { { - vendor:PCI_VENDOR_ID_IBM , - device:HPC_DEVICE_ID , - subvendor:PCI_VENDOR_ID_IBM , - subdevice:HPC_SUBSYSTEM_ID , - class: ((PCI_CLASS_SYSTEM_PCI_HOTPLUG <<8 ) |0x00 ), + .vendor =PCI_VENDOR_ID_IBM , + .device =HPC_DEVICE_ID , + .subvendor =PCI_VENDOR_ID_IBM , + .subdevice =HPC_SUBSYSTEM_ID , + .class = ((PCI_CLASS_SYSTEM_PCI_HOTPLUG <<8 ) |0x00 ), }, {} };
@@ -1252,9 +1252,9 @@static int ibmphp_probe (struct pci_dev *,const struct pci_device_id *);static struct pci_driver ibmphp_driver = { - name:"ibmphp" , - id_table: id_table, - probe: ibmphp_probe, + .name ="ibmphp" , + .id_table = id_table, + .probe = ibmphp_probe, };int ibmphp_register_pci (void )
drivers/hotplug/pci_hotplug_core.c +8 -8
@@ -319,19 +319,19 @@/* file ops for the "max bus speed" files */ static ssize_t max_bus_speed_read_file (struct file *file,char *buf,size_t count,loff_t *offset);static struct file_operations max_bus_speed_file_operations = { - read: max_bus_speed_read_file, - write: default_write_file, - open: default_open, - llseek: default_file_lseek, + .read = max_bus_speed_read_file, + .write = default_write_file, + .open = default_open, + .llseek = default_file_lseek, };/* file ops for the "current bus speed" files */ static ssize_t cur_bus_speed_read_file (struct file *file,char *buf,size_t count,loff_t *offset);static struct file_operations cur_bus_speed_file_operations = { - read: cur_bus_speed_read_file, - write: default_write_file, - open: default_open, - llseek: default_file_lseek, + .read = cur_bus_speed_read_file, + .write = default_write_file, + .open = default_open, + .llseek = default_file_lseek, };/* file ops for the "test" files */
ChangeSet 1.924.3.2, 2002/11/30 01:18:05-08:00, [email protected]
[PATCH] Patch/resubmit(2.5.50): Eliminate pci_dev.driver_data
To review, this patch deletes pci_dev.driver_data, using the
existing pci_dev.device.driver_data field instead, thereby shrinking struct pci_dev by four bytes on 32-bit machines. The few device drivers that attempted to directly reference pci_dev.driver_data were fixed in a patch of mine that Jeff Garzik got into 2.5.45. Also, making this change should help with memory allocation improvements in the future, although that's a separate issue.
include/linux/pci.h +2 -3
@@ -344,7 +344,6 @@u8 rom_base_reg;/* which config register controls the ROM */ struct pci_driver *driver;/* which driver has allocated this device */ -void *driver_data;/* data private to the driver */ u64 dma_mask;/* Mask of the bits of bus address this device implements. Normally this is 0xffffffff. You only need to change
@@ -753,12 +752,12 @@*/ static inline void *pci_get_drvdata (struct pci_dev *pdev) { -return pdev->driver_data; +return pdev->dev.driver_data; }static inline void pci_set_drvdata (struct pci_dev *pdev,void *data) { - pdev->driver_data = data; + pdev->dev.driver_data = data; }/*
ChangeSet 1.924.3.3, 2002/11/30 01:28:13-08:00, [email protected]
PCI: changed pci_?et_drvdata to use the generic driver model functions
instead of accessing the data directly.
include/linux/pci.h +4 -4
@@ -747,17 +747,17 @@ pci_resource_start((dev),(bar)) + 1))/* Similar to the helpers above, these manipulate per-pci_dev -* driver-specific data. Currently stored as pci_dev::driver_data, -* a void pointer, but it is not present on older kernels. +* driver-specific data. They are really just a wrapper around +* the generic device structure functions of these calls. */ static inline void *pci_get_drvdata (struct pci_dev *pdev) { -return pdev->dev.driver_data; +return dev_get_drvdata (&pdev->dev); }static inline void pci_set_drvdata (struct pci_dev *pdev,void *data) { - pdev->dev.driver_data = data; +dev_set_drvdata (&pdev->dev, data); }/*