diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 14:16:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 14:16:20 -0400 |
commit | 4a52246302f01596f0edf7b4a3e6425e23479192 (patch) | |
tree | f384d86722d3ccfc875e3e5e8d8726e993a922ee /drivers/pci/pci-driver.c | |
parent | 9f9d2760da8c7f94fae119fac3e13d5a1702f8f0 (diff) | |
parent | adc80ae60eae24a43a357bf5b30fb496f34aa605 (diff) |
Merge tag 'driver-core-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core patches for 3.4-rc1 from Greg KH:
"Here's the big driver core merge for 3.4-rc1.
Lots of various things here, sysfs fixes/tweaks (with the nlink
breakage reverted), dynamic debugging updates, w1 drivers, hyperv
driver updates, and a variety of other bits and pieces, full
information in the shortlog."
* tag 'driver-core-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (78 commits)
Tools: hv: Support enumeration from all the pools
Tools: hv: Fully support the new KVP verbs in the user level daemon
Drivers: hv: Support the newly introduced KVP messages in the driver
Drivers: hv: Add new message types to enhance KVP
regulator: Support driver probe deferral
Revert "sysfs: Kill nlink counting."
uevent: send events in correct order according to seqnum (v3)
driver core: minor comment formatting cleanups
driver core: move the deferred probe pointer into the private area
drivercore: Add driver probe deferral mechanism
DS2781 Maxim Stand-Alone Fuel Gauge battery and w1 slave drivers
w1_bq27000: Only one thread can access the bq27000 at a time.
w1_bq27000 - remove w1_bq27000_write
w1_bq27000: remove unnecessary NULL test.
sysfs: Fix memory leak in sysfs_sd_setsecdata().
intel_idle: Revert change of auto_demotion_disable_flags for Nehalem
w1: Fix w1_bq27000
driver-core: documentation: fix up Greg's email address
powernow-k6: Really enable auto-loading
powernow-k7: Fix CPU family number
...
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 3623d65f8b86..8d9616b821ca 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -72,9 +72,7 @@ int pci_add_dynid(struct pci_driver *drv, | |||
72 | list_add_tail(&dynid->node, &drv->dynids.list); | 72 | list_add_tail(&dynid->node, &drv->dynids.list); |
73 | spin_unlock(&drv->dynids.lock); | 73 | spin_unlock(&drv->dynids.lock); |
74 | 74 | ||
75 | get_driver(&drv->driver); | ||
76 | retval = driver_attach(&drv->driver); | 75 | retval = driver_attach(&drv->driver); |
77 | put_driver(&drv->driver); | ||
78 | 76 | ||
79 | return retval; | 77 | return retval; |
80 | } | 78 | } |
@@ -190,43 +188,34 @@ store_remove_id(struct device_driver *driver, const char *buf, size_t count) | |||
190 | static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id); | 188 | static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id); |
191 | 189 | ||
192 | static int | 190 | static int |
193 | pci_create_newid_file(struct pci_driver *drv) | 191 | pci_create_newid_files(struct pci_driver *drv) |
194 | { | 192 | { |
195 | int error = 0; | 193 | int error = 0; |
196 | if (drv->probe != NULL) | ||
197 | error = driver_create_file(&drv->driver, &driver_attr_new_id); | ||
198 | return error; | ||
199 | } | ||
200 | |||
201 | static void pci_remove_newid_file(struct pci_driver *drv) | ||
202 | { | ||
203 | driver_remove_file(&drv->driver, &driver_attr_new_id); | ||
204 | } | ||
205 | 194 | ||
206 | static int | 195 | if (drv->probe != NULL) { |
207 | pci_create_removeid_file(struct pci_driver *drv) | 196 | error = driver_create_file(&drv->driver, &driver_attr_new_id); |
208 | { | 197 | if (error == 0) { |
209 | int error = 0; | 198 | error = driver_create_file(&drv->driver, |
210 | if (drv->probe != NULL) | 199 | &driver_attr_remove_id); |
211 | error = driver_create_file(&drv->driver,&driver_attr_remove_id); | 200 | if (error) |
201 | driver_remove_file(&drv->driver, | ||
202 | &driver_attr_new_id); | ||
203 | } | ||
204 | } | ||
212 | return error; | 205 | return error; |
213 | } | 206 | } |
214 | 207 | ||
215 | static void pci_remove_removeid_file(struct pci_driver *drv) | 208 | static void pci_remove_newid_files(struct pci_driver *drv) |
216 | { | 209 | { |
217 | driver_remove_file(&drv->driver, &driver_attr_remove_id); | 210 | driver_remove_file(&drv->driver, &driver_attr_remove_id); |
211 | driver_remove_file(&drv->driver, &driver_attr_new_id); | ||
218 | } | 212 | } |
219 | #else /* !CONFIG_HOTPLUG */ | 213 | #else /* !CONFIG_HOTPLUG */ |
220 | static inline int pci_create_newid_file(struct pci_driver *drv) | 214 | static inline int pci_create_newid_files(struct pci_driver *drv) |
221 | { | 215 | { |
222 | return 0; | 216 | return 0; |
223 | } | 217 | } |
224 | static inline void pci_remove_newid_file(struct pci_driver *drv) {} | 218 | static inline void pci_remove_newid_files(struct pci_driver *drv) {} |
225 | static inline int pci_create_removeid_file(struct pci_driver *drv) | ||
226 | { | ||
227 | return 0; | ||
228 | } | ||
229 | static inline void pci_remove_removeid_file(struct pci_driver *drv) {} | ||
230 | #endif | 219 | #endif |
231 | 220 | ||
232 | /** | 221 | /** |
@@ -1138,18 +1127,12 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, | |||
1138 | if (error) | 1127 | if (error) |
1139 | goto out; | 1128 | goto out; |
1140 | 1129 | ||
1141 | error = pci_create_newid_file(drv); | 1130 | error = pci_create_newid_files(drv); |
1142 | if (error) | 1131 | if (error) |
1143 | goto out_newid; | 1132 | goto out_newid; |
1144 | |||
1145 | error = pci_create_removeid_file(drv); | ||
1146 | if (error) | ||
1147 | goto out_removeid; | ||
1148 | out: | 1133 | out: |
1149 | return error; | 1134 | return error; |
1150 | 1135 | ||
1151 | out_removeid: | ||
1152 | pci_remove_newid_file(drv); | ||
1153 | out_newid: | 1136 | out_newid: |
1154 | driver_unregister(&drv->driver); | 1137 | driver_unregister(&drv->driver); |
1155 | goto out; | 1138 | goto out; |
@@ -1168,8 +1151,7 @@ out_newid: | |||
1168 | void | 1151 | void |
1169 | pci_unregister_driver(struct pci_driver *drv) | 1152 | pci_unregister_driver(struct pci_driver *drv) |
1170 | { | 1153 | { |
1171 | pci_remove_removeid_file(drv); | 1154 | pci_remove_newid_files(drv); |
1172 | pci_remove_newid_file(drv); | ||
1173 | driver_unregister(&drv->driver); | 1155 | driver_unregister(&drv->driver); |
1174 | pci_free_dynids(drv); | 1156 | pci_free_dynids(drv); |
1175 | } | 1157 | } |