From e73c0ce6beaa71bee39b2d11bff0253be84c71a9 Mon Sep 17 00:00:00 2001 From: "Milo(Woogyom) Kim" Date: Tue, 5 Feb 2013 19:20:45 +0900 Subject: leds-lp55xx: use common device attribute driver function lp5521/5523_register_sysfs() are replaced with lp55xx common driver function, lp55xx_register_sysfs(). Chip specific device attributes are configurable using 'dev_attr_group'. Error condition name is changed: use specific error condition, 'err_register_sysfs' rather than unclear name, 'fail2'. Signed-off-by: Milo(Woogyom) Kim Signed-off-by: Bryan Wu --- drivers/leds/leds-lp5521.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'drivers/leds/leds-lp5521.c') diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 89371e065c13..abc33139e6fa 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -506,12 +506,6 @@ static const struct attribute_group lp5521_group = { .attrs = lp5521_attributes, }; -static int lp5521_register_sysfs(struct i2c_client *client) -{ - struct device *dev = &client->dev; - return sysfs_create_group(&dev->kobj, &lp5521_group); -} - static void lp5521_unregister_sysfs(struct i2c_client *client) { struct device *dev = &client->dev; @@ -535,6 +529,7 @@ static struct lp55xx_device_config lp5521_cfg = { .set_led_current = lp5521_set_led_current, .firmware_cb = lp5521_firmware_loaded, .run_engine = lp5521_run_engine, + .dev_attr_group = &lp5521_group, }; static int lp5521_probe(struct i2c_client *client, @@ -577,13 +572,15 @@ static int lp5521_probe(struct i2c_client *client, if (ret) goto err_register_leds; - ret = lp5521_register_sysfs(client); + ret = lp55xx_register_sysfs(chip); if (ret) { dev_err(&client->dev, "registering sysfs failed\n"); - goto fail2; + goto err_register_sysfs; } - return ret; -fail2: + + return 0; + +err_register_sysfs: lp55xx_unregister_leds(led, chip); err_register_leds: lp55xx_deinit_device(chip); -- cgit v1.2.3-59-g8ed1b