lkml.org 
[lkml]   [2020]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH leds v1 00/10] Start moving parsing of `linux,default-trigger` to LED core (a cleanup of LED drivers)
Date
Hi,

this series is also available at
https://git.kernel.org/pub/scm/linux/kernel/git/kabel/linux.git/log/?h=leds-cleanup-for-pavel

this is a cleanup of some LED subsystem drivers. The main reason behind
this is that I wanted to avoid code repetition by moving the parsing
of `linux,default-trigger` DT property from specific drivers to LED
core. Before this series 32 drivers parse this property (31 in
drivers/leds and one in drivers/input/keyboard/cap11xx.c).
After applying this series only 10 drivers are parsing this property.

The reason is that in discussion [1] Rob Herring says that
`linux,default-trigger` DT property is deprecated in favor of the
`function` DT property. This makes sense in a way since DT should not
be Linux specific.

After all drivers are converted we can maybe start work on slow
deprecation of this property. I do realize that we can't take it away,
but we can at least convert device trees in Linux repository to stop
using it in favor of `function` (and for default-on trigger in favor
of the `default-state` DT property), and print a deprecation warning
to the user when this `linux,default-trigger` property is present.

I wanted to prepare the way for slow deprecation of the DT property,
but it turns out that it is more difficult.

The first thing I wanted to do was to move the parsing of the
`linux,default-trigger` property to LED core. Currently many drivers
do this themselves. But it can't be moved that simply.

The first patch in this series adds the parsing of this DT property
into led_classdev_register_ext. If fwnode is given in init_data, the
property is read. This patch also removes the parsing of this property
from drivers where led_classdev_register_ext is already called. These
are:
an30259a, aw2013, cr0014114, el15203000, gpio, lm3532, lm3692x,
lp8860, lt3593, tlc591xx and turris-omnia.

Patches 2 to 6 do a simple conversion of some drivers to use
led_classdev_register_ext. These drivers are:
bcm6328, bcm6358, lm3697, max77650, mt6323 and pm8058.

In patches 7 to 10 I did a bigger refactor: either they first parsed
all LED nodes and only after that started registering them, or they
used too deep nesting or were weird in some other ways:
is31fl32xx, is31fl319x, lm36274 and ns2.

There is still a long way to go: some drivers still use the old
platform_data framework (which has a different structure for every
driver) instead of device properties via fwnode_* functions or OF).

Some of these can be changed to use device tree only, since they
already support it and the platform_data isn't used by anything in
the kernel (for example tca6507 can work with platform_data but
there is no board definition using it, all usage is via DT).

Some will be harder, because the platform_data code is still used
(pca9532 is used in arch/arm/mach-iop32x/n2100.c). Even this can
be done by converting the drivers to use fwnode_* API and converting
the mach code to use swnodes. I shall look into this later.

This series is compile tested on top of Pavel's tree. Since I
obviously don't have the various hardware that this code touches,
I am unable to test it. I therefore add maintainers and authors of
these drivers to Cc.

Marek

[1] https://lore.kernel.org/linux-leds/20200909235819.0b0fe7ce@nic.cz/T/#m3b6c154f49d0467a707c0f9a552ec87bcbd89df2

Cc: Álvaro Fernández Rojas <noltari@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: David Rivshin <drivshin@allworx.com>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Jaedon Shin <jaedon.shin@gmail.com>
Cc: John Crispin <john@phrozen.org>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Simon Guinot <sguinot@lacie.com>
Cc: Simon Guinot <simon.guinot@sequanux.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Vincent Donnefort <vdonnefort@gmail.com>

Marek Behún (10):
leds: parse linux,default-trigger DT property in LED core
leds: bcm6328, bcm6358: use struct led_init_data when registering
leds: lm3697: use struct led_init_data when registering
leds: max77650: use struct led_init_data when registering
leds: mt6323: use struct led_init_data when registering
leds: pm8058: use struct led_init_data when registering
leds: is31fl32xx: use struct led_init_data when registering
leds: is31fl319x: use struct led_init_data when registering
leds: lm36274: use struct led_init_data when registering
leds: ns2: refactor and use struct led_init_data

drivers/leds/Kconfig | 2 +-
drivers/leds/led-class.c | 5 +
drivers/leds/leds-an30259a.c | 3 -
drivers/leds/leds-aw2013.c | 3 -
drivers/leds/leds-bcm6328.c | 10 +-
drivers/leds/leds-bcm6358.c | 10 +-
drivers/leds/leds-cr0014114.c | 3 -
drivers/leds/leds-el15203000.c | 3 -
drivers/leds/leds-gpio.c | 3 -
drivers/leds/leds-is31fl319x.c | 204 ++++++++---------
drivers/leds/leds-is31fl32xx.c | 95 +++-----
drivers/leds/leds-lm3532.c | 3 -
drivers/leds/leds-lm36274.c | 100 +++++----
drivers/leds/leds-lm3692x.c | 3 -
drivers/leds/leds-lm3697.c | 18 +-
drivers/leds/leds-lp8860.c | 4 -
drivers/leds/leds-lt3593.c | 3 -
drivers/leds/leds-max77650.c | 24 +-
drivers/leds/leds-mt6323.c | 13 +-
drivers/leds/leds-ns2.c | 361 ++++++++++---------------------
drivers/leds/leds-pm8058.c | 38 ++--
drivers/leds/leds-tlc591xx.c | 2 -
drivers/leds/leds-turris-omnia.c | 2 -
23 files changed, 337 insertions(+), 575 deletions(-)

--
2.26.2

\
 
 \ /
  Last update: 2020-09-17 01:17    [W:0.110 / U:2.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site