- 30 Sep, 2020 12 commits
-
-
Markus Moll authored
Each led setting occupies two bits in a corresponding led register. Accessing these bits requires shifting and masking, which was implemented incorrectly in pca9532_getled. Two new helper macros concentrate the computation of those masks in one place. Signed-off-by: Markus Moll <mmoll@de.pepperl-fuchs.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Dan Murphy authored
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>
-
Dan Murphy authored
Fix warnings for undefined parameters when W=1 is used. Signed-off-by: Dan Murphy <dmurphy@ti.com> Reviewed-by: Marek Behún <kabel@kernel.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Instead of doing two allocations, allocate only once, by utilizing flexible array members. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Peter Meerwald <p.meerwald@bct-electronic.com> Cc: Ricardo Ribalda <ribalda@kernel.org> Cc: Zahari Petkov <zahari@balena.io> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Rename variable of type struct pca963x_led from pca963x to simple led. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Peter Meerwald <p.meerwald@bct-electronic.com> Cc: Ricardo Ribalda <ribalda@kernel.org> Cc: Zahari Petkov <zahari@balena.io> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Rename variables chip and pca963x_chip to chipdef and chip, respectively, so that their names correspond to the names of their types. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Peter Meerwald <p.meerwald@bct-electronic.com> Cc: Ricardo Ribalda <ribalda@kernel.org> Cc: Zahari Petkov <zahari@balena.io> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
By using devres version of LED registering function we can remove the .remove method from this driver. The probe method also gets simpler. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Peter Meerwald <p.meerwald@bct-electronic.com> Cc: Ricardo Ribalda <ribalda@kernel.org> Cc: Zahari Petkov <zahari@balena.io> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Use helper variables: instead of writing &client->dev at many places, write only dev. The same with pca963x->chip->chipdef, pca963x->chip->client). Use helper variable u8 val for i2c_smbus_write_byte_data, for better indentation. Indent better on various places. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Peter Meerwald <p.meerwald@bct-electronic.com> Cc: Ricardo Ribalda <ribalda@kernel.org> Cc: Zahari Petkov <zahari@balena.io> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Fix potential ERR_PTR(0). Signed-off-by: Marek Behún <kabel@kernel.org> Fixes: d78b10f5713d9 ("leds: tca6507: use fwnode API instead of OF") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Pavel Machek authored
Robot complains about: All warnings (new ones prefixed by >>): >> drivers/leds/leds-tca6507.c:750:34: warning: unused variable 'of_tca6507_leds_match' [-Wunused-const-variable] static const struct of_device_id of_tca6507_leds_match[] = { Fix it. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Convert to use fwnode API instead of OF. It is more generic and if someone wants to use this driver without device-tree yet still, they will be able to via swnode fwnodes. Remove the gpio setup function from platdata. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: NeilBrown <neilb@suse.de> Cc: Linus Walleij <linus.walleij@linaro.org> Tested-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
The only in-tree usage of this driver is via device-tree. No on else includes linux/leds-tca6507.h, so absorb the definition of platdata structure. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: NeilBrown <neilb@suse.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
- 26 Sep, 2020 28 commits
-
-
Marek Behún authored
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>
-
Marek Behún authored
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. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
This driver uses extended LED registration, so we do not need to parse the `label` DT property on our own. Signed-off-by: Marek Behún <marek.behun@nic.cz> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
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>
-
Marek Behún authored
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 a0972fff ("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>
-
Marek Behún authored
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>
-
Marek Behún authored
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>
-
Marek Behún authored
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>
-
Marek Behún authored
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>
-
Dmitry Osipenko authored
Acer Iconia Tab A500 is an Android tablet device which has two LEDs embedded into the Power Button. Orange LED indicates "battery charging" status and white LED indicates "wake-up/charge-done" status. The new LED driver provides control over both LEDs to userspace. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Liu Shixin authored
Simplify the return expression. Signed-off-by: Liu Shixin <liushixin2@huawei.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
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. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
No need to use variable found, we can determine whether the mode was found by comparing iterator variable to its limit. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Register each LED immediately after parsing OF properties. This simplifies the driver. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Use helper variable dev instead of always writing &pdev->dev. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Return directly instead of setting result and breaking. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Rename variable led_dat to led in various functions. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Rename structures: ns2_led -> ns2_led_of_one ns2_led_data -> ns2_led. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
This drivers leaks GPIO descriptors on driver removal. Use devres API function devm_gpiod_get_from_of_node instead of gpiod_get_from_of_node to avoid this. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Not-for-stable Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Move parsing of DT properties of one LED into separate function. This saves indentation level and is nicer to read. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Move forward from platform data to device tree only. Since commit c7896490 ("leds: ns2: Absorb platform data") the platform data structure is absorbed into the driver, because nothing else in the source tree uses it. Since nobody complained and all usage of this driver is via device tree, change the code to work with device tree only. As Linus Walleij wrote, the device tree should be the preferred way forward anyway. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Since .remove method is not needed now that we use devres, there is no need to remember the number of LEDs in struct ns2_led_priv. Alloc simple array of ns2_led_data structs. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
By using devres version of LED registering function we can remove the .remove method from this driver. The probe method also gets simpler. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
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. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: David Rivshin <drivshin@allworx.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
We can return the last ret value. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Use helper variable dev instead of always writing &pdev->dev. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
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. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-
Marek Behún authored
Use helper variable dev instead of always writing &pdev->dev. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Sean Wang <sean.wang@mediatek.com> Cc: John Crispin <john@phrozen.org> Cc: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-