[PATCH] shpchp: fix oops at driver unload
authorrajesh.shah@intel.com <rajesh.shah@intel.com>
Thu, 13 Oct 2005 19:05:44 +0000 (12:05 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 28 Oct 2005 22:37:01 +0000 (15:37 -0700)
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 <rajesh.shah@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/hotplug/shpchp.h
drivers/pci/hotplug/shpchp_core.c
drivers/pci/hotplug/shpchp_sysfs.c

index dae1543a4e281cb616f3a709bdaa64bec7c5b91b..abe2cf411e6865927d6470cd84c13c24b68655f3 100644 (file)
@@ -173,6 +173,7 @@ extern void get_hp_params_from_firmware(struct pci_dev *dev,
                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 */
index 6a2b4a0193aa8377bc84fbfc5cfdad9c25bf42df..63628e01dd436edefa8e0fe8dda89b503e97f7eb 100644 (file)
@@ -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);
index 807ef66899c74bbb7162c675e0fd58af30ea3e26..f5cfbf2c047c92796c7bdde79d4dbc33c977c6a8 100644 (file)
@@ -89,3 +89,8 @@ void shpchp_create_ctrl_files (struct controller *ctrl)
 {
        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);
+}