summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-lp5523.c
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 19:20:45 +0900
committerBryan Wu <cooloney@gmail.com>2013-02-06 15:59:29 -0800
commite73c0ce6beaa71bee39b2d11bff0253be84c71a9 (patch)
treeed279d825d63da71f02770d816fe0c8b15e0a8ca /drivers/leds/leds-lp5523.c
parent240085e255cd2818aff2ccde3066b7db1f29076a (diff)
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 <milo.kim@ti.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-lp5523.c')
-rw-r--r--drivers/leds/leds-lp5523.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 4b1ad9013a51..4192a1ec6062 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -484,18 +484,6 @@ static const struct attribute_group lp5523_group = {
.attrs = lp5523_attributes,
};
-static int lp5523_register_sysfs(struct i2c_client *client)
-{
- struct device *dev = &client->dev;
- int ret;
-
- ret = sysfs_create_group(&dev->kobj, &lp5523_group);
- if (ret < 0)
- return ret;
-
- return 0;
-}
-
static void lp5523_unregister_sysfs(struct i2c_client *client)
{
struct device *dev = &client->dev;
@@ -519,6 +507,7 @@ static struct lp55xx_device_config lp5523_cfg = {
.set_led_current = lp5523_set_led_current,
.firmware_cb = lp5523_firmware_loaded,
.run_engine = lp5523_run_engine,
+ .dev_attr_group = &lp5523_group,
};
static int lp5523_probe(struct i2c_client *client,
@@ -561,13 +550,15 @@ static int lp5523_probe(struct i2c_client *client,
if (ret)
goto err_register_leds;
- ret = lp5523_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);