diff options
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-lp55xx-common.c | 13 | ||||
-rw-r--r-- | drivers/leds/leds-lp55xx-common.h | 4 |
2 files changed, 16 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); | |||
493 | int lp55xx_register_sysfs(struct lp55xx_chip *chip) | 493 | int lp55xx_register_sysfs(struct lp55xx_chip *chip) |
494 | { | 494 | { |
495 | struct device *dev = &chip->cl->dev; | 495 | struct device *dev = &chip->cl->dev; |
496 | struct lp55xx_device_config *cfg = chip->cfg; | ||
497 | int ret; | ||
498 | |||
499 | if (!cfg->run_engine || !cfg->firmware_cb) | ||
500 | goto dev_specific_attrs; | ||
501 | |||
502 | ret = sysfs_create_group(&dev->kobj, &lp55xx_engine_attr_group); | ||
503 | if (ret) | ||
504 | return ret; | ||
496 | 505 | ||
497 | return sysfs_create_group(&dev->kobj, &lp55xx_engine_attr_group); | 506 | dev_specific_attrs: |
507 | return cfg->dev_attr_group ? | ||
508 | sysfs_create_group(&dev->kobj, cfg->dev_attr_group) : 0; | ||
498 | } | 509 | } |
499 | EXPORT_SYMBOL_GPL(lp55xx_register_sysfs); | 510 | EXPORT_SYMBOL_GPL(lp55xx_register_sysfs); |
500 | 511 | ||
diff --git a/drivers/leds/leds-lp55xx-common.h b/drivers/leds/leds-lp55xx-common.h index 8473abf9830c..64eb78da1c4b 100644 --- a/drivers/leds/leds-lp55xx-common.h +++ b/drivers/leds/leds-lp55xx-common.h | |||
@@ -45,6 +45,7 @@ struct lp55xx_reg { | |||
45 | * @set_led_current : LED current set function | 45 | * @set_led_current : LED current set function |
46 | * @firmware_cb : Call function when the firmware is loaded | 46 | * @firmware_cb : Call function when the firmware is loaded |
47 | * @run_engine : Run internal engine for pattern | 47 | * @run_engine : Run internal engine for pattern |
48 | * @dev_attr_group : Device specific attributes | ||
48 | */ | 49 | */ |
49 | struct lp55xx_device_config { | 50 | struct lp55xx_device_config { |
50 | const struct lp55xx_reg reset; | 51 | const struct lp55xx_reg reset; |
@@ -65,6 +66,9 @@ struct lp55xx_device_config { | |||
65 | 66 | ||
66 | /* used for running firmware LED patterns */ | 67 | /* used for running firmware LED patterns */ |
67 | void (*run_engine) (struct lp55xx_chip *chip, bool start); | 68 | void (*run_engine) (struct lp55xx_chip *chip, bool start); |
69 | |||
70 | /* additional device specific attributes */ | ||
71 | const struct attribute_group *dev_attr_group; | ||
68 | }; | 72 | }; |
69 | 73 | ||
70 | /* | 74 | /* |