diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-05 19:24:27 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-05 19:24:27 -0700 |
commit | e4a7b2dc35d9582c253cf5e6d6c3605aabc7284d (patch) | |
tree | aad09e47f8503053b94f7d330fced3d9d63a8b7a /drivers/leds/leds-gpio.c | |
parent | fffe3ae0ee84e25d2befe2ae59bc32aa2b6bc77b (diff) | |
parent | bba37471de2d7733b0deef57e03c47fa97a284a7 (diff) |
Merge tag 'leds-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds
Pull LED updates from Pavel Machek:
"Okay, so... this one is interesting. RGB LEDs are very common, and we
need to have some kind of support for them. Multicolor is for
arbitrary set of LEDs in one package, RGB is for LEDs that can produce
full range of colors. We do not have real multicolor LED that is not
RGB in the pipeline, so that one is disabled for now.
You can expect this saga to continue with next pull requests"
* tag 'leds-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: (37 commits)
MAINTAINERS: Remove myself as LED subsystem maintainer
leds: disallow /sys/class/leds/*:multi:* for now
leds: add RGB color option, as that is different from multicolor.
Make LEDS_LP55XX_COMMON depend on I2C to fix build errors:
Documentation: ABI: leds-turris-omnia: document sysfs attribute
leds: initial support for Turris Omnia LEDs
dt-bindings: leds: add cznic,turris-omnia-leds binding
leds: pattern trigger -- check pattern for validity
leds: Replace HTTP links with HTTPS ones
leds: trigger: add support for LED-private device triggers
leds: lp5521: Add multicolor framework multicolor brightness support
leds: lp5523: Update the lp5523 code to add multicolor brightness function
leds: lp55xx: Add multicolor framework support to lp55xx
leds: lp55xx: Convert LED class registration to devm_*
dt-bindings: leds: Convert leds-lp55xx to yaml
leds: multicolor: Introduce a multicolor class definition
leds: Add multicolor ID to the color ID list
dt: bindings: Add multicolor class dt bindings documention
leds: lp5523: Fix various formatting issues in the code
leds: lp55xx: Fix file permissions to use DEVICE_ATTR macros
...
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r-- | drivers/leds/leds-gpio.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 2bf74595610f..cf84096d88ce 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -125,12 +125,6 @@ struct gpio_leds_priv { struct gpio_led_data leds[]; }; -static inline int sizeof_gpio_leds_priv(int num_leds) -{ - return sizeof(struct gpio_leds_priv) + - (sizeof(struct gpio_led_data) * num_leds); -} - static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -142,7 +136,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) if (!count) return ERR_PTR(-ENODEV); - priv = devm_kzalloc(dev, sizeof_gpio_leds_priv(count), GFP_KERNEL); + priv = devm_kzalloc(dev, struct_size(priv, leds, count), GFP_KERNEL); if (!priv) return ERR_PTR(-ENOMEM); @@ -220,7 +214,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx, * device, this will hit the board file, if any and get * the GPIO from there. */ - gpiod = devm_gpiod_get_index(dev, NULL, idx, flags); + gpiod = devm_gpiod_get_index(dev, NULL, idx, GPIOD_OUT_LOW); if (!IS_ERR(gpiod)) { gpiod_set_consumer_name(gpiod, template->name); return gpiod; @@ -260,9 +254,8 @@ static int gpio_led_probe(struct platform_device *pdev) int i, ret = 0; if (pdata && pdata->num_leds) { - priv = devm_kzalloc(&pdev->dev, - sizeof_gpio_leds_priv(pdata->num_leds), - GFP_KERNEL); + priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, pdata->num_leds), + GFP_KERNEL); if (!priv) return -ENOMEM; |