aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/driver.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2006-03-27 04:17:08 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:53 -0500
commit982c609448b9d724e1c3a0d5aeee388c064479f0 (patch)
tree8e402d45943ec27c0b93d2f5aeb376f6aa512215 /drivers/pnp/driver.c
parent070c6999831dc4cfd9b07c74c2fea1964d7adfec (diff)
[PATCH] pnp: PNP: adjust pnp_register_driver signature
Remove the assumption that pnp_register_driver() returns the number of devices claimed. Returning the count is unreliable because devices may be hot-plugged in the future. This changes the convention to "zero for success, or a negative error value," which matches pci_register_driver(), acpi_bus_register_driver(), and platform_driver_register(). Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Adam Belay <ambx1@neo.rr.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pnp/driver.c')
-rw-r--r--drivers/pnp/driver.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 7cafacdd12b0..e54c15383193 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -201,31 +201,14 @@ struct bus_type pnp_bus_type = {
201 .resume = pnp_bus_resume, 201 .resume = pnp_bus_resume,
202}; 202};
203 203
204
205static int count_devices(struct device * dev, void * c)
206{
207 int * count = c;
208 (*count)++;
209 return 0;
210}
211
212int pnp_register_driver(struct pnp_driver *drv) 204int pnp_register_driver(struct pnp_driver *drv)
213{ 205{
214 int count;
215
216 pnp_dbg("the driver '%s' has been registered", drv->name); 206 pnp_dbg("the driver '%s' has been registered", drv->name);
217 207
218 drv->driver.name = drv->name; 208 drv->driver.name = drv->name;
219 drv->driver.bus = &pnp_bus_type; 209 drv->driver.bus = &pnp_bus_type;
220 210
221 count = driver_register(&drv->driver); 211 return driver_register(&drv->driver);
222
223 /* get the number of initial matches */
224 if (count >= 0){
225 count = 0;
226 driver_for_each_device(&drv->driver, NULL, &count, count_devices);
227 }
228 return count;
229} 212}
230 213
231void pnp_unregister_driver(struct pnp_driver *drv) 214void pnp_unregister_driver(struct pnp_driver *drv)