diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2002-04-09 15:14:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-27 13:57:29 -0400 |
commit | 74e9f5fa1570f956c96dd5d3f1053daedbbf01a0 (patch) | |
tree | 095bfed9efced3538507d16eb93010d91c074f5f /drivers/base/driver.c | |
parent | c6a46696f97ff260a4ecce5e287f8de4b9d7fe14 (diff) |
Driver core: remove unneeded completion from driver release path
The completion in the driver release path is due to ancient history in
the _very_ early 2.5 days when we were not tracking the module reference
count of attributes. It is not needed at all and can be removed.
Note, we now have an empty release function for the driver structure.
This is due to the fact that drivers are statically allocated in the
system at this point in time, something which I want to change in the
future. But remember, drivers are really code, which is reference
counted by the module, unlike devices, which are data and _must_ be
reference counted properly in order to work correctly.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 | /** |