summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-sunfire.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2015-12-02 17:27:01 +0100
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-01-04 09:57:38 +0100
commit6e25e641e99beb5c3f92defae0a4288beee972f1 (patch)
tree100960015af5173c670b3201dd0328d5b2585a0a /drivers/leds/leds-sunfire.c
parent8891161567eacfcf703b683798e17b1236096b2c (diff)
downloadlinux-6e25e641e99beb5c3f92defae0a4288beee972f1.tar.bz2
leds: sunfire: Use platform_register/unregister_drivers()
These new helpers simplify implementing multi-driver modules and properly handle failure to register one driver by unregistering all previously registered drivers. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds/leds-sunfire.c')
-rw-r--r--drivers/leds/leds-sunfire.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/leds/leds-sunfire.c b/drivers/leds/leds-sunfire.c
index c2553c54f2cf..7c09db8bd4e8 100644
--- a/drivers/leds/leds-sunfire.c
+++ b/drivers/leds/leds-sunfire.c
@@ -234,28 +234,19 @@ static struct platform_driver sunfire_fhc_led_driver = {
},
};
+static struct platform_driver * const drivers[] = {
+ &sunfire_clockboard_led_driver,
+ &sunfire_fhc_led_driver,
+};
+
static int __init sunfire_leds_init(void)
{
- int err = platform_driver_register(&sunfire_clockboard_led_driver);
-
- if (err) {
- pr_err("Could not register clock board LED driver\n");
- return err;
- }
-
- err = platform_driver_register(&sunfire_fhc_led_driver);
- if (err) {
- pr_err("Could not register FHC LED driver\n");
- platform_driver_unregister(&sunfire_clockboard_led_driver);
- }
-
- return err;
+ return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
}
static void __exit sunfire_leds_exit(void)
{
- platform_driver_unregister(&sunfire_clockboard_led_driver);
- platform_driver_unregister(&sunfire_fhc_led_driver);
+ platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
}
module_init(sunfire_leds_init);