Loading drivers/pci/pci-driver.c +10 −47 Original line number Original line Diff line number Diff line Loading @@ -139,7 +139,6 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) return retval; return retval; return count; return count; } } static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); /** /** * store_remove_id - remove a PCI device ID from this driver * store_remove_id - remove a PCI device ID from this driver Loading Loading @@ -185,38 +184,16 @@ store_remove_id(struct device_driver *driver, const char *buf, size_t count) return retval; return retval; return count; return count; } } static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id); static int static struct driver_attribute pci_drv_attrs[] = { pci_create_newid_files(struct pci_driver *drv) __ATTR(new_id, S_IWUSR, NULL, store_new_id), { __ATTR(remove_id, S_IWUSR, NULL, store_remove_id), int error = 0; __ATTR_NULL, }; if (drv->probe != NULL) { error = driver_create_file(&drv->driver, &driver_attr_new_id); if (error == 0) { error = driver_create_file(&drv->driver, &driver_attr_remove_id); if (error) driver_remove_file(&drv->driver, &driver_attr_new_id); } } return error; } static void pci_remove_newid_files(struct pci_driver *drv) #else { #define pci_drv_attrs NULL driver_remove_file(&drv->driver, &driver_attr_remove_id); #endif /* CONFIG_HOTPLUG */ driver_remove_file(&drv->driver, &driver_attr_new_id); } #else /* !CONFIG_HOTPLUG */ static inline int pci_create_newid_files(struct pci_driver *drv) { return 0; } static inline void pci_remove_newid_files(struct pci_driver *drv) {} #endif /** /** * pci_match_id - See if a pci device matches a given pci_id table * pci_match_id - See if a pci device matches a given pci_id table Loading Loading @@ -1162,8 +1139,6 @@ const struct dev_pm_ops pci_dev_pm_ops = { int __pci_register_driver(struct pci_driver *drv, struct module *owner, int __pci_register_driver(struct pci_driver *drv, struct module *owner, const char *mod_name) const char *mod_name) { { int error; /* initialize common driver fields */ /* initialize common driver fields */ drv->driver.name = drv->name; drv->driver.name = drv->name; drv->driver.bus = &pci_bus_type; drv->driver.bus = &pci_bus_type; Loading @@ -1174,19 +1149,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, INIT_LIST_HEAD(&drv->dynids.list); INIT_LIST_HEAD(&drv->dynids.list); /* register with core */ /* register with core */ error = driver_register(&drv->driver); return driver_register(&drv->driver); if (error) goto out; error = pci_create_newid_files(drv); if (error) goto out_newid; out: return error; out_newid: driver_unregister(&drv->driver); goto out; } } /** /** Loading @@ -1202,7 +1165,6 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, void void pci_unregister_driver(struct pci_driver *drv) pci_unregister_driver(struct pci_driver *drv) { { pci_remove_newid_files(drv); driver_unregister(&drv->driver); driver_unregister(&drv->driver); pci_free_dynids(drv); pci_free_dynids(drv); } } Loading Loading @@ -1302,6 +1264,7 @@ struct bus_type pci_bus_type = { .shutdown = pci_device_shutdown, .shutdown = pci_device_shutdown, .dev_attrs = pci_dev_attrs, .dev_attrs = pci_dev_attrs, .bus_attrs = pci_bus_attrs, .bus_attrs = pci_bus_attrs, .drv_attrs = pci_drv_attrs, .pm = PCI_PM_OPS_PTR, .pm = PCI_PM_OPS_PTR, }; }; Loading Loading
drivers/pci/pci-driver.c +10 −47 Original line number Original line Diff line number Diff line Loading @@ -139,7 +139,6 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) return retval; return retval; return count; return count; } } static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); /** /** * store_remove_id - remove a PCI device ID from this driver * store_remove_id - remove a PCI device ID from this driver Loading Loading @@ -185,38 +184,16 @@ store_remove_id(struct device_driver *driver, const char *buf, size_t count) return retval; return retval; return count; return count; } } static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id); static int static struct driver_attribute pci_drv_attrs[] = { pci_create_newid_files(struct pci_driver *drv) __ATTR(new_id, S_IWUSR, NULL, store_new_id), { __ATTR(remove_id, S_IWUSR, NULL, store_remove_id), int error = 0; __ATTR_NULL, }; if (drv->probe != NULL) { error = driver_create_file(&drv->driver, &driver_attr_new_id); if (error == 0) { error = driver_create_file(&drv->driver, &driver_attr_remove_id); if (error) driver_remove_file(&drv->driver, &driver_attr_new_id); } } return error; } static void pci_remove_newid_files(struct pci_driver *drv) #else { #define pci_drv_attrs NULL driver_remove_file(&drv->driver, &driver_attr_remove_id); #endif /* CONFIG_HOTPLUG */ driver_remove_file(&drv->driver, &driver_attr_new_id); } #else /* !CONFIG_HOTPLUG */ static inline int pci_create_newid_files(struct pci_driver *drv) { return 0; } static inline void pci_remove_newid_files(struct pci_driver *drv) {} #endif /** /** * pci_match_id - See if a pci device matches a given pci_id table * pci_match_id - See if a pci device matches a given pci_id table Loading Loading @@ -1162,8 +1139,6 @@ const struct dev_pm_ops pci_dev_pm_ops = { int __pci_register_driver(struct pci_driver *drv, struct module *owner, int __pci_register_driver(struct pci_driver *drv, struct module *owner, const char *mod_name) const char *mod_name) { { int error; /* initialize common driver fields */ /* initialize common driver fields */ drv->driver.name = drv->name; drv->driver.name = drv->name; drv->driver.bus = &pci_bus_type; drv->driver.bus = &pci_bus_type; Loading @@ -1174,19 +1149,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, INIT_LIST_HEAD(&drv->dynids.list); INIT_LIST_HEAD(&drv->dynids.list); /* register with core */ /* register with core */ error = driver_register(&drv->driver); return driver_register(&drv->driver); if (error) goto out; error = pci_create_newid_files(drv); if (error) goto out_newid; out: return error; out_newid: driver_unregister(&drv->driver); goto out; } } /** /** Loading @@ -1202,7 +1165,6 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, void void pci_unregister_driver(struct pci_driver *drv) pci_unregister_driver(struct pci_driver *drv) { { pci_remove_newid_files(drv); driver_unregister(&drv->driver); driver_unregister(&drv->driver); pci_free_dynids(drv); pci_free_dynids(drv); } } Loading Loading @@ -1302,6 +1264,7 @@ struct bus_type pci_bus_type = { .shutdown = pci_device_shutdown, .shutdown = pci_device_shutdown, .dev_attrs = pci_dev_attrs, .dev_attrs = pci_dev_attrs, .bus_attrs = pci_bus_attrs, .bus_attrs = pci_bus_attrs, .drv_attrs = pci_drv_attrs, .pm = PCI_PM_OPS_PTR, .pm = PCI_PM_OPS_PTR, }; }; Loading