mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
[PATCH] hp300: fix driver_register() return handling, remove dio_module_init()
Remove the assumption that driver_register() returns the number of devices bound to the driver. In fact, it returns zero for success or a negative error value. dio_module_init() used the device count to automatically unregister and unload drivers that found no devices. That might have worked at one time, but has been broken for some time because dio_register_driver() returned either a negative error or a positive count (never zero). So it could only unregister on failure, when it's not needed anyway. This functionality could be resurrected in individual drivers by counting devices in their .probe() methods. Signed-off-by: Bjorn Helgaas <[email protected]> Cc: Philip Blundell <[email protected]> Cc: Jochen Friedrich <[email protected]> Cc: "Antonino A. Daplas" <[email protected]> Cc: Jeff Garzik <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5930860296
commit
e51c01b084
5 changed files with 11 additions and 46 deletions
|
|
@ -71,22 +71,17 @@ static int dio_device_probe(struct device *dev)
|
|||
* @drv: the driver structure to register
|
||||
*
|
||||
* Adds the driver structure to the list of registered drivers
|
||||
* Returns the number of DIO devices which were claimed by the driver
|
||||
* during registration. The driver remains registered even if the
|
||||
* return value is zero.
|
||||
* Returns zero or a negative error value.
|
||||
*/
|
||||
|
||||
int dio_register_driver(struct dio_driver *drv)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* initialize common driver fields */
|
||||
drv->driver.name = drv->name;
|
||||
drv->driver.bus = &dio_bus_type;
|
||||
|
||||
/* register with core */
|
||||
count = driver_register(&drv->driver);
|
||||
return count ? count : 1;
|
||||
return driver_register(&drv->driver);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue