Skip to content

Commit

Permalink
leds: flash: Fix the size of sysfs_groups array
Browse files Browse the repository at this point in the history
LED_FLASH_MAX_SYSFS_GROUPS macro had value that was relevant for
previous version of the patches introducing LED Flash class. Currently
it is required to reserve the room for maximum 4 sysfs groups.
Since the last element of the struct attribute_group array passed to
the function device_create_with_groups has to be NULL, the size of the
array has to be greater by one than maximum allowed number of groups.
Therefore, the name of the macro is being changed to
LED_FLASH_SYSFS_GROUPS_SIZE, to make it more accurrate.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
  • Loading branch information
Jacek Anaszewski authored and Bryan Wu committed Mar 30, 2015
1 parent f6ad395 commit 9647507
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/led-class-flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct led_classdev_flash;
#define LED_FAULT_LED_OVER_TEMPERATURE (1 << 8)
#define LED_NUM_FLASH_FAULTS 9

#define LED_FLASH_MAX_SYSFS_GROUPS 7
#define LED_FLASH_SYSFS_GROUPS_SIZE 5

struct led_flash_ops {
/* set flash brightness */
Expand Down Expand Up @@ -80,7 +80,7 @@ struct led_classdev_flash {
struct led_flash_setting timeout;

/* LED Flash class sysfs groups */
const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS];
const struct attribute_group *sysfs_groups[LED_FLASH_SYSFS_GROUPS_SIZE];
};

static inline struct led_classdev_flash *lcdev_to_flcdev(
Expand Down

0 comments on commit 9647507

Please sign in to comment.