From: Rajesh Shah At unload time, the shpchp driver does not remove sysfs files it had created in the driver's probe entry point. This patch fixes this problem. Signed-off-by: Rajesh Shah Cc: Greg KH Signed-off-by: Andrew Morton --- drivers/pci/hotplug/shpchp.h | 1 + drivers/pci/hotplug/shpchp_core.c | 1 + drivers/pci/hotplug/shpchp_sysfs.c | 5 +++++ 3 files changed, 7 insertions(+) diff -puN drivers/pci/hotplug/shpchp_core.c~shpchp-fix-oops-at-driver-unload drivers/pci/hotplug/shpchp_core.c --- devel/drivers/pci/hotplug/shpchp_core.c~shpchp-fix-oops-at-driver-unload 2005-10-14 01:13:46.000000000 -0700 +++ devel-akpm/drivers/pci/hotplug/shpchp_core.c 2005-10-14 01:13:46.000000000 -0700 @@ -480,6 +480,7 @@ static void __exit unload_shpchpd(void) ctrl = shpchp_ctrl_list; while (ctrl) { + shpchp_remove_ctrl_files(ctrl); cleanup_slots(ctrl); kfree (ctrl->pci_bus); diff -puN drivers/pci/hotplug/shpchp.h~shpchp-fix-oops-at-driver-unload drivers/pci/hotplug/shpchp.h --- devel/drivers/pci/hotplug/shpchp.h~shpchp-fix-oops-at-driver-unload 2005-10-14 01:13:46.000000000 -0700 +++ devel-akpm/drivers/pci/hotplug/shpchp.h 2005-10-14 01:13:46.000000000 -0700 @@ -173,6 +173,7 @@ extern void get_hp_params_from_firmware( struct hotplug_params *hpp); extern int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum); +extern void shpchp_remove_ctrl_files(struct controller *ctrl); /* Global variables */ diff -puN drivers/pci/hotplug/shpchp_sysfs.c~shpchp-fix-oops-at-driver-unload drivers/pci/hotplug/shpchp_sysfs.c --- devel/drivers/pci/hotplug/shpchp_sysfs.c~shpchp-fix-oops-at-driver-unload 2005-10-14 01:13:46.000000000 -0700 +++ devel-akpm/drivers/pci/hotplug/shpchp_sysfs.c 2005-10-14 01:13:46.000000000 -0700 @@ -89,3 +89,8 @@ void shpchp_create_ctrl_files (struct co { device_create_file (&ctrl->pci_dev->dev, &dev_attr_ctrl); } + +void shpchp_remove_ctrl_files(struct controller *ctrl) +{ + device_remove_file(&ctrl->pci_dev->dev, &dev_attr_ctrl); +} _