PCI: use proper call to driver_create_file
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 28 Nov 2007 20:23:18 +0000 (12:23 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Jan 2008 04:40:33 +0000 (20:40 -0800)
Don't try to call the "raw" sysfs_create_file when we already have a
helper function to do this kind of work for us.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/pci-driver.c

index 6d1a21611818b92c5cd4524e61d046984cf4c476..73e362992694a4c60e00a0f8bec7038446342494 100644 (file)
@@ -96,17 +96,21 @@ pci_create_newid_file(struct pci_driver *drv)
 {
        int error = 0;
        if (drv->probe != NULL)
-               error = sysfs_create_file(&drv->driver.kobj,
-                                         &driver_attr_new_id.attr);
+               error = driver_create_file(&drv->driver, &driver_attr_new_id);
        return error;
 }
 
+static void pci_remove_newid_file(struct pci_driver *drv)
+{
+       driver_remove_file(&drv->driver, &driver_attr_new_id);
+}
 #else /* !CONFIG_HOTPLUG */
 static inline void pci_free_dynids(struct pci_driver *drv) {}
 static inline int pci_create_newid_file(struct pci_driver *drv)
 {
        return 0;
 }
+static inline void pci_remove_newid_file(struct pci_driver *drv) {}
 #endif
 
 /**
@@ -447,6 +451,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner,
 void
 pci_unregister_driver(struct pci_driver *drv)
 {
+       pci_remove_newid_file(drv);
        driver_unregister(&drv->driver);
        pci_free_dynids(drv);
 }