summaryrefslogtreecommitdiff
path: root/drivers/leds
AgeCommit message (Collapse)AuthorFilesLines
2019-09-12leds: lm3532: Fix optional led-max-microamp prop error handlingDan Murphy1-5/+8
Fix the error handling for the led-max-microamp property. Need to check if the property is present and then if it is retrieve the setting and its max boundary Reported-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-05led: triggers: Fix dereferencing of null pointerOleh Kravchenko1-2/+2
Error was detected by PVS-Studio: V522 Dereferencing of the null pointer 'led_cdev->trigger' might take place. Fixes: 2282e125a406 ("leds: triggers: let struct led_trigger::activate() return an error code") Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-03leds: ti-lmu-common: Move static keyword to the front of declarationKrzysztof Wilczynski1-1/+1
Move the static keyword to the front of declaration of ramp_table, and resolve the following compiler warning that can be seen when building with warnings enabled (W=1): drivers/leds/leds-ti-lmu-common.c:14:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] Signed-off-by: Krzysztof Wilczynski <kw@linux.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-03leds: lm3532: Move static keyword to the front of declarationsKrzysztof Wilczynski1-3/+3
Move the static keyword to the front of declarations ramp_table, als_avrg_table and als_imp_table, and resolve the following compiler warnings that can be seen when building with warnings enabled (W=1): drivers/leds/leds-lm3532.c:209:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] drivers/leds/leds-lm3532.c:266:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] drivers/leds/leds-lm3532.c:281:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] Signed-off-by: Krzysztof Wilczynski <kw@linux.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-01leds: trigger: gpio: GPIO 0 is validAndy Shevchenko1-5/+7
Allow all valid GPIOs to be used in the driver. Fixes: 17354bfe8527 ("leds: Add gpio-led trigger") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-01leds: pwm: Use struct_size() helperGustavo A. R. Silva1-7/+1
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct led_pwm_priv { ... struct led_pwm_data leds[0]; }; Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. So, replace the following function: static inline size_t sizeof_pwm_leds_priv(int num_leds) { return sizeof(struct led_pwm_priv) + (sizeof(struct led_pwm_data) * num_leds); } with: struct_size(priv, leds, count) This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-01leds: is31fl32xx: Use struct_size() helperGustavo A. R. Silva1-7/+1
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct is31fl32xx_priv { ... struct is31fl32xx_led_data leds[0]; }; Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. So, replace the following function: static inline size_t sizeof_is31fl32xx_priv(int num_leds) { return sizeof(struct is31fl32xx_priv) + (sizeof(struct is31fl32xx_led_data) * num_leds); } with: struct_size(priv, leds, count) This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-01leds: ti-lmu-common: Fix coccinelle issue in TI LMUDan Murphy1-9/+6
Fix the coccinelle issues found in the TI LMU common code drivers/leds/leds-ti-lmu-common.c:97:20-29: WARNING: Unsigned expression compared with zero: ramp_down < 0 drivers/leds/leds-ti-lmu-common.c:97:5-12: WARNING: Unsigned expression compared with zero: ramp_up < 0 Fixes: 3fce8e1eb994 ("leds: TI LMU: Add common code for TI LMU devices") Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-01leds: lm3532: Avoid potentially unpaired regulator callsTony Lindgren1-2/+24
We may currently get unpaired regulator calls when configuring the LED brightness via sysfs in case of regulator calls producing errors. Let's fix this by maintaining local state for enabled. Signed-off-by: Tony Lindgren <tony@atomide.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-01leds: syscon: Use resource managed variant of device registerAlexander Dahl1-1/+1
We have a MFD driver compiled as module instantiating this driver. When unloading that module, those LED devices are not removed, which produces conflicts, when that module is inserted again. Signed-off-by: Alexander Dahl <ada@thorsis.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26leds: Allow to call led_classdev_unregister() unconditionallyAndy Shevchenko1-0/+4
If in the certain driver the LED is optional, and it's a majority of them, the call of led_classdev_unregister() still requires some additional checks. The usual pattern on unregistering is to check for NULL, but we also check for IS_ERR() in case device_create_with_groups() fails. The change will reduce a burden in a lot of drivers to repeatedly check for above conditions. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26leds: lm3532: Add full scale current configurationDan Murphy1-0/+25
Allow the full scale current to be configured at init. Valid rangles are 5mA->29.8mA. Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26leds: lm3532: Fixes for the driver for stabilityDan Murphy1-4/+13
Fixed misspelled words, added error check during probe on the init of the registers, and fixed ALS/I2C control mode. Fixes: bc1b8492c764 ("leds: lm3532: Introduce the lm3532 LED driver") Reported-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Dan Murphy <dmurphy@ti.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26leds: lm3532: Change the define for the fs current registerDan Murphy1-6/+6
Change the define name of the full scale current registers. Signed-off-by: Dan Murphy <dmurphy@ti.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26leds: lm3532: Fix brightness control for i2c modeDan Murphy1-14/+30
Fix the brightness control for I2C mode. Instead of changing the full scale current register update the ALS target register for the appropriate banks. In addition clean up some code errors and random misspellings found during coding. Tested on Droid4 as well as LM3532 EVM connected to a BeagleBoneBlack Fixes: bc1b8492c764 ("leds: lm3532: Introduce the lm3532 LED driver") Reported-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Dan Murphy <dmurphy@ti.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-24leds: Switch to use fwnode instead of be stuck with OF oneAndy Shevchenko2-8/+5
There is no need to be stuck with OF node when we may use agnostic firmware node instead. It allows users to get property if needed independently of provider. Note, some OF parts are left because %pfw [1] is in progress. [1]: https://lore.kernel.org/patchwork/cover/1054863/ Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-24leds: max77650: Switch to fwnode property APIAndy Shevchenko1-13/+9
Switch the max77650 from OF to the fwnode property API. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-20led: triggers: Fix a memory leak bugWenwen Wang1-0/+1
In led_trigger_set(), 'event' is allocated in kasprintf(). However, it is not deallocated in the following execution if the label 'err_activate' or 'err_add_groups' is entered, leading to memory leaks. To fix this issue, free 'event' before returning the error. Fixes: 52c47742f79d ("leds: triggers: send uevent when changing triggers") Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-08leds: pca953x: Include the right headerLinus Walleij1-1/+1
This LED chip provides a GPIO driver, so include <linux/gpio/driver.h> rather than the legacy header <linux/gpio.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-30Merge tag 'generic_lookup_helpers' into for-nextJacek Anaszewski1-8/+1
Generic Device Lookup Helpers Persistent tag for others to pull this branch from Based on patch series from Suzuki K Poulose <suzuki.poulose@arm.com> with Subject: [PATCH v3 0/7] drivers: Add generic device lookup helpers Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> * tag 'generic_lookup_helpers': platform: Add platform_find_device_by_driver() helper drivers: Add generic helper to match any device drivers: Introduce device lookup variants by ACPI_COMPANION device drivers: Introduce device lookup variants by device type drivers: Introduce device lookup variants by fwnode drivers: Introduce device lookup variants by of_node drivers: Introduce device lookup variants by name
2019-07-30drivers: Introduce device lookup variants by nameSuzuki K Poulose1-8/+1
Add a helper to match the device name for device lookup. Also reuse this generic exported helper for the existing bus_find_device_by_name(). and add similar variants for driver/class. Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexander Aring <alex.aring@gmail.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Dan Murphy <dmurphy@ti.com> Cc: Harald Freudenberger <freude@linux.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Lee Jones <lee.jones@linaro.org> Cc: linux-leds@vger.kernel.org Cc: linux-rtc@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: linux-wpan@vger.kernel.org Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Peter Oberparleiter <oberpar@linux.ibm.com> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Stefan Schmidt <stefan@datenfreihafen.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190723221838.12024-2-suzuki.poulose@arm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-29leds: netxbig: Add of_node_put() in netxbig_leds_get_of_pdata()Nishka Dasgupta1-2/+4
The variable gpio_ext_np in the function netxbig_leds_get_of_pdata takes the value returned by of_parse_phandle; hence, it must be put in order to prevent a memory leak. Add an of_node_put for gpio_ext_np before a return statement, and move a pre-existing of_node_put statement to right after the last usage of this variable. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-29leds: netxbig: remove legacy board-file supportMasahiro Yamada2-20/+51
Since commit ebc278f15759 ("ARM: mvebu: remove static LED setup for netxbig boards"), no one in upstream passes in the platform data to this driver. Squash leds-kirkwood-netxbig.h into the driver, and remove the legacy board-file support. Link: https://lkml.org/lkml/2019/7/20/83 Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-25leds: lm3697: Switch to use fwnode_property_count_uXX()Andy Shevchenko1-4/+1
Use fwnode_property_count_uXX() directly, that makes code neater. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-25leds: lm36274: Switch to use fwnode_property_count_uXX()Andy Shevchenko1-3/+1
Use fwnode_property_count_uXX() directly, that makes code neater. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-25leds: lm3532: Switch to use fwnode_property_count_uXX()Andy Shevchenko1-4/+1
Use fwnode_property_count_uXX() directly, that makes code neater. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-25leds: an30259a: Use generic support for composing LED namesJacek Anaszewski1-12/+13
Switch to using generic LED support for composing LED class device name. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Simon Shields <simon@lineageos.org> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: gpio: Use generic support for composing LED namesJacek Anaszewski1-13/+13
Switch to using generic LED support for composing LED class device name. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Linus Walleij <linus.walleij@linaro.org> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: as3645a: Use generic support for composing LED namesJacek Anaszewski1-46/+28
Switch to using generic LED support for composing LED class device name. After switching to new led_classdev_register_ext() the validity of struct led_classdev's name property is no longer guaranteed, and therefore rely on struct device's kobj.name instead. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: aat1290: Use generic support for composing LED namesJacek Anaszewski1-7/+9
Switch to using generic LED support for composing LED class device name. After switching to new led_classdev_register_ext() the validity of struct led_classdev's name property is no longer guaranteed, and therefore rely on struct device's kobj.name instead. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: cr0014114: Use generic support for composing LED namesJacek Anaszewski1-21/+11
Switch to using generic LED support for composing LED class device name. At this occassion remove initialization of struct led_classdev's dev->of_node property in the driver, since now it will be taken from fwnode assigned to struct led_init_data and passed to the new devm_led_classdev_register_ext() API. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Oleh Kravchenko <oleg@kaa.org.ua> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: lm3601x: Use generic support for composing LED namesJacek Anaszewski1-21/+17
Switch to using generic LED support for composing LED class device name. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Tested-by: Dan Murphy <dmurphy@ti.com> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: lm3692x: Use generic support for composing LED namesJacek Anaszewski1-16/+6
Switch to using generic LED support for composing LED class device name. At this occassion remove initialization of struct led_classdev's dev->of_node property in the driver, since now it will be taken from fwnode assigned to struct led_init_data and passed to the new devm_led_classdev_register_ext() API. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Tested-by: Dan Murphy <dmurphy@ti.com> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: lp8860: Use generic support for composing LED namesJacek Anaszewski1-19/+16
Switch to using generic LED support for composing LED class device name. While at it, avoid iterating through available child of nodes in favor of obtaining single expected child node using single call to of_get_next_available_child(). Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Tested-by: Dan Murphy <dmurphy@ti.com>
2019-07-25leds: lt3593: Use generic support for composing LED namesJacek Anaszewski1-12/+8
Switch to using generic LED support for composing LED class device name. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Daniel Mack <daniel@zonque.org> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: sc27xx-blt: Use generic support for composing LED namesJacek Anaszewski1-13/+9
Switch to using generic LED support for composing LED class device name. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Reviewed-by: Baolin Wang <baolin.wang@linaro.org> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: core: Add support for composing LED class device namesJacek Anaszewski3-3/+145
Add generic support for composing LED class device name. The newly introduced led_compose_name() function composes device name according to either <color:function> or <devicename:color:function> pattern, depending on the configuration of initialization data. Backward compatibility with in-driver hard-coded LED class device names is assured thanks to the default_label and devicename properties of newly introduced struct led_init_data. In case none of the aforementioned properties was found, then, for OF nodes, the node name is adopted for LED class device name. At the occassion of amending the Documentation/leds/leds-class.txt unify spelling: colour -> color. Alongside these changes added is a new tool - tools/leds/get_led_device_info.sh. The tool allows retrieving details of a LED class device's parent device, which proves that using vendor or product name for devicename part of LED name doesn't convey any added value since that information had been already available in sysfs. The script performs also basic validation of a LED class device name. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Baolin Wang <baolin.wang@linaro.org> Cc: Dan Murphy <dmurphy@ti.com> Cc: Daniel Mack <daniel@zonque.org> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Oleh Kravchenko <oleg@kaa.org.ua> Cc: Sakari Ailus <sakari.ailus@linux.intel.com> Cc: Simon Shields <simon@lineageos.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-25leds: class: Improve LED and LED flash class registration APIJacek Anaszewski6-22/+26
Replace of_led_classdev_register() with led_classdev_register_ext(), which accepts easily extendable struct led_init_data, instead of the fixed struct device_node argument. The latter can be now passed in an fwnode property of the struct led_init_data. The modification is driven by the need for passing additional arguments required for the forthcoming generic mechanism for composing LED names. Currently the LED name is conveyed in the "name" char pointer property of the struct led_classdev. This is redundant since LED class device name is accessible throughout the whole LED class device life time via associated struct device's kobj->name property. The change will not break any existing clients since the patch alters also existing led_classdev{_flash}_register() macro wrappers, that pass NULL in place of init_data, which leads to using legacy name initialization path basing on the struct led_classdev's "name" property. Three existing users of devm_of_led_classdev_registers() are modified to use devm_led_classdev_register(), which will not impact their operation since they in fact didn't need to pass struct device_node on registration from the beginning. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Baolin Wang <baolin.wang@linaro.org> Cc: Dan Murphy <dmurphy@ti.com> Cc: Daniel Mack <daniel@zonque.org> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Oleh Kravchenko <oleg@kaa.org.ua> Cc: Sakari Ailus <sakari.ailus@linux.intel.com> Cc: Simon Shields <simon@lineageos.org> Acked-by: Pavel Machek <pavel@ucw.cz>
2019-07-23leds: is31fl319x: simplify getting the adapter of a clientWolfram Sang1-2/+1
We have a dedicated pointer for that, so use it. Much easier to read and less computation involved. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: apu: add pr_fmt prefix for better log outputEnrico Weigelt1-0/+2
Define pr_fmt() macro for prefixing the module name to all pr_*() outputs, in order to increase log message clarity. Signed-off-by: Enrico Weigelt <info@metux.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: apu: fix error message on probing failureEnrico Weigelt1-7/+3
The current error message on failed probing tends to be a bit misleading. Fix it to tell exactly that an APU v1 was not found. Signed-off-by: Enrico Weigelt <info@metux.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: apu: drop profile field from priv dataEnrico Weigelt1-12/+7
As this driver now only supports the APU1 boards, we don't need to handle profiles anymore and just can use the only one global array directly. Signed-off-by: Enrico Weigelt <info@metux.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: apu: drop iosize field from priv dataEnrico Weigelt1-3/+1
As this driver now only supports the APU1 boards, we don't need to handle different io sizes anymore. Signed-off-by: Enrico Weigelt <info@metux.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: apu: drop enum_apu_led_platform_typesEnrico Weigelt1-10/+2
As this driver now only supports the APU1 boards, we don't need to differenciate between board types anymore. Therefore optimize away the now obsolete code. Signed-off-by: Enrico Weigelt <info@metux.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: apu: drop superseeded apu2/3 led supportEnrico Weigelt2-119/+10
This driver only supports gpio-attached LEDs on apu1/2/3 boards, but neither gpio's themselves, nor other gpio-attached devices (eg. front button). For apu2+ a newer, more complete driver exists, based on a generic driver for the AMD SOCs gpio-controller, supporting LEDs as well other devices. Therefore these boards don't need legacy support from this driver anymore. Both drivers claim the same device, so only one driver may exist in a system, putting distros in the position to decide between either apu2+ keys or apu1 led support. Therefore drop the apu2+ led support from the old driver, solve the conflict and reduce unnecessary code. Signed-off-by: Enrico Weigelt <info@metux.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: ktd2692: Fix a typo in the name of a constantChristophe JAILLET1-2/+2
There is a typo in KTD2962_MM_MIN_CURR_THRESHOLD_SCALE. 6 and 9 are switched in 2962. Define and use KTD2692_MM_MIN_CURR_THRESHOLD_SCALE instead. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Enrico Weigelt <info@metux.net> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: an30259a: Fix typoChristophe JAILLET1-2/+2
All this file is about an30259a, including the reference to the datasheet at the top of the file. So change the 2 places where an32059a is used instead. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: leds-lp5562 allow firmware files up to the maximum lengthNick Stoughton1-1/+5
Firmware files are in ASCII, using 2 hex characters per byte. The maximum length of a firmware string is therefore 16 (commands) * 2 (bytes per command) * 2 (characters per byte) = 64 Fixes: ff45262a85db ("leds: add new LP5562 LED driver") Signed-off-by: Nick Stoughton <nstoughton@logitech.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: ns2: Add of_node_put() before returnNishka Dasgupta1-7/+14
Each iteration of for_each_child_of_node puts the previous node, but in the case of a return from the middle of the loop, there is no put, thus causing a memory leak. Hence create a new label, err_node_put, that puts the previous node before returning the required value. Edit the mid-loop return sites to instead go to this new label. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-22leds: max77650: Add of_node_put() before returnNishka Dasgupta1-7/+14
Each iteration of for_each_child_of_node puts the previous node, but in the case of a return from the middle of the loop, there is no put, thus causing a memory leak. Hence create a new label, err_node_put, which puts the previous node and returns variable rv. Modify the mid-loop return statements to instead store the return value in rv and jump to err_node_put. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Reviewed-by: Dan Murphy <dmurphy@ti.com> Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>