aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lm36274.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-05-30leds: lm36274: Add missed property.hAndy Shevchenko1-0/+1
It appears that property.h has been included in some configurations implicitly, but in some it's not and hence build may fail. Add missed property.h explicitly. Fixes: e2e8e4e81875 ("leds: lm36274: Correct headers (of*.h -> mod_devicetable.h)") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2021-05-28leds: lm36274: Correct headers (of*.h -> mod_devicetable.h)Andy Shevchenko1-1/+1
There is no user of of*.h headers, but mod_devicetable.h. Update header block accordingly. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2021-05-28leds: lm36274: Put fwnode in error case during ->probe()Andy Shevchenko1-0/+1
device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. In the older code the same is implied with device_for_each_child_node(). Fixes: 11e1bbc116a7 ("leds: lm36274: Introduce the TI LM36274 LED driver") Fixes: a448fcf19c9c ("leds: lm36274: don't iterate through children since there is only one") Cc: Dan Murphy <dmurphy@ti.com> Cc: Marek Behún <marek.behun@nic.cz> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-30leds: lm36274: Fix warning for undefined parametersDan Murphy1-2/+3
Fix warnings for undefined parameters when building with W=1. Signed-off-by: Dan Murphy <dmurphy@ti.com> Reviewed-by: Marek Behún <kabel@kernel.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: parse linux,default-trigger DT property in LED coreMarek Behún1-3/+0
Do the parsing of `linux,default-trigger` DT property to LED core. Currently it is done in many different drivers and the code is repeated. This patch removes the parsing from 23 drivers: an30259a, aw2013, bcm6328, bcm6358, cr0014114, el15203000, gpio, is31fl32xx, lm3532, lm36274, lm3692x, lm3697, lp50xx, lp8860, lt3593, max77650, mt6323, ns2, pm8058, pwm, syscon, tlc591xx and turris-omnia. There is one driver in drivers/input which parses this property on it's own. I shall send a separate patch there after this is applied. There are still 8 drivers that parse this property on their own because they do not pass the led_init_data structure to the registering function. I will try to refactor those in the future. Signed-off-by: Marek Behún <marek.behun@nic.cz> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: lm36274: use devres LED registering functionMarek Behún1-11/+2
Now that the potential use-after-free issue is resolved we can use devres for LED registration in this driver. By using devres version of LED registering function we can remove the .remove method from this driver. Signed-off-by: Marek Behún <marek.behun@nic.cz> Tested-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: lm36274: use platform device as parent of LEDMarek Behún1-2/+2
Instead of registering LED under the MFD device, this driver sets the parent of the LED it is registering to the parent of the MFD device (the I2C client device). Because of this we cannot use devres for LED registration, since it can result in use-after-free, see commit a0972fff0947 ("leds: lm36274: fix use-after-free on unbind"). The only other in-tree driver that also registers under the MFD device (drivers/regulator/lm363x-regulator.c) sets the parent to the MFD device. Set the parent of this LED to the MFD device, instead of the I2C client device. Signed-off-by: Marek Behún <marek.behun@nic.cz> Tested-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: lm36274: do not set chip settings in DT parsing functionMarek Behún1-8/+8
These settings are not parsed from DT and therefore semantically should not be set in function with a name lm36274_parse_dt. Signed-off-by: Marek Behún <marek.behun@nic.cz> Tested-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: lm36274: use struct led_init_data when registeringMarek Behún1-17/+25
By using struct led_init_data when registering we do not need to parse `label` DT property. Moreover `label` is deprecated and if it is not present but `color` and `function` are, LED core will compose a name from these properties instead. Previously if the `label` DT property was not present, the code composed name for the LED in the form "parent_name::" For backwards compatibility we therefore set init_data->default_label = ":"; so that the LED will not get a different name if `label` property is not present, nor are `color` and `function`. Signed-off-by: Marek Behún <marek.behun@nic.cz> Tested-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: lm36274: don't iterate through children since there is only oneMarek Behún1-27/+23
Do not use device_for_each_child_node. Since this driver works only with once child node present, use device_get_next_child_node instead. This also saves one level of indentation. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Dan Murphy <dmurphy@ti.com> Tested-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: lm36274: cosmetic: rename lm36274_data to chipMarek Behún1-42/+40
Rename this variable so that it is easier to read and easier to write in 80 columns. Also rename variable of this type in lm36274_brightness_set from led to chip, to be consistent. Signed-off-by: Marek Behún <marek.behun@nic.cz> Tested-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-22leds: Replace HTTP links with HTTPS onesAlexander A. Klimov1-1/+1
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22leds: lm36274: fix use-after-free on unbindJohan Hovold1-3/+12
Several MFD child drivers register their class devices directly under the parent device. This means you cannot use devres so that deregistration ends up being tied to the parent device, something which leads to use-after-free on driver unbind when the class device is released while still being registered. Fixes: 11e1bbc116a7 ("leds: lm36274: Introduce the TI LM36274 LED driver") Cc: stable <stable@vger.kernel.org> # 5.3 Cc: Dan Murphy <dmurphy@ti.com> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
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-06-07leds: lm36274: Introduce the TI LM36274 LED driverDan Murphy1-0/+172
Introduce the LM36274 LED driver. This driver uses the ti-lmu MFD driver to probe this LED driver. The driver configures only the LED registers and enables the outputs according to the config file. The driver utilizes the TI LMU (Lighting Management Unit) LED common framework to set the brightness bits. Signed-off-by: Dan Murphy <dmurphy@ti.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>