aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-04 07:48:03 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-18 15:49:56 -0400
commitd9fd4d3b317a231e47f31d64d66c8cc7765d458f (patch)
treed4a80654a42707bbb541d52ca1fffc565e92e96b /drivers/base
parentf70fa6296c2ec8f541f0a9b406ccc2d9d127d639 (diff)
Driver core: bus: remove indentation level
Before potentially fixing up these functions, this cosmetic change reduces the indentation level to make the code easier to read and maintain. No functional changes at all. Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/bus.c77
1 files changed, 40 insertions, 37 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index d7c5ea246a0b..7d8a7ce73fb3 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -518,34 +518,36 @@ int bus_add_driver(struct device_driver *drv)
518 struct bus_type * bus = get_bus(drv->bus); 518 struct bus_type * bus = get_bus(drv->bus);
519 int error = 0; 519 int error = 0;
520 520
521 if (bus) { 521 if (!bus)
522 pr_debug("bus %s: add driver %s\n", bus->name, drv->name); 522 return 0;
523 error = kobject_set_name(&drv->kobj, "%s", drv->name); 523
524 if (error) 524 pr_debug("bus %s: add driver %s\n", bus->name, drv->name);
525 goto out_put_bus; 525 error = kobject_set_name(&drv->kobj, "%s", drv->name);
526 drv->kobj.kset = &bus->drivers; 526 if (error)
527 if ((error = kobject_register(&drv->kobj))) 527 goto out_put_bus;
528 goto out_put_bus; 528 drv->kobj.kset = &bus->drivers;
529 529 if ((error = kobject_register(&drv->kobj)))
530 error = driver_attach(drv); 530 goto out_put_bus;
531 if (error) 531
532 goto out_unregister; 532 error = driver_attach(drv);
533 klist_add_tail(&drv->knode_bus, &bus->klist_drivers); 533 if (error)
534 module_add_driver(drv->owner, drv); 534 goto out_unregister;
535 535 klist_add_tail(&drv->knode_bus, &bus->klist_drivers);
536 error = driver_add_attrs(bus, drv); 536 module_add_driver(drv->owner, drv);
537 if (error) { 537
538 /* How the hell do we get out of this pickle? Give up */ 538 error = driver_add_attrs(bus, drv);
539 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", 539 if (error) {
540 __FUNCTION__, drv->name); 540 /* How the hell do we get out of this pickle? Give up */
541 } 541 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
542 error = add_bind_files(drv); 542 __FUNCTION__, drv->name);
543 if (error) { 543 }
544 /* Ditto */ 544 error = add_bind_files(drv);
545 printk(KERN_ERR "%s: add_bind_files(%s) failed\n", 545 if (error) {
546 __FUNCTION__, drv->name); 546 /* Ditto */
547 } 547 printk(KERN_ERR "%s: add_bind_files(%s) failed\n",
548 __FUNCTION__, drv->name);
548 } 549 }
550
549 return error; 551 return error;
550out_unregister: 552out_unregister:
551 kobject_unregister(&drv->kobj); 553 kobject_unregister(&drv->kobj);
@@ -565,16 +567,17 @@ out_put_bus:
565 567
566void bus_remove_driver(struct device_driver * drv) 568void bus_remove_driver(struct device_driver * drv)
567{ 569{
568 if (drv->bus) { 570 if (!drv->bus)
569 remove_bind_files(drv); 571 return;
570 driver_remove_attrs(drv->bus, drv); 572
571 klist_remove(&drv->knode_bus); 573 remove_bind_files(drv);
572 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); 574 driver_remove_attrs(drv->bus, drv);
573 driver_detach(drv); 575 klist_remove(&drv->knode_bus);
574 module_remove_driver(drv); 576 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
575 kobject_unregister(&drv->kobj); 577 driver_detach(drv);
576 put_bus(drv->bus); 578 module_remove_driver(drv);
577 } 579 kobject_unregister(&drv->kobj);
580 put_bus(drv->bus);
578} 581}
579 582
580 583