Merge tag 'leds-next-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Feb 2023 23:09:31 +0000 (15:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Feb 2023 23:09:31 +0000 (15:09 -0800)
Pull LED updates from Lee Jones:
 "Removed Drivers:
   - HTC ASIC3 LED

  New Functionality:
   - Provide generic led_get() which can be used by both DT and !DT
     platforms

  Fix-ups:
   - Convert a bunch of I2C subsystem users to the new probing API
   - Explicitly provide missing include files
   - Make use of led_init_default_state_get() and rid the custom
     variants
   - Use simplified fwnode_device_is_compatible() API
   - Provide some Device Tree additions / adaptions
   - Fix some trivial spelling issues

  Bug Fixes:
   - Prevent device refcount leak during led_put() and of_led_get()
   - Clear previous data from temporary led_pwm structure before
     processing next child
   - Fix Clang's warning about incompatible function types when using
     devm_add_action*()"

* tag 'leds-next-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (41 commits)
  leds: Remove ide-disk trigger
  dt-bindings: leds: Add disk write/read and usb-host/usb-gadget
  Documentation: leds: Correct spelling
  dt-bindings: leds: Document Bluetooth and WLAN triggers
  leds: Remove asic3 driver
  leds: simatic-ipc-leds-gpio: Make sure we have the GPIO providing driver
  leds: tca6507: Convert to use fwnode_device_is_compatible()
  leds: syscon: Get rid of custom led_init_default_state_get()
  leds: pm8058: Get rid of custom led_init_default_state_get()
  leds: pca955x: Get rid of custom led_init_default_state_get()
  leds: mt6360: Get rid of custom led_init_default_state_get()
  leds: mt6323: Get rid of custom led_init_default_state_get()
  leds: bcm6358: Get rid of custom led_init_default_state_get()
  leds: bcm6328: Get rid of custom led_init_default_state_get()
  leds: an30259a: Get rid of custom led_init_default_state_get()
  leds: Move led_init_default_state_get() to the global header
  leds: Add missing includes and forward declarations in leds.h
  leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
  leds: turris-omnia: Convert to i2c's .probe_new()
  leds: tlc591xx: Convert to i2c's .probe_new()
  ...

41 files changed:
Documentation/devicetree/bindings/leds/common.yaml
Documentation/leds/leds-qcom-lpg.rst
drivers/leds/Kconfig
drivers/leds/Makefile
drivers/leds/flash/leds-mt6360.c
drivers/leds/led-class.c
drivers/leds/leds-an30259a.c
drivers/leds/leds-asic3.c [deleted file]
drivers/leds/leds-bcm6328.c
drivers/leds/leds-bcm6358.c
drivers/leds/leds-bd2802.c
drivers/leds/leds-blinkm.c
drivers/leds/leds-is31fl319x.c
drivers/leds/leds-is31fl32xx.c
drivers/leds/leds-lm3530.c
drivers/leds/leds-lm3532.c
drivers/leds/leds-lm355x.c
drivers/leds/leds-lm3642.c
drivers/leds/leds-lm3692x.c
drivers/leds/leds-lm3697.c
drivers/leds/leds-lp3944.c
drivers/leds/leds-lp3952.c
drivers/leds/leds-lp5521.c
drivers/leds/leds-lp5523.c
drivers/leds/leds-lp5562.c
drivers/leds/leds-lp8501.c
drivers/leds/leds-lp8860.c
drivers/leds/leds-mt6323.c
drivers/leds/leds-pca9532.c
drivers/leds/leds-pca955x.c
drivers/leds/leds-pca963x.c
drivers/leds/leds-pm8058.c
drivers/leds/leds-pwm.c
drivers/leds/leds-syscon.c
drivers/leds/leds-tca6507.c
drivers/leds/leds-tlc591xx.c
drivers/leds/leds-turris-omnia.c
drivers/leds/leds.h
drivers/leds/simple/simatic-ipc-leds-gpio.c
drivers/leds/trigger/ledtrig-disk.c
include/linux/leds.h

index f5c57a580078ea23552d65921b472f5ca2ed474b..15e3f6645682ebf5ded568e8ec9cc2965fe1e43b 100644 (file)
@@ -90,17 +90,22 @@ properties:
           - heartbeat
             # LED indicates disk activity
           - disk-activity
-            # LED indicates IDE disk activity (deprecated), in new implementations
-            # use "disk-activity"
-          - ide-disk
+          - disk-read
+          - disk-write
             # LED flashes at a fixed, configurable rate
           - timer
             # LED alters the brightness for the specified duration with one software
             # timer (requires "led-pattern" property)
           - pattern
-        # LED is triggered by SD/MMC activity
-      - pattern: "^mmc[0-9]+$"
+          - usb-gadget
+          - usb-host
       - pattern: "^cpu[0-9]*$"
+      - pattern: "^hci[0-9]+-power$"
+        # LED is triggered by Bluetooth activity
+      - pattern: "^mmc[0-9]+$"
+        # LED is triggered by SD/MMC activity
+      - pattern: "^phy[0-9]+tx$"
+        # LED is triggered by WLAN activity
 
   led-pattern:
     description: |
index de7ceead933715b60a6a2fe70b04a5e365b122d6..d6a76c38c581a1ab152e1ac816440fbe9a31729e 100644 (file)
@@ -34,7 +34,7 @@ Specify a hardware pattern for a Qualcomm LPG LED.
 
 The pattern is a series of brightness and hold-time pairs, with the hold-time
 expressed in milliseconds. The hold time is a property of the pattern and must
-therefor be identical for each element in the pattern (except for the pauses
+therefore be identical for each element in the pattern (except for the pauses
 described below). As the LPG hardware is not able to perform the linear
 transitions expected by the leds-trigger-pattern format, each entry in the
 pattern must be followed a zero-length entry of the same brightness.
@@ -66,7 +66,7 @@ Low-pause pattern::
         +----------------------------->
         0    5   10   15  20   25   time (100ms)
 
-Similarily, the last entry can be stretched by using a higher hold-time on the
+Similarly, the last entry can be stretched by using a higher hold-time on the
 last entry.
 
 In order to save space in the shared lookup table the LPG supports "ping-pong"
index be2eeb3d6fd368f6124c74ef564420ff45106728..9dbce09eabacfb460a8cfe748accbe08582f1b50 100644 (file)
@@ -623,17 +623,6 @@ config LEDS_NETXBIG
          and 5Big Network v2 boards. The LEDs are wired to a CPLD and are
          controlled through a GPIO extension bus.
 
-config LEDS_ASIC3
-       bool "LED support for the HTC ASIC3"
-       depends on LEDS_CLASS=y
-       depends on MFD_ASIC3
-       default y
-       help
-         This option enables support for the LEDs on the HTC ASIC3. The HTC
-         ASIC3 LED GPIOs are inputs, not outputs, thus the leds-gpio driver
-         cannot be used. This driver supports hardware blinking with an on+off
-         period from 62ms to 125s. Say Y to enable LEDs on the HP iPAQ hx4700.
-
 config LEDS_TCA6507
        tristate "LED Support for TCA6507 I2C chip"
        depends on LEDS_CLASS && I2C
index a790c967fce9355627a85479a36439d28fd5114b..d30395d11fd84dc85b73429895b3fb8c07712de7 100644 (file)
@@ -14,7 +14,6 @@ obj-$(CONFIG_LEDS_ADP5520)            += leds-adp5520.o
 obj-$(CONFIG_LEDS_AN30259A)            += leds-an30259a.o
 obj-$(CONFIG_LEDS_APU)                 += leds-apu.o
 obj-$(CONFIG_LEDS_ARIEL)               += leds-ariel.o
-obj-$(CONFIG_LEDS_ASIC3)               += leds-asic3.o
 obj-$(CONFIG_LEDS_AW2013)              += leds-aw2013.o
 obj-$(CONFIG_LEDS_BCM6328)             += leds-bcm6328.o
 obj-$(CONFIG_LEDS_BCM6358)             += leds-bcm6358.o
index e1066a52d2d21b699816fe95388f2ea5b385d8a4..1af6c589834348c972164e8e60a553db9402a0d9 100644 (file)
@@ -71,10 +71,6 @@ enum {
 #define MT6360_STRBTO_STEPUS           32000
 #define MT6360_STRBTO_MAXUS            2432000
 
-#define STATE_OFF                      0
-#define STATE_KEEP                     1
-#define STATE_ON                       2
-
 struct mt6360_led {
        union {
                struct led_classdev isnk;
@@ -84,7 +80,7 @@ struct mt6360_led {
        struct v4l2_flash *v4l2_flash;
        struct mt6360_priv *priv;
        u32 led_no;
-       u32 default_state;
+       enum led_default_state default_state;
 };
 
 struct mt6360_priv {
@@ -405,10 +401,10 @@ static int mt6360_isnk_init_default_state(struct mt6360_led *led)
                level = LED_OFF;
 
        switch (led->default_state) {
-       case STATE_ON:
+       case LEDS_DEFSTATE_ON:
                led->isnk.brightness = led->isnk.max_brightness;
                break;
-       case STATE_KEEP:
+       case LEDS_DEFSTATE_KEEP:
                led->isnk.brightness = min(level, led->isnk.max_brightness);
                break;
        default:
@@ -443,10 +439,10 @@ static int mt6360_flash_init_default_state(struct mt6360_led *led)
                level = LED_OFF;
 
        switch (led->default_state) {
-       case STATE_ON:
+       case LEDS_DEFSTATE_ON:
                flash->led_cdev.brightness = flash->led_cdev.max_brightness;
                break;
-       case STATE_KEEP:
+       case LEDS_DEFSTATE_KEEP:
                flash->led_cdev.brightness =
                        min(level, flash->led_cdev.max_brightness);
                break;
@@ -760,25 +756,6 @@ static int mt6360_init_flash_properties(struct mt6360_led *led,
        return 0;
 }
 
-static int mt6360_init_common_properties(struct mt6360_led *led,
-                                        struct led_init_data *init_data)
-{
-       const char *const states[] = { "off", "keep", "on" };
-       const char *str;
-       int ret;
-
-       if (!fwnode_property_read_string(init_data->fwnode,
-                                        "default-state", &str)) {
-               ret = match_string(states, ARRAY_SIZE(states), str);
-               if (ret < 0)
-                       ret = STATE_OFF;
-
-               led->default_state = ret;
-       }
-
-       return 0;
-}
-
 static void mt6360_v4l2_flash_release(struct mt6360_priv *priv)
 {
        int i;
@@ -852,10 +829,7 @@ static int mt6360_led_probe(struct platform_device *pdev)
 
                led->led_no = reg;
                led->priv = priv;
-
-               ret = mt6360_init_common_properties(led, &init_data);
-               if (ret)
-                       goto out_flash_release;
+               led->default_state = led_init_default_state_get(child);
 
                if (reg == MT6360_VIRTUAL_MULTICOLOR ||
                    reg <= MT6360_LED_ISNKML)
index 0c4b8d8d2b4fe4aa15ff39b4e45d794e10e89244..a6b3adcd044a01e4e25d95de72680f213eb083be 100644 (file)
@@ -253,6 +253,7 @@ struct led_classdev *of_led_get(struct device_node *np, int index)
 
        led_dev = class_find_device_by_of_node(leds_class, led_node);
        of_node_put(led_node);
+       put_device(led_dev);
 
        return led_module_get(led_dev);
 }
index e072ee5409f7e0bc1c52caeb263a411dadc3ba4c..89df267853a91e2c2e8c825c7822243f07ba2cdb 100644 (file)
 
 #define AN30259A_NAME "an30259a"
 
-#define STATE_OFF 0
-#define STATE_KEEP 1
-#define STATE_ON 2
-
 struct an30259a;
 
 struct an30259a_led {
@@ -66,7 +62,7 @@ struct an30259a_led {
        struct fwnode_handle *fwnode;
        struct led_classdev cdev;
        u32 num;
-       u32 default_state;
+       enum led_default_state default_state;
        bool sloping;
 };
 
@@ -205,7 +201,6 @@ static int an30259a_dt_init(struct i2c_client *client,
        struct device_node *np = dev_of_node(&client->dev), *child;
        int count, ret;
        int i = 0;
-       const char *str;
        struct an30259a_led *led;
 
        count = of_get_available_child_count(np);
@@ -228,15 +223,7 @@ static int an30259a_dt_init(struct i2c_client *client,
                led->num = source;
                led->chip = chip;
                led->fwnode = of_fwnode_handle(child);
-
-               if (!of_property_read_string(child, "default-state", &str)) {
-                       if (!strcmp(str, "on"))
-                               led->default_state = STATE_ON;
-                       else if (!strcmp(str, "keep"))
-                               led->default_state = STATE_KEEP;
-                       else
-                               led->default_state = STATE_OFF;
-               }
+               led->default_state = led_init_default_state_get(led->fwnode);
 
                i++;
        }
@@ -261,10 +248,10 @@ static void an30259a_init_default_state(struct an30259a_led *led)
        int led_on, err;
 
        switch (led->default_state) {
-       case STATE_ON:
+       case LEDS_DEFSTATE_ON:
                led->cdev.brightness = LED_FULL;
                break;
-       case STATE_KEEP:
+       case LEDS_DEFSTATE_KEEP:
                err = regmap_read(chip->regmap, AN30259A_REG_LED_ON, &led_on);
                if (err)
                        break;
diff --git a/drivers/leds/leds-asic3.c b/drivers/leds/leds-asic3.c
deleted file mode 100644 (file)
index 8cbc1b8..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- *  Copyright (C) 2011 Paul Parsons <lost.distance@yahoo.com>
- */
-
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/leds.h>
-#include <linux/slab.h>
-
-#include <linux/mfd/asic3.h>
-#include <linux/mfd/core.h>
-#include <linux/module.h>
-
-/*
- *     The HTC ASIC3 LED GPIOs are inputs, not outputs.
- *     Hence we turn the LEDs on/off via the TimeBase register.
- */
-
-/*
- *     When TimeBase is 4 the clock resolution is about 32Hz.
- *     This driver supports hardware blinking with an on+off
- *     period from 62ms (2 clocks) to 125s (4000 clocks).
- */
-#define MS_TO_CLK(ms)  DIV_ROUND_CLOSEST(((ms)*1024), 32000)
-#define CLK_TO_MS(clk) (((clk)*32000)/1024)
-#define MAX_CLK                4000            /* Fits into 12-bit Time registers */
-#define MAX_MS         CLK_TO_MS(MAX_CLK)
-
-static const unsigned int led_n_base[ASIC3_NUM_LEDS] = {
-       [0] = ASIC3_LED_0_Base,
-       [1] = ASIC3_LED_1_Base,
-       [2] = ASIC3_LED_2_Base,
-};
-
-static void brightness_set(struct led_classdev *cdev,
-       enum led_brightness value)
-{
-       struct platform_device *pdev = to_platform_device(cdev->dev->parent);
-       const struct mfd_cell *cell = mfd_get_cell(pdev);
-       struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
-       u32 timebase;
-       unsigned int base;
-
-       timebase = (value == LED_OFF) ? 0 : (LED_EN|0x4);
-
-       base = led_n_base[cell->id];
-       asic3_write_register(asic, (base + ASIC3_LED_PeriodTime), 32);
-       asic3_write_register(asic, (base + ASIC3_LED_DutyTime), 32);
-       asic3_write_register(asic, (base + ASIC3_LED_AutoStopCount), 0);
-       asic3_write_register(asic, (base + ASIC3_LED_TimeBase), timebase);
-}
-
-static int blink_set(struct led_classdev *cdev,
-       unsigned long *delay_on,
-       unsigned long *delay_off)
-{
-       struct platform_device *pdev = to_platform_device(cdev->dev->parent);
-       const struct mfd_cell *cell = mfd_get_cell(pdev);
-       struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
-       u32 on;
-       u32 off;
-       unsigned int base;
-
-       if (*delay_on > MAX_MS || *delay_off > MAX_MS)
-               return -EINVAL;
-
-       if (*delay_on == 0 && *delay_off == 0) {
-               /* If both are zero then a sensible default should be chosen */
-               on = MS_TO_CLK(500);
-               off = MS_TO_CLK(500);
-       } else {
-               on = MS_TO_CLK(*delay_on);
-               off = MS_TO_CLK(*delay_off);
-               if ((on + off) > MAX_CLK)
-                       return -EINVAL;
-       }
-
-       base = led_n_base[cell->id];
-       asic3_write_register(asic, (base + ASIC3_LED_PeriodTime), (on + off));
-       asic3_write_register(asic, (base + ASIC3_LED_DutyTime), on);
-       asic3_write_register(asic, (base + ASIC3_LED_AutoStopCount), 0);
-       asic3_write_register(asic, (base + ASIC3_LED_TimeBase), (LED_EN|0x4));
-
-       *delay_on = CLK_TO_MS(on);
-       *delay_off = CLK_TO_MS(off);
-
-       return 0;
-}
-
-static int asic3_led_probe(struct platform_device *pdev)
-{
-       struct asic3_led *led = dev_get_platdata(&pdev->dev);
-       int ret;
-
-       ret = mfd_cell_enable(pdev);
-       if (ret < 0)
-               return ret;
-
-       led->cdev = devm_kzalloc(&pdev->dev, sizeof(struct led_classdev),
-                               GFP_KERNEL);
-       if (!led->cdev) {
-               ret = -ENOMEM;
-               goto out;
-       }
-
-       led->cdev->name = led->name;
-       led->cdev->flags = LED_CORE_SUSPENDRESUME;
-       led->cdev->brightness_set = brightness_set;
-       led->cdev->blink_set = blink_set;
-       led->cdev->default_trigger = led->default_trigger;
-
-       ret = led_classdev_register(&pdev->dev, led->cdev);
-       if (ret < 0)
-               goto out;
-
-       return 0;
-
-out:
-       (void) mfd_cell_disable(pdev);
-       return ret;
-}
-
-static int asic3_led_remove(struct platform_device *pdev)
-{
-       struct asic3_led *led = dev_get_platdata(&pdev->dev);
-
-       led_classdev_unregister(led->cdev);
-
-       return mfd_cell_disable(pdev);
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int asic3_led_suspend(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       const struct mfd_cell *cell = mfd_get_cell(pdev);
-       int ret;
-
-       ret = 0;
-       if (cell->suspend)
-               ret = (*cell->suspend)(pdev);
-
-       return ret;
-}
-
-static int asic3_led_resume(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       const struct mfd_cell *cell = mfd_get_cell(pdev);
-       int ret;
-
-       ret = 0;
-       if (cell->resume)
-               ret = (*cell->resume)(pdev);
-
-       return ret;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(asic3_led_pm_ops, asic3_led_suspend, asic3_led_resume);
-
-static struct platform_driver asic3_led_driver = {
-       .probe          = asic3_led_probe,
-       .remove         = asic3_led_remove,
-       .driver         = {
-               .name   = "leds-asic3",
-               .pm     = &asic3_led_pm_ops,
-       },
-};
-
-module_platform_driver(asic3_led_driver);
-
-MODULE_AUTHOR("Paul Parsons <lost.distance@yahoo.com>");
-MODULE_DESCRIPTION("HTC ASIC3 LED driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:leds-asic3");
index 2d4d87957a3003ed5cd4b015e8bf92ebbba25945..246f1296ab0920d4dd65f1a6f60f6492d18e8cd3 100644 (file)
@@ -330,7 +330,9 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
 {
        struct led_init_data init_data = {};
        struct bcm6328_led *led;
-       const char *state;
+       enum led_default_state state;
+       unsigned long val, shift;
+       void __iomem *mode;
        int rc;
 
        led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
@@ -346,31 +348,29 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
        if (of_property_read_bool(nc, "active-low"))
                led->active_low = true;
 
-       if (!of_property_read_string(nc, "default-state", &state)) {
-               if (!strcmp(state, "on")) {
+       init_data.fwnode = of_fwnode_handle(nc);
+
+       state = led_init_default_state_get(init_data.fwnode);
+       switch (state) {
+       case LEDS_DEFSTATE_ON:
+               led->cdev.brightness = LED_FULL;
+               break;
+       case LEDS_DEFSTATE_KEEP:
+               shift = bcm6328_pin2shift(led->pin);
+               if (shift / 16)
+                       mode = mem + BCM6328_REG_MODE_HI;
+               else
+                       mode = mem + BCM6328_REG_MODE_LO;
+
+               val = bcm6328_led_read(mode) >> BCM6328_LED_SHIFT(shift % 16);
+               val &= BCM6328_LED_MODE_MASK;
+               if ((led->active_low && val == BCM6328_LED_MODE_OFF) ||
+                   (!led->active_low && val == BCM6328_LED_MODE_ON))
                        led->cdev.brightness = LED_FULL;
-               } else if (!strcmp(state, "keep")) {
-                       void __iomem *mode;
-                       unsigned long val, shift;
-
-                       shift = bcm6328_pin2shift(led->pin);
-                       if (shift / 16)
-                               mode = mem + BCM6328_REG_MODE_HI;
-                       else
-                               mode = mem + BCM6328_REG_MODE_LO;
-
-                       val = bcm6328_led_read(mode) >>
-                             BCM6328_LED_SHIFT(shift % 16);
-                       val &= BCM6328_LED_MODE_MASK;
-                       if ((led->active_low && val == BCM6328_LED_MODE_OFF) ||
-                           (!led->active_low && val == BCM6328_LED_MODE_ON))
-                               led->cdev.brightness = LED_FULL;
-                       else
-                               led->cdev.brightness = LED_OFF;
-               } else {
+               else
                        led->cdev.brightness = LED_OFF;
-               }
-       } else {
+               break;
+       default:
                led->cdev.brightness = LED_OFF;
        }
 
@@ -378,7 +378,6 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
 
        led->cdev.brightness_set = bcm6328_led_set;
        led->cdev.blink_set = bcm6328_blink_set;
-       init_data.fwnode = of_fwnode_handle(nc);
 
        rc = devm_led_classdev_register_ext(dev, &led->cdev, &init_data);
        if (rc < 0)
index 9d2e487fa08a307ab72adb9a812a4b068e37239f..86e51d44a5a741eb72e51ba44adfbb906d1d8545 100644 (file)
@@ -96,7 +96,8 @@ static int bcm6358_led(struct device *dev, struct device_node *nc, u32 reg,
 {
        struct led_init_data init_data = {};
        struct bcm6358_led *led;
-       const char *state;
+       enum led_default_state state;
+       unsigned long val;
        int rc;
 
        led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
@@ -110,29 +111,28 @@ static int bcm6358_led(struct device *dev, struct device_node *nc, u32 reg,
        if (of_property_read_bool(nc, "active-low"))
                led->active_low = true;
 
-       if (!of_property_read_string(nc, "default-state", &state)) {
-               if (!strcmp(state, "on")) {
+       init_data.fwnode = of_fwnode_handle(nc);
+
+       state = led_init_default_state_get(init_data.fwnode);
+       switch (state) {
+       case LEDS_DEFSTATE_ON:
+               led->cdev.brightness = LED_FULL;
+               break;
+       case LEDS_DEFSTATE_KEEP:
+               val = bcm6358_led_read(led->mem + BCM6358_REG_MODE);
+               val &= BIT(led->pin);
+               if ((led->active_low && !val) || (!led->active_low && val))
                        led->cdev.brightness = LED_FULL;
-               } else if (!strcmp(state, "keep")) {
-                       unsigned long val;
-                       val = bcm6358_led_read(led->mem + BCM6358_REG_MODE);
-                       val &= BIT(led->pin);
-                       if ((led->active_low && !val) ||
-                           (!led->active_low && val))
-                               led->cdev.brightness = LED_FULL;
-                       else
-                               led->cdev.brightness = LED_OFF;
-               } else {
+               else
                        led->cdev.brightness = LED_OFF;
-               }
-       } else {
+               break;
+       default:
                led->cdev.brightness = LED_OFF;
        }
 
        bcm6358_led_set(&led->cdev, led->cdev.brightness);
 
        led->cdev.brightness_set = bcm6358_led_set;
-       init_data.fwnode = of_fwnode_handle(nc);
 
        rc = devm_led_classdev_register_ext(dev, &led->cdev, &init_data);
        if (rc < 0)
index 2b6678f6bd565381408bd25864b5ea9a73d35da4..601185ddabcc28e361b47fd26bcc9b3729f84091 100644 (file)
@@ -656,8 +656,7 @@ static void bd2802_unregister_led_classdev(struct bd2802_led *led)
        led_classdev_unregister(&led->cdev_led1r);
 }
 
-static int bd2802_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int bd2802_probe(struct i2c_client *client)
 {
        struct bd2802_led *led;
        int ret, i;
@@ -787,7 +786,7 @@ static struct i2c_driver bd2802_i2c_driver = {
                .name   = "BD2802",
                .pm     = &bd2802_pm,
        },
-       .probe          = bd2802_probe,
+       .probe_new      = bd2802_probe,
        .remove         = bd2802_remove,
        .id_table       = bd2802_id,
 };
index e19cc8a7b7cac2c997700e4d371ebf8e9436d241..37f2f32ae42d77b9c0cf75943a06dcbbc75cc5c5 100644 (file)
@@ -565,8 +565,7 @@ static int blinkm_detect(struct i2c_client *client, struct i2c_board_info *info)
        return 0;
 }
 
-static int blinkm_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int blinkm_probe(struct i2c_client *client)
 {
        struct blinkm_data *data;
        struct blinkm_led *led[3];
@@ -731,7 +730,7 @@ static struct i2c_driver blinkm_driver = {
        .driver = {
                   .name = "blinkm",
                   },
-       .probe = blinkm_probe,
+       .probe_new = blinkm_probe,
        .remove = blinkm_remove,
        .id_table = blinkm_id,
        .detect = blinkm_detect,
index b2f4c4ec7c5671906e3cb4f77d4e7c72931c07c5..7c908414ac7e0c468a0cb401a7629e5e9948f0a7 100644 (file)
@@ -495,6 +495,11 @@ static inline int is31fl3196_db_to_gain(u32 dezibel)
        return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP;
 }
 
+static void is31f1319x_mutex_destroy(void *lock)
+{
+       mutex_destroy(lock);
+}
+
 static int is31fl319x_probe(struct i2c_client *client)
 {
        struct is31fl319x_chip *is31;
@@ -511,7 +516,7 @@ static int is31fl319x_probe(struct i2c_client *client)
                return -ENOMEM;
 
        mutex_init(&is31->lock);
-       err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
+       err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock);
        if (err)
                return err;
 
index 0d219c1ac3b54bf64cfd43a0f7cd162d4ff78d22..799191859ce07add2db903cf821bd83d97efbed1 100644 (file)
@@ -422,8 +422,7 @@ static const struct of_device_id of_is31fl32xx_match[] = {
 
 MODULE_DEVICE_TABLE(of, of_is31fl32xx_match);
 
-static int is31fl32xx_probe(struct i2c_client *client,
-                           const struct i2c_device_id *id)
+static int is31fl32xx_probe(struct i2c_client *client)
 {
        const struct is31fl32xx_chipdef *cdef;
        struct device *dev = &client->dev;
@@ -489,7 +488,7 @@ static struct i2c_driver is31fl32xx_driver = {
                .name   = "is31fl32xx",
                .of_match_table = of_is31fl32xx_match,
        },
-       .probe          = is31fl32xx_probe,
+       .probe_new      = is31fl32xx_probe,
        .remove         = is31fl32xx_remove,
        .id_table       = is31fl32xx_id,
 };
index ba906c253c7f439e9a685e107ab6710078ff48da..a9a2018592ffcc5f39b21196d9c22596e14d6e1a 100644 (file)
@@ -405,8 +405,7 @@ static struct attribute *lm3530_attrs[] = {
 };
 ATTRIBUTE_GROUPS(lm3530);
 
-static int lm3530_probe(struct i2c_client *client,
-                          const struct i2c_device_id *id)
+static int lm3530_probe(struct i2c_client *client)
 {
        struct lm3530_platform_data *pdata = dev_get_platdata(&client->dev);
        struct lm3530_data *drvdata;
@@ -485,7 +484,7 @@ static const struct i2c_device_id lm3530_id[] = {
 MODULE_DEVICE_TABLE(i2c, lm3530_id);
 
 static struct i2c_driver lm3530_i2c_driver = {
-       .probe = lm3530_probe,
+       .probe_new = lm3530_probe,
        .remove = lm3530_remove,
        .id_table = lm3530_id,
        .driver = {
index db64d44bcbbfb47deb097c6400551257c0ea326f..a08c09129a68b3c77e5b6b7a67c17b6c7c15c56a 100644 (file)
@@ -663,8 +663,7 @@ child_out:
        return ret;
 }
 
-static int lm3532_probe(struct i2c_client *client,
-                          const struct i2c_device_id *id)
+static int lm3532_probe(struct i2c_client *client)
 {
        struct lm3532_data *drvdata;
        int ret = 0;
@@ -727,7 +726,7 @@ static const struct i2c_device_id lm3532_id[] = {
 MODULE_DEVICE_TABLE(i2c, lm3532_id);
 
 static struct i2c_driver lm3532_i2c_driver = {
-       .probe = lm3532_probe,
+       .probe_new = lm3532_probe,
        .remove = lm3532_remove,
        .id_table = lm3532_id,
        .driver = {
index daa35927b301937d4a881d4460973c2af1266a4c..612873070ca48e3202715dae59db4d76f67f2403 100644 (file)
@@ -396,9 +396,9 @@ static const struct regmap_config lm355x_regmap = {
 };
 
 /* module initialize */
-static int lm355x_probe(struct i2c_client *client,
-                                 const struct i2c_device_id *id)
+static int lm355x_probe(struct i2c_client *client)
 {
+       const struct i2c_device_id *id = i2c_client_get_device_id(client);
        struct lm355x_platform_data *pdata = dev_get_platdata(&client->dev);
        struct lm355x_chip_data *chip;
 
@@ -516,7 +516,7 @@ static struct i2c_driver lm355x_i2c_driver = {
                   .name = LM355x_NAME,
                   .pm = NULL,
                   },
-       .probe = lm355x_probe,
+       .probe_new = lm355x_probe,
        .remove = lm355x_remove,
        .id_table = lm355x_id,
 };
index 428a5d92815045d6d7c9f1acb1c566e6ccf3232b..b75ee3546c2ec7fa1e5304a95ba501497153caaa 100644 (file)
@@ -289,8 +289,7 @@ static struct attribute *lm3642_torch_attrs[] = {
 };
 ATTRIBUTE_GROUPS(lm3642_torch);
 
-static int lm3642_probe(struct i2c_client *client,
-                                 const struct i2c_device_id *id)
+static int lm3642_probe(struct i2c_client *client)
 {
        struct lm3642_platform_data *pdata = dev_get_platdata(&client->dev);
        struct lm3642_chip_data *chip;
@@ -402,7 +401,7 @@ static struct i2c_driver lm3642_i2c_driver = {
                   .name = LM3642_NAME,
                   .pm = NULL,
                   },
-       .probe = lm3642_probe,
+       .probe_new = lm3642_probe,
        .remove = lm3642_remove,
        .id_table = lm3642_id,
 };
index 54b4662bff41ebe5f92f410fefd2937164b57088..66126d0666f5bfd3b5833cf9ab0f7aab7aa8695c 100644 (file)
@@ -456,9 +456,9 @@ static int lm3692x_probe_dt(struct lm3692x_led *led)
        return ret;
 }
 
-static int lm3692x_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int lm3692x_probe(struct i2c_client *client)
 {
+       const struct i2c_device_id *id = i2c_client_get_device_id(client);
        struct lm3692x_led *led;
        int ret;
 
@@ -518,7 +518,7 @@ static struct i2c_driver lm3692x_driver = {
                .name   = "lm3692x",
                .of_match_table = of_lm3692x_leds_match,
        },
-       .probe          = lm3692x_probe,
+       .probe_new      = lm3692x_probe,
        .remove         = lm3692x_remove,
        .id_table       = lm3692x_id,
 };
index 71231a60eebce8cf208fdcc3dbe2853f211b93a1..10e904bf40a046e69e6a1f7221d15280b40fc733 100644 (file)
@@ -299,8 +299,7 @@ child_out:
        return ret;
 }
 
-static int lm3697_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int lm3697_probe(struct i2c_client *client)
 {
        struct device *dev = &client->dev;
        struct lm3697 *led;
@@ -377,7 +376,7 @@ static struct i2c_driver lm3697_driver = {
                .name   = "lm3697",
                .of_match_table = of_lm3697_leds_match,
        },
-       .probe          = lm3697_probe,
+       .probe_new      = lm3697_probe,
        .remove         = lm3697_remove,
        .id_table       = lm3697_id,
 };
index 673ad8c04f415be6c08423497269bdc138d199d0..be47c66b2e00bd6a44d2889bc1193428521fb88b 100644 (file)
@@ -359,8 +359,7 @@ exit:
        return err;
 }
 
-static int lp3944_probe(struct i2c_client *client,
-                                 const struct i2c_device_id *id)
+static int lp3944_probe(struct i2c_client *client)
 {
        struct lp3944_platform_data *lp3944_pdata =
                        dev_get_platdata(&client->dev);
@@ -428,7 +427,7 @@ static struct i2c_driver lp3944_driver = {
        .driver   = {
                   .name = "lp3944",
        },
-       .probe    = lp3944_probe,
+       .probe_new = lp3944_probe,
        .remove   = lp3944_remove,
        .id_table = lp3944_id,
 };
index bf0ad1b5ce24953ed56415574a0530c8f0bb8e41..24b2e0f9080d95b794c4d78547651a4df7d0c9d7 100644 (file)
@@ -207,8 +207,7 @@ static const struct regmap_config lp3952_regmap = {
        .cache_type = REGCACHE_RBTREE,
 };
 
-static int lp3952_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int lp3952_probe(struct i2c_client *client)
 {
        int status;
        struct lp3952_led_array *priv;
@@ -274,7 +273,7 @@ static struct i2c_driver lp3952_i2c_driver = {
        .driver = {
                        .name = LP3952_NAME,
        },
-       .probe = lp3952_probe,
+       .probe_new = lp3952_probe,
        .remove = lp3952_remove,
        .id_table = lp3952_id,
 };
index 19478d9c19a70d5932d3c3af7a150589ba112242..a004af8e22c742396b8a227ccb589c0a75a61a1a 100644 (file)
@@ -516,9 +516,9 @@ static struct lp55xx_device_config lp5521_cfg = {
        .dev_attr_group     = &lp5521_group,
 };
 
-static int lp5521_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int lp5521_probe(struct i2c_client *client)
 {
+       const struct i2c_device_id *id = i2c_client_get_device_id(client);
        int ret;
        struct lp55xx_chip *chip;
        struct lp55xx_led *led;
@@ -608,7 +608,7 @@ static struct i2c_driver lp5521_driver = {
                .name   = "lp5521",
                .of_match_table = of_match_ptr(of_lp5521_leds_match),
        },
-       .probe          = lp5521_probe,
+       .probe_new      = lp5521_probe,
        .remove         = lp5521_remove,
        .id_table       = lp5521_id,
 };
index e08e3de1428df3ff37d7a2c31bcfa5504ba6455c..55da914b8e5cac2931a6789c86538b89c5cfa612 100644 (file)
@@ -887,9 +887,9 @@ static struct lp55xx_device_config lp5523_cfg = {
        .dev_attr_group     = &lp5523_group,
 };
 
-static int lp5523_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int lp5523_probe(struct i2c_client *client)
 {
+       const struct i2c_device_id *id = i2c_client_get_device_id(client);
        int ret;
        struct lp55xx_chip *chip;
        struct lp55xx_led *led;
@@ -983,7 +983,7 @@ static struct i2c_driver lp5523_driver = {
                .name   = "lp5523x",
                .of_match_table = of_match_ptr(of_lp5523_leds_match),
        },
-       .probe          = lp5523_probe,
+       .probe_new      = lp5523_probe,
        .remove         = lp5523_remove,
        .id_table       = lp5523_id,
 };
index 0e490085ff35860749586a6a4409cea9f07559ef..b5d877faf6d731589fe685c8ec3f60d4d8ee9311 100644 (file)
@@ -511,8 +511,7 @@ static struct lp55xx_device_config lp5562_cfg = {
        .dev_attr_group     = &lp5562_group,
 };
 
-static int lp5562_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int lp5562_probe(struct i2c_client *client)
 {
        int ret;
        struct lp55xx_chip *chip;
@@ -604,7 +603,7 @@ static struct i2c_driver lp5562_driver = {
                .name   = "lp5562",
                .of_match_table = of_match_ptr(of_lp5562_leds_match),
        },
-       .probe          = lp5562_probe,
+       .probe_new      = lp5562_probe,
        .remove         = lp5562_remove,
        .id_table       = lp5562_id,
 };
index ae11a02c0ab23b53425d99b5efd57e5f4466aa8e..165d6423a928d8e8b747aa726fdee96884585d48 100644 (file)
@@ -299,9 +299,9 @@ static struct lp55xx_device_config lp8501_cfg = {
        .run_engine         = lp8501_run_engine,
 };
 
-static int lp8501_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int lp8501_probe(struct i2c_client *client)
 {
+       const struct i2c_device_id *id = i2c_client_get_device_id(client);
        int ret;
        struct lp55xx_chip *chip;
        struct lp55xx_led *led;
@@ -392,7 +392,7 @@ static struct i2c_driver lp8501_driver = {
                .name   = "lp8501",
                .of_match_table = of_match_ptr(of_lp8501_leds_match),
        },
-       .probe          = lp8501_probe,
+       .probe_new      = lp8501_probe,
        .remove         = lp8501_remove,
        .id_table       = lp8501_id,
 };
index e2b36d3187eb63f0a7b89373d95ae06135d15667..b66ed5ac1aa543b84f48006ae2654a6ec80509e8 100644 (file)
@@ -375,8 +375,7 @@ static const struct regmap_config lp8860_eeprom_regmap_config = {
        .cache_type = REGCACHE_NONE,
 };
 
-static int lp8860_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int lp8860_probe(struct i2c_client *client)
 {
        int ret;
        struct lp8860_led *led;
@@ -480,7 +479,7 @@ static struct i2c_driver lp8860_driver = {
                .name   = "lp8860",
                .of_match_table = of_lp8860_leds_match,
        },
-       .probe          = lp8860_probe,
+       .probe_new      = lp8860_probe,
        .remove         = lp8860_remove,
        .id_table       = lp8860_id,
 };
index f59e0e8bda8bb2c9541b3b2bd6d4ffa2f6e8d5df..17ee88043f5296ca1fb774197c58651d455f70b9 100644 (file)
@@ -339,23 +339,23 @@ static int mt6323_led_set_dt_default(struct led_classdev *cdev,
                                     struct device_node *np)
 {
        struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
-       const char *state;
+       enum led_default_state state;
        int ret = 0;
 
-       state = of_get_property(np, "default-state", NULL);
-       if (state) {
-               if (!strcmp(state, "keep")) {
-                       ret = mt6323_get_led_hw_brightness(cdev);
-                       if (ret < 0)
-                               return ret;
-                       led->current_brightness = ret;
-                       ret = 0;
-               } else if (!strcmp(state, "on")) {
-                       ret =
-                       mt6323_led_set_brightness(cdev, cdev->max_brightness);
-               } else  {
-                       ret = mt6323_led_set_brightness(cdev, LED_OFF);
-               }
+       state = led_init_default_state_get(of_fwnode_handle(np));
+       switch (state) {
+       case LEDS_DEFSTATE_ON:
+               ret = mt6323_led_set_brightness(cdev, cdev->max_brightness);
+               break;
+       case LEDS_DEFSTATE_KEEP:
+               ret = mt6323_get_led_hw_brightness(cdev);
+               if (ret < 0)
+                       return ret;
+               led->current_brightness = ret;
+               ret = 0;
+               break;
+       default:
+               ret = mt6323_led_set_brightness(cdev, LED_OFF);
        }
 
        return ret;
index df83d97cb47967f02f89bc8e2c68fdd75b154581..15b1acfa442e7e4f8bb5b362f3f0e3f7ed6c7b13 100644 (file)
@@ -50,8 +50,7 @@ struct pca9532_data {
        u8 psc[2];
 };
 
-static int pca9532_probe(struct i2c_client *client,
-       const struct i2c_device_id *id);
+static int pca9532_probe(struct i2c_client *client);
 static void pca9532_remove(struct i2c_client *client);
 
 enum {
@@ -103,7 +102,7 @@ static struct i2c_driver pca9532_driver = {
                .name = "leds-pca953x",
                .of_match_table = of_match_ptr(of_pca9532_leds_match),
        },
-       .probe = pca9532_probe,
+       .probe_new = pca9532_probe,
        .remove = pca9532_remove,
        .id_table = pca9532_id,
 };
@@ -504,9 +503,9 @@ pca9532_of_populate_pdata(struct device *dev, struct device_node *np)
        return pdata;
 }
 
-static int pca9532_probe(struct i2c_client *client,
-       const struct i2c_device_id *id)
+static int pca9532_probe(struct i2c_client *client)
 {
+       const struct i2c_device_id *id = i2c_client_get_device_id(client);
        int devid;
        struct pca9532_data *data = i2c_get_clientdata(client);
        struct pca9532_platform_data *pca9532_pdata =
index 33ec4543fb4f82b21216f6105f2953366330ed50..1edd092e7894792518aeea3de6b484e95eff935a 100644 (file)
@@ -130,7 +130,7 @@ struct pca955x_led {
        struct led_classdev     led_cdev;
        int                     led_num;        /* 0 .. 15 potentially */
        u32                     type;
-       int                     default_state;
+       enum led_default_state  default_state;
        struct fwnode_handle    *fwnode;
 };
 
@@ -437,7 +437,6 @@ pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip)
                return ERR_PTR(-ENOMEM);
 
        device_for_each_child_node(&client->dev, child) {
-               const char *state;
                u32 reg;
                int res;
 
@@ -448,19 +447,9 @@ pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip)
                led = &pdata->leds[reg];
                led->type = PCA955X_TYPE_LED;
                led->fwnode = child;
-               fwnode_property_read_u32(child, "type", &led->type);
+               led->default_state = led_init_default_state_get(child);
 
-               if (!fwnode_property_read_string(child, "default-state",
-                                                &state)) {
-                       if (!strcmp(state, "keep"))
-                               led->default_state = LEDS_GPIO_DEFSTATE_KEEP;
-                       else if (!strcmp(state, "on"))
-                               led->default_state = LEDS_GPIO_DEFSTATE_ON;
-                       else
-                               led->default_state = LEDS_GPIO_DEFSTATE_OFF;
-               } else {
-                       led->default_state = LEDS_GPIO_DEFSTATE_OFF;
-               }
+               fwnode_property_read_u32(child, "type", &led->type);
        }
 
        pdata->num_leds = chip->bits;
@@ -572,13 +561,11 @@ static int pca955x_probe(struct i2c_client *client)
                        led->brightness_set_blocking = pca955x_led_set;
                        led->brightness_get = pca955x_led_get;
 
-                       if (pdata->leds[i].default_state ==
-                           LEDS_GPIO_DEFSTATE_OFF) {
+                       if (pdata->leds[i].default_state == LEDS_DEFSTATE_OFF) {
                                err = pca955x_led_set(led, LED_OFF);
                                if (err)
                                        return err;
-                       } else if (pdata->leds[i].default_state ==
-                                  LEDS_GPIO_DEFSTATE_ON) {
+                       } else if (pdata->leds[i].default_state == LEDS_DEFSTATE_ON) {
                                err = pca955x_led_set(led, LED_FULL);
                                if (err)
                                        return err;
@@ -617,8 +604,7 @@ static int pca955x_probe(struct i2c_client *client)
                         * brightness to see if it's using PWM1. If so, PWM1
                         * should not be written below.
                         */
-                       if (pdata->leds[i].default_state ==
-                           LEDS_GPIO_DEFSTATE_KEEP) {
+                       if (pdata->leds[i].default_state == LEDS_DEFSTATE_KEEP) {
                                if (led->brightness != LED_FULL &&
                                    led->brightness != LED_OFF &&
                                    led->brightness != LED_HALF)
index a7e052c1db5315cdbf0343b3f4082ba11fdeb06a..9cd476db601f2b7c0c93857528a5d335827fb659 100644 (file)
@@ -389,9 +389,9 @@ static const struct of_device_id of_pca963x_match[] = {
 };
 MODULE_DEVICE_TABLE(of, of_pca963x_match);
 
-static int pca963x_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int pca963x_probe(struct i2c_client *client)
 {
+       const struct i2c_device_id *id = i2c_client_get_device_id(client);
        struct device *dev = &client->dev;
        struct pca963x_chipdef *chipdef;
        struct pca963x *chip;
@@ -431,7 +431,7 @@ static struct i2c_driver pca963x_driver = {
                .name   = "leds-pca963x",
                .of_match_table = of_pca963x_match,
        },
-       .probe  = pca963x_probe,
+       .probe_new = pca963x_probe,
        .id_table = pca963x_id,
 };
 
index fb2ab72c0c40c78b812e3b5658862bfb3e227e55..b9233f14b6467e26d389c0c87ea3901d5b3ab680 100644 (file)
@@ -93,8 +93,8 @@ static int pm8058_led_probe(struct platform_device *pdev)
        struct device_node *np;
        int ret;
        struct regmap *map;
-       const char *state;
        enum led_brightness maxbright;
+       enum led_default_state state;
 
        led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
        if (!led)
@@ -125,25 +125,26 @@ static int pm8058_led_probe(struct platform_device *pdev)
                maxbright = 15; /* 4 bits */
        led->cdev.max_brightness = maxbright;
 
-       state = of_get_property(np, "default-state", NULL);
-       if (state) {
-               if (!strcmp(state, "keep")) {
-                       led->cdev.brightness = pm8058_led_get(&led->cdev);
-               } else if (!strcmp(state, "on")) {
-                       led->cdev.brightness = maxbright;
-                       pm8058_led_set(&led->cdev, maxbright);
-               } else {
-                       led->cdev.brightness = LED_OFF;
-                       pm8058_led_set(&led->cdev, LED_OFF);
-               }
+       init_data.fwnode = of_fwnode_handle(np);
+
+       state = led_init_default_state_get(init_data.fwnode);
+       switch (state) {
+       case LEDS_DEFSTATE_ON:
+               led->cdev.brightness = maxbright;
+               pm8058_led_set(&led->cdev, maxbright);
+               break;
+       case LEDS_DEFSTATE_KEEP:
+               led->cdev.brightness = pm8058_led_get(&led->cdev);
+               break;
+       default:
+               led->cdev.brightness = LED_OFF;
+               pm8058_led_set(&led->cdev, LED_OFF);
        }
 
        if (led->ledtype == PM8058_LED_TYPE_KEYPAD ||
            led->ledtype == PM8058_LED_TYPE_FLASH)
                led->cdev.flags = LED_CORE_SUSPENDRESUME;
 
-       init_data.fwnode = of_fwnode_handle(np);
-
        ret = devm_led_classdev_register_ext(dev, &led->cdev, &init_data);
        if (ret)
                dev_err(dev, "Failed to register LED for %pOF\n", np);
index 6832180c1c54fd2cede277d38cfff1efa3d8f1e1..29194cc382afbc58315e9be435dc906d35fcf822 100644 (file)
@@ -138,9 +138,9 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv)
        struct led_pwm led;
        int ret;
 
-       memset(&led, 0, sizeof(led));
-
        device_for_each_child_node(dev, fwnode) {
+               memset(&led, 0, sizeof(led));
+
                ret = fwnode_property_read_string(fwnode, "label", &led.name);
                if (ret && is_of_node(fwnode))
                        led.name = to_of_node(fwnode)->name;
index 7eddb8ecb44ec4d5c64361e42471c6d6ce830405..e38abb5e60c1bbbf9d0f2804179f290435628dc0 100644 (file)
@@ -61,7 +61,8 @@ static int syscon_led_probe(struct platform_device *pdev)
        struct device *parent;
        struct regmap *map;
        struct syscon_led *sled;
-       const char *state;
+       enum led_default_state state;
+       u32 value;
        int ret;
 
        parent = dev->parent;
@@ -86,34 +87,30 @@ static int syscon_led_probe(struct platform_device *pdev)
        if (of_property_read_u32(np, "mask", &sled->mask))
                return -EINVAL;
 
-       state = of_get_property(np, "default-state", NULL);
-       if (state) {
-               if (!strcmp(state, "keep")) {
-                       u32 val;
-
-                       ret = regmap_read(map, sled->offset, &val);
-                       if (ret < 0)
-                               return ret;
-                       sled->state = !!(val & sled->mask);
-               } else if (!strcmp(state, "on")) {
-                       sled->state = true;
-                       ret = regmap_update_bits(map, sled->offset,
-                                                sled->mask,
-                                                sled->mask);
-                       if (ret < 0)
-                               return ret;
-               } else {
-                       sled->state = false;
-                       ret = regmap_update_bits(map, sled->offset,
-                                                sled->mask, 0);
-                       if (ret < 0)
-                               return ret;
-               }
+       init_data.fwnode = of_fwnode_handle(np);
+
+       state = led_init_default_state_get(init_data.fwnode);
+       switch (state) {
+       case LEDS_DEFSTATE_ON:
+               ret = regmap_update_bits(map, sled->offset, sled->mask, sled->mask);
+               if (ret < 0)
+                       return ret;
+               sled->state = true;
+               break;
+       case LEDS_DEFSTATE_KEEP:
+               ret = regmap_read(map, sled->offset, &value);
+               if (ret < 0)
+                       return ret;
+               sled->state = !!(value & sled->mask);
+               break;
+       default:
+               ret = regmap_update_bits(map, sled->offset, sled->mask, 0);
+               if (ret < 0)
+                       return ret;
+               sled->state = false;
        }
        sled->cdev.brightness_set = syscon_led_set;
 
-       init_data.fwnode = of_fwnode_handle(np);
-
        ret = devm_led_classdev_register_ext(dev, &sled->cdev, &init_data);
        if (ret < 0)
                return ret;
index 161bef65c6b7b88f19b5f2340a0a34cca336c4c7..07dd12686a6962a5feb497bdf60ef3e41b01f7df 100644 (file)
@@ -695,8 +695,7 @@ tca6507_led_dt_init(struct device *dev)
                                            &led.default_trigger);
 
                led.flags = 0;
-               if (fwnode_property_match_string(child, "compatible",
-                                                "gpio") >= 0)
+               if (fwnode_device_is_compatible(child, "gpio"))
                        led.flags |= TCA6507_MAKE_GPIO;
 
                ret = fwnode_property_read_u32(child, "reg", &reg);
@@ -728,8 +727,7 @@ static const struct of_device_id __maybe_unused of_tca6507_leds_match[] = {
 };
 MODULE_DEVICE_TABLE(of, of_tca6507_leds_match);
 
-static int tca6507_probe(struct i2c_client *client,
-               const struct i2c_device_id *id)
+static int tca6507_probe(struct i2c_client *client)
 {
        struct device *dev = &client->dev;
        struct i2c_adapter *adapter;
@@ -809,7 +807,7 @@ static struct i2c_driver tca6507_driver = {
                .name    = "leds-tca6507",
                .of_match_table = of_match_ptr(of_tca6507_leds_match),
        },
-       .probe    = tca6507_probe,
+       .probe_new = tca6507_probe,
        .remove   = tca6507_remove,
        .id_table = tca6507_id,
 };
index cb7bd1353f9f01e4bf67757ab89f70e19f90d471..ec25e0c16bea3a942aeb7ccf09c020b16c5e0fd7 100644 (file)
@@ -145,8 +145,7 @@ static const struct of_device_id of_tlc591xx_leds_match[] = {
 MODULE_DEVICE_TABLE(of, of_tlc591xx_leds_match);
 
 static int
-tlc591xx_probe(struct i2c_client *client,
-              const struct i2c_device_id *id)
+tlc591xx_probe(struct i2c_client *client)
 {
        struct device_node *np, *child;
        struct device *dev = &client->dev;
@@ -231,7 +230,7 @@ static struct i2c_driver tlc591xx_driver = {
                .name = "tlc591xx",
                .of_match_table = of_match_ptr(of_tlc591xx_leds_match),
        },
-       .probe = tlc591xx_probe,
+       .probe_new = tlc591xx_probe,
        .id_table = tlc591xx_id,
 };
 
index c7c9851c894a9ddd83b7aa022431c6ea8dac8c64..013f551b32b27c83cf0822b775c0fd4bca22dc94 100644 (file)
@@ -201,8 +201,7 @@ static struct attribute *omnia_led_controller_attrs[] = {
 };
 ATTRIBUTE_GROUPS(omnia_led_controller);
 
-static int omnia_leds_probe(struct i2c_client *client,
-                           const struct i2c_device_id *id)
+static int omnia_leds_probe(struct i2c_client *client)
 {
        struct device *dev = &client->dev;
        struct device_node *np = dev_of_node(dev), *child;
@@ -272,7 +271,7 @@ static const struct i2c_device_id omnia_id[] = {
 MODULE_DEVICE_TABLE(i2c, omnia_id);
 
 static struct i2c_driver omnia_leds_driver = {
-       .probe          = omnia_leds_probe,
+       .probe_new      = omnia_leds_probe,
        .remove         = omnia_leds_remove,
        .id_table       = omnia_id,
        .driver         = {
index aa64757a4d894abf0936612034acab5b01e2cab8..345062ccabdaa7a5fa7b2a97774514f7b8840631 100644 (file)
@@ -27,7 +27,6 @@ ssize_t led_trigger_read(struct file *filp, struct kobject *kobj,
 ssize_t led_trigger_write(struct file *filp, struct kobject *kobj,
                        struct bin_attribute *bin_attr, char *buf,
                        loff_t pos, size_t count);
-enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode);
 
 extern struct rw_semaphore leds_list_lock;
 extern struct list_head leds_list;
index 07f0d79d604d4f5571432ddc72e08b3011cc2bb5..e8d329b5a68c313704be3f9ffd0644616c8bb254 100644 (file)
@@ -77,6 +77,8 @@ static int simatic_ipc_leds_gpio_probe(struct platform_device *pdev)
 
        switch (plat->devmode) {
        case SIMATIC_IPC_DEVICE_127E:
+               if (!IS_ENABLED(CONFIG_PINCTRL_BROXTON))
+                       return -ENODEV;
                simatic_ipc_led_gpio_table = &simatic_ipc_led_gpio_table_127e;
                break;
        case SIMATIC_IPC_DEVICE_227G:
index 0741910785bbb2f56f4ab38d1fb43479323df3db..0b7dfbd042733921e88c2c5d2be74199e927078b 100644 (file)
@@ -16,7 +16,6 @@
 DEFINE_LED_TRIGGER(ledtrig_disk);
 DEFINE_LED_TRIGGER(ledtrig_disk_read);
 DEFINE_LED_TRIGGER(ledtrig_disk_write);
-DEFINE_LED_TRIGGER(ledtrig_ide);
 
 void ledtrig_disk_activity(bool write)
 {
@@ -24,8 +23,6 @@ void ledtrig_disk_activity(bool write)
 
        led_trigger_blink_oneshot(ledtrig_disk,
                                  &blink_delay, &blink_delay, 0);
-       led_trigger_blink_oneshot(ledtrig_ide,
-                                 &blink_delay, &blink_delay, 0);
        if (write)
                led_trigger_blink_oneshot(ledtrig_disk_write,
                                          &blink_delay, &blink_delay, 0);
@@ -40,7 +37,6 @@ static int __init ledtrig_disk_init(void)
        led_trigger_register_simple("disk-activity", &ledtrig_disk);
        led_trigger_register_simple("disk-read", &ledtrig_disk_read);
        led_trigger_register_simple("disk-write", &ledtrig_disk_write);
-       led_trigger_register_simple("ide-disk", &ledtrig_ide);
 
        return 0;
 }
index 31cb74b90ffcde9b2a0e2fc7b637dc0ede9efc74..d71201a968b6601d825634e77de4a327fff8c2f2 100644 (file)
 
 #include <dt-bindings/leds/common.h>
 #include <linux/device.h>
-#include <linux/kernfs.h>
-#include <linux/list.h>
 #include <linux/mutex.h>
 #include <linux/rwsem.h>
 #include <linux/spinlock.h>
 #include <linux/timer.h>
+#include <linux/types.h>
 #include <linux/workqueue.h>
 
-struct device;
-struct led_pattern;
+struct attribute_group;
 struct device_node;
+struct fwnode_handle;
+struct gpio_desc;
+struct kernfs_node;
+struct led_pattern;
+struct platform_device;
+
 /*
  * LED Core
  */
@@ -78,6 +82,8 @@ struct led_init_data {
        bool devname_mandatory;
 };
 
+enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode);
+
 struct led_hw_trigger_type {
        int dummy;
 };
@@ -529,7 +535,6 @@ struct led_properties {
        const char      *label;
 };
 
-struct gpio_desc;
 typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state,
                                unsigned long *delay_on,
                                unsigned long *delay_off);