diff options
Diffstat (limited to 'drivers/base/driver.c')
-rw-r--r-- | drivers/base/driver.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 082bfded3854..eb11475293ed 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -149,10 +149,6 @@ void put_driver(struct device_driver * drv) | |||
149 | * We pass off most of the work to the bus_add_driver() call, | 149 | * We pass off most of the work to the bus_add_driver() call, |
150 | * since most of the things we have to do deal with the bus | 150 | * since most of the things we have to do deal with the bus |
151 | * structures. | 151 | * structures. |
152 | * | ||
153 | * The one interesting aspect is that we setup @drv->unloaded | ||
154 | * as a completion that gets complete when the driver reference | ||
155 | * count reaches 0. | ||
156 | */ | 152 | */ |
157 | int driver_register(struct device_driver * drv) | 153 | int driver_register(struct device_driver * drv) |
158 | { | 154 | { |
@@ -162,35 +158,19 @@ int driver_register(struct device_driver * drv) | |||
162 | printk(KERN_WARNING "Driver '%s' needs updating - please use bus_type methods\n", drv->name); | 158 | printk(KERN_WARNING "Driver '%s' needs updating - please use bus_type methods\n", drv->name); |
163 | } | 159 | } |
164 | klist_init(&drv->klist_devices, NULL, NULL); | 160 | klist_init(&drv->klist_devices, NULL, NULL); |
165 | init_completion(&drv->unloaded); | ||
166 | return bus_add_driver(drv); | 161 | return bus_add_driver(drv); |
167 | } | 162 | } |
168 | 163 | ||
169 | |||
170 | /** | 164 | /** |
171 | * driver_unregister - remove driver from system. | 165 | * driver_unregister - remove driver from system. |
172 | * @drv: driver. | 166 | * @drv: driver. |
173 | * | 167 | * |
174 | * Again, we pass off most of the work to the bus-level call. | 168 | * Again, we pass off most of the work to the bus-level call. |
175 | * | ||
176 | * Though, once that is done, we wait until @drv->unloaded is completed. | ||
177 | * This will block until the driver refcount reaches 0, and it is | ||
178 | * released. Only modular drivers will call this function, and we | ||
179 | * have to guarantee that it won't complete, letting the driver | ||
180 | * unload until all references are gone. | ||
181 | */ | 169 | */ |
182 | 170 | ||
183 | void driver_unregister(struct device_driver * drv) | 171 | void driver_unregister(struct device_driver * drv) |
184 | { | 172 | { |
185 | bus_remove_driver(drv); | 173 | bus_remove_driver(drv); |
186 | /* | ||
187 | * If the driver is a module, we are probably in | ||
188 | * the module unload path, and we want to wait | ||
189 | * for everything to unload before we can actually | ||
190 | * finish the unload. | ||
191 | */ | ||
192 | if (drv->owner) | ||
193 | wait_for_completion(&drv->unloaded); | ||
194 | } | 174 | } |
195 | 175 | ||
196 | /** | 176 | /** |