kernel: 5.15: Backport Turris Omnia LED patches
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 830-v6.0-leds-turris-omnia-convert-to-use-dev_groups.patch
1 From a01633cd867b8ddf2d8321fe575dc3c54e037b09 Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Fri, 29 Jul 2022 16:03:46 +0200
4 Subject: leds: turris-omnia: convert to use dev_groups
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The driver core supports the ability to handle the creation and removal
10 of device-specific sysfs files in a race-free manner. Take advantage of
11 that by converting this driver to use this by moving the sysfs
12 attributes into a group and assigning the dev_groups pointer to it.
13
14 Cc: Pavel Machek <pavel@ucw.cz>
15 Cc: linux-leds@vger.kernel.org
16 Cc: linux-kernel@vger.kernel.org
17 Reviewed-by: Marek BehĂșn <kabel@kernel.org>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 Signed-off-by: Pavel Machek <pavel@ucw.cz>
20 ---
21 drivers/leds/leds-turris-omnia.c | 4 +---
22 1 file changed, 1 insertion(+), 3 deletions(-)
23
24 (limited to 'drivers/leds/leds-turris-omnia.c')
25
26 --- a/drivers/leds/leds-turris-omnia.c
27 +++ b/drivers/leds/leds-turris-omnia.c
28 @@ -239,9 +239,6 @@ static int omnia_leds_probe(struct i2c_c
29 led += ret;
30 }
31
32 - if (devm_device_add_groups(dev, omnia_led_controller_groups))
33 - dev_warn(dev, "Could not add attribute group!\n");
34 -
35 return 0;
36 }
37
38 @@ -283,6 +280,7 @@ static struct i2c_driver omnia_leds_driv
39 .driver = {
40 .name = "leds-turris-omnia",
41 .of_match_table = of_omnia_leds_match,
42 + .dev_groups = omnia_led_controller_groups,
43 },
44 };
45