summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp55xx-common.c
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 19:20:01 +0900
committerBryan Wu <cooloney@gmail.com>2013-02-06 15:59:29 -0800
commit240085e255cd2818aff2ccde3066b7db1f29076a (patch)
tree1b5356694924c111c7f96d1b1bf806789a92cf42 /drivers/leds/leds-lp55xx-common.c
parentdb6eaf8388a413a5ee1b4547ce78506b9c6456b0 (diff)
downloadtalos-obmc-linux-240085e255cd2818aff2ccde3066b7db1f29076a.tar.gz
talos-obmc-linux-240085e255cd2818aff2ccde3066b7db1f29076a.zip
leds-lp55xx: support device specific attributes
To support device specific attributes, new common driver function is added. Eventually those are created on registering the sysfs with common dev attrs. Furthermore, this patch makes adding device attributes simple in each driver. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-lp55xx-common.c')
-rw-r--r--drivers/leds/leds-lp55xx-common.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index 578902ab604f..9638ad4dc635 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -493,8 +493,19 @@ EXPORT_SYMBOL_GPL(lp55xx_unregister_leds);
int lp55xx_register_sysfs(struct lp55xx_chip *chip)
{
struct device *dev = &chip->cl->dev;
+ struct lp55xx_device_config *cfg = chip->cfg;
+ int ret;
+
+ if (!cfg->run_engine || !cfg->firmware_cb)
+ goto dev_specific_attrs;
+
+ ret = sysfs_create_group(&dev->kobj, &lp55xx_engine_attr_group);
+ if (ret)
+ return ret;
- return sysfs_create_group(&dev->kobj, &lp55xx_engine_attr_group);
+dev_specific_attrs:
+ return cfg->dev_attr_group ?
+ sysfs_create_group(&dev->kobj, cfg->dev_attr_group) : 0;
}
EXPORT_SYMBOL_GPL(lp55xx_register_sysfs);
OpenPOWER on IntegriCloud