diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 49d99cb084db..bdf16180f5ff 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -199,6 +199,7 @@ config LEDS_LM3530 config LEDS_LM3532 tristate "LCD Backlight driver for LM3532" + select REGMAP_I2C depends on LEDS_CLASS depends on I2C help @@ -616,7 +617,6 @@ config LEDS_LT3593 tristate "LED driver for LT3593 controllers" depends on LEDS_CLASS depends on GPIOLIB || COMPILE_TEST - depends on OF help This option enables support for LEDs driven by a Linear Technology LT3593 controller. This controller uses a special one-wire pulse diff --git a/drivers/leds/blink/leds-lgm-sso.c b/drivers/leds/blink/leds-lgm-sso.c index 6a63846d10b5..7eb2f44f16be 100644 --- a/drivers/leds/blink/leds-lgm-sso.c +++ b/drivers/leds/blink/leds-lgm-sso.c @@ -7,7 +7,8 @@ #include #include -#include +#include +#include #include #include #include @@ -132,8 +133,7 @@ struct sso_led_priv { struct regmap *mmap; struct device *dev; struct platform_device *pdev; - struct clk *gclk; - struct clk *fpid_clk; + struct clk_bulk_data clocks[2]; u32 fpid_clkrate; u32 gptc_clkrate; u32 freq[MAX_FREQ_RANK]; @@ -259,7 +259,7 @@ static void sso_led_brightness_set(struct led_classdev *led_cdev, 1 << desc->pin); } - if (!desc->hw_trig && led->gpiod) + if (!desc->hw_trig) gpiod_set_value(led->gpiod, val); } @@ -423,7 +423,7 @@ static void sso_gpio_free(struct gpio_chip *chip, unsigned int offset) static int sso_gpio_get_dir(struct gpio_chip *chip, unsigned int offset) { - return GPIOF_DIR_OUT; + return GPIO_LINE_DIRECTION_OUT; } static int @@ -763,12 +763,11 @@ static int sso_probe_gpios(struct sso_led_priv *priv) return sso_gpio_gc_init(dev, priv); } -static void sso_clk_disable(void *data) +static void sso_clock_disable_unprepare(void *data) { struct sso_led_priv *priv = data; - clk_disable_unprepare(priv->fpid_clk); - clk_disable_unprepare(priv->gclk); + clk_bulk_disable_unprepare(ARRAY_SIZE(priv->clocks), priv->clocks); } static int intel_sso_led_probe(struct platform_device *pdev) @@ -785,36 +784,30 @@ static int intel_sso_led_probe(struct platform_device *pdev) priv->dev = dev; /* gate clock */ - priv->gclk = devm_clk_get(dev, "sso"); - if (IS_ERR(priv->gclk)) { - dev_err(dev, "get sso gate clock failed!\n"); - return PTR_ERR(priv->gclk); - } + priv->clocks[0].id = "sso"; - ret = clk_prepare_enable(priv->gclk); + /* fpid clock */ + priv->clocks[1].id = "fpid"; + + ret = devm_clk_bulk_get(dev, ARRAY_SIZE(priv->clocks), priv->clocks); if (ret) { - dev_err(dev, "Failed to prepare/enable sso gate clock!\n"); + dev_err(dev, "Getting clocks failed!\n"); return ret; } - priv->fpid_clk = devm_clk_get(dev, "fpid"); - if (IS_ERR(priv->fpid_clk)) { - dev_err(dev, "Failed to get fpid clock!\n"); - return PTR_ERR(priv->fpid_clk); - } - - ret = clk_prepare_enable(priv->fpid_clk); + ret = clk_bulk_prepare_enable(ARRAY_SIZE(priv->clocks), priv->clocks); if (ret) { - dev_err(dev, "Failed to prepare/enable fpid clock!\n"); + dev_err(dev, "Failed to prepare and enable clocks!\n"); return ret; } - priv->fpid_clkrate = clk_get_rate(priv->fpid_clk); - ret = devm_add_action_or_reset(dev, sso_clk_disable, priv); - if (ret) { - dev_err(dev, "Failed to devm_add_action_or_reset, %d\n", ret); + ret = devm_add_action_or_reset(dev, sso_clock_disable_unprepare, priv); + if (ret) return ret; - } + + priv->fpid_clkrate = clk_get_rate(priv->clocks[1].clk); + + priv->mmap = syscon_node_to_regmap(dev->of_node); priv->mmap = syscon_node_to_regmap(dev->of_node); if (IS_ERR(priv->mmap)) { @@ -859,8 +852,6 @@ static int intel_sso_led_remove(struct platform_device *pdev) sso_led_shutdown(led); } - clk_disable_unprepare(priv->fpid_clk); - clk_disable_unprepare(priv->gclk); regmap_exit(priv->mmap); return 0; @@ -878,7 +869,7 @@ static struct platform_driver intel_sso_led_driver = { .remove = intel_sso_led_remove, .driver = { .name = "lgm-ssoled", - .of_match_table = of_match_ptr(of_sso_led_match), + .of_match_table = of_sso_led_match, }, }; diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 2e495ff67856..f704391d57a8 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -285,10 +285,6 @@ struct led_classdev *__must_check devm_of_led_get(struct device *dev, if (!dev) return ERR_PTR(-EINVAL); - /* Not using device tree? */ - if (!IS_ENABLED(CONFIG_OF) || !dev->of_node) - return ERR_PTR(-ENOTSUPP); - led = of_led_get(dev->of_node, index); if (IS_ERR(led)) return led; @@ -513,7 +509,7 @@ static int devm_led_classdev_match(struct device *dev, void *res, void *data) /** * devm_led_classdev_unregister() - resource managed led_classdev_unregister() - * @parent: The device to unregister. + * @dev: The device to unregister. * @led_cdev: the led_classdev structure for this device. */ void devm_led_classdev_unregister(struct device *dev, diff --git a/drivers/leds/leds-as3645a.c b/drivers/leds/leds-as3645a.c index e8922fa03379..aa3f82be0a9c 100644 --- a/drivers/leds/leds-as3645a.c +++ b/drivers/leds/leds-as3645a.c @@ -185,7 +185,7 @@ static int as3645a_read(struct as3645a *flash, u8 addr) */ /** - * as3645a_set_config - Set flash configuration registers + * as3645a_set_current - Set flash configuration registers * @flash: The flash * * Configure the hardware with flash, assist and indicator currents, as well as @@ -545,6 +545,7 @@ static int as3645a_parse_node(struct as3645a *flash, if (!flash->indicator_node) { dev_warn(&flash->client->dev, "can't find indicator node\n"); + rval = -ENODEV; goto out_err; } diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c index 226d17d253ed..2d4d87957a30 100644 --- a/drivers/leds/leds-bcm6328.c +++ b/drivers/leds/leds-bcm6328.c @@ -93,7 +93,7 @@ static unsigned long bcm6328_led_read(void __iomem *reg) #endif } -/** +/* * LEDMode 64 bits / 24 LEDs * bits [31:0] -> LEDs 8-23 * bits [47:32] -> LEDs 0-7 diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c index b4e1fdff4186..bd7d0d5cf3b6 100644 --- a/drivers/leds/leds-blinkm.c +++ b/drivers/leds/leds-blinkm.c @@ -480,9 +480,8 @@ static int blinkm_led_blue_set(struct led_classdev *led_cdev, static void blinkm_init_hw(struct i2c_client *client) { - int ret; - ret = blinkm_transfer_hw(client, BLM_STOP_SCRIPT); - ret = blinkm_transfer_hw(client, BLM_GO_RGB); + blinkm_transfer_hw(client, BLM_STOP_SCRIPT); + blinkm_transfer_hw(client, BLM_GO_RGB); } static int blinkm_test_run(struct i2c_client *client) diff --git a/drivers/leds/leds-el15203000.c b/drivers/leds/leds-el15203000.c index 6ca47f2a2004..76b455e87574 100644 --- a/drivers/leds/leds-el15203000.c +++ b/drivers/leds/leds-el15203000.c @@ -68,8 +68,8 @@ enum el15203000_command { }; struct el15203000_led { - struct el15203000 *priv; struct led_classdev ldev; + struct el15203000 *priv; u32 reg; }; @@ -82,6 +82,8 @@ struct el15203000 { struct el15203000_led leds[]; }; +#define to_el15203000_led(d) container_of(d, struct el15203000_led, ldev) + static int el15203000_cmd(struct el15203000_led *led, u8 brightness) { int ret; @@ -128,9 +130,7 @@ static int el15203000_cmd(struct el15203000_led *led, u8 brightness) static int el15203000_set_blocking(struct led_classdev *ldev, enum led_brightness brightness) { - struct el15203000_led *led = container_of(ldev, - struct el15203000_led, - ldev); + struct el15203000_led *led = to_el15203000_led(ldev); return el15203000_cmd(led, brightness == LED_OFF ? EL_OFF : EL_ON); } @@ -139,9 +139,7 @@ static int el15203000_pattern_set_S(struct led_classdev *ldev, struct led_pattern *pattern, u32 len, int repeat) { - struct el15203000_led *led = container_of(ldev, - struct el15203000_led, - ldev); + struct el15203000_led *led = to_el15203000_led(ldev); if (repeat > 0 || len != 2 || pattern[0].delta_t != 4000 || pattern[0].brightness != 0 || @@ -192,10 +190,8 @@ static int el15203000_pattern_set_P(struct led_classdev *ldev, struct led_pattern *pattern, u32 len, int repeat) { + struct el15203000_led *led = to_el15203000_led(ldev); u8 cmd; - struct el15203000_led *led = container_of(ldev, - struct el15203000_led, - ldev); if (repeat > 0) return -EINVAL; @@ -232,9 +228,7 @@ static int el15203000_pattern_set_P(struct led_classdev *ldev, static int el15203000_pattern_clear(struct led_classdev *ldev) { - struct el15203000_led *led = container_of(ldev, - struct el15203000_led, - ldev); + struct el15203000_led *led = to_el15203000_led(ldev); return el15203000_cmd(led, EL_OFF); } @@ -251,16 +245,13 @@ static int el15203000_probe_dt(struct el15203000 *priv) ret = fwnode_property_read_u32(child, "reg", &led->reg); if (ret) { dev_err(priv->dev, "LED without ID number"); - fwnode_handle_put(child); - - break; + goto err_child_out; } if (led->reg > U8_MAX) { dev_err(priv->dev, "LED value %d is invalid", led->reg); - fwnode_handle_put(child); - - return -EINVAL; + ret = -EINVAL; + goto err_child_out; } led->priv = priv; @@ -282,14 +273,16 @@ static int el15203000_probe_dt(struct el15203000 *priv) dev_err(priv->dev, "failed to register LED device %s, err %d", led->ldev.name, ret); - fwnode_handle_put(child); - - break; + goto err_child_out; } led++; } + return 0; + +err_child_out: + fwnode_handle_put(child); return ret; } diff --git a/drivers/leds/leds-gpio-register.c b/drivers/leds/leds-gpio-register.c index b9187e71e0cf..de3f12c2b80d 100644 --- a/drivers/leds/leds-gpio-register.c +++ b/drivers/leds/leds-gpio-register.c @@ -11,6 +11,7 @@ /** * gpio_led_register_device - register a gpio-led device * @pdata: the platform data used for the new device + * @id: platform ID * * Makes a copy of pdata and pdata->leds and registers a new leds-gpio device * with the result. This allows to have pdata and pdata-leds in .init.rodata diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c index 2180255ad339..3b55af9a8c58 100644 --- a/drivers/leds/leds-is31fl32xx.c +++ b/drivers/leds/leds-is31fl32xx.c @@ -58,7 +58,8 @@ struct is31fl32xx_priv { * @pwm_registers_reversed: : true if PWM registers count down instead of up * @led_control_register_base : address of first LED control register (optional) * @enable_bits_per_led_control_register: number of LEDs enable bits in each - * @reset_func: : pointer to reset function + * @reset_func : pointer to reset function + * @sw_shutdown_func : pointer to software shutdown function * * For all optional register addresses, the sentinel value %IS31FL32XX_REG_NONE * indicates that this chip has no such register. diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c index 632f10db4b3f..f341da1503a4 100644 --- a/drivers/leds/leds-ktd2692.c +++ b/drivers/leds/leds-ktd2692.c @@ -256,6 +256,17 @@ static void ktd2692_setup(struct ktd2692_context *led) | KTD2692_REG_FLASH_CURRENT_BASE); } +static void regulator_disable_action(void *_data) +{ + struct device *dev = _data; + struct ktd2692_context *led = dev_get_drvdata(dev); + int ret; + + ret = regulator_disable(led->regulator); + if (ret) + dev_err(dev, "Failed to disable supply: %d\n", ret); +} + static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev, struct ktd2692_led_config_data *cfg) { @@ -286,8 +297,14 @@ static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev, if (led->regulator) { ret = regulator_enable(led->regulator); - if (ret) + if (ret) { dev_err(dev, "Failed to enable supply: %d\n", ret); + } else { + ret = devm_add_action_or_reset(dev, + regulator_disable_action, dev); + if (ret) + return ret; + } } child_node = of_get_next_available_child(np, NULL); @@ -377,17 +394,9 @@ static int ktd2692_probe(struct platform_device *pdev) static int ktd2692_remove(struct platform_device *pdev) { struct ktd2692_context *led = platform_get_drvdata(pdev); - int ret; led_classdev_flash_unregister(&led->fled_cdev); - if (led->regulator) { - ret = regulator_disable(led->regulator); - if (ret) - dev_err(&pdev->dev, - "Failed to disable supply: %d\n", ret); - } - mutex_destroy(&led->lock); return 0; diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c index 2db455efd4b1..e72393534b72 100644 --- a/drivers/leds/leds-lm3530.c +++ b/drivers/leds/leds-lm3530.c @@ -99,7 +99,7 @@ static struct lm3530_mode_map mode_map[] = { * @pdata: LM3530 platform data * @mode: mode of operation - manual, ALS, PWM * @regulator: regulator - * @brighness: previous brightness value + * @brightness: previous brightness value * @enable: regulator is enabled */ struct lm3530_data { diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c index 0bf25bdde02f..beb53040e09e 100644 --- a/drivers/leds/leds-lm3532.c +++ b/drivers/leds/leds-lm3532.c @@ -586,7 +586,6 @@ static int lm3532_parse_node(struct lm3532_data *priv) ret = fwnode_property_read_u32(child, "reg", &control_bank); if (ret) { dev_err(&priv->client->dev, "reg property missing\n"); - fwnode_handle_put(child); goto child_out; } @@ -601,7 +600,6 @@ static int lm3532_parse_node(struct lm3532_data *priv) &led->mode); if (ret) { dev_err(&priv->client->dev, "ti,led-mode property missing\n"); - fwnode_handle_put(child); goto child_out; } @@ -636,7 +634,6 @@ static int lm3532_parse_node(struct lm3532_data *priv) led->num_leds); if (ret) { dev_err(&priv->client->dev, "led-sources property missing\n"); - fwnode_handle_put(child); goto child_out; } @@ -647,7 +644,6 @@ static int lm3532_parse_node(struct lm3532_data *priv) if (ret) { dev_err(&priv->client->dev, "led register err: %d\n", ret); - fwnode_handle_put(child); goto child_out; } @@ -655,14 +651,15 @@ static int lm3532_parse_node(struct lm3532_data *priv) if (ret) { dev_err(&priv->client->dev, "register init err: %d\n", ret); - fwnode_handle_put(child); goto child_out; } i++; } + return 0; child_out: + fwnode_handle_put(child); return ret; } diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c index aadb03468a40..e009b6d17915 100644 --- a/drivers/leds/leds-lm36274.c +++ b/drivers/leds/leds-lm36274.c @@ -7,9 +7,10 @@ #include #include #include +#include #include -#include #include +#include #include #include @@ -127,6 +128,7 @@ static int lm36274_probe(struct platform_device *pdev) ret = lm36274_init(chip); if (ret) { + fwnode_handle_put(init_data.fwnode); dev_err(chip->dev, "Failed to init the device\n"); return ret; } diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c index e945de45388c..a02756d7ed8f 100644 --- a/drivers/leds/leds-lm3692x.c +++ b/drivers/leds/leds-lm3692x.c @@ -96,15 +96,15 @@ #define LM3692X_FAULT_FLAG_OPEN BIT(4) /** - * struct lm3692x_led - - * @lock - Lock for reading/writing the device - * @client - Pointer to the I2C client - * @led_dev - LED class device pointer - * @regmap - Devices register map - * @enable_gpio - VDDIO/EN gpio to enable communication interface - * @regulator - LED supply regulator pointer - * @led_enable - LED sync to be enabled - * @model_id - Current device model ID enumerated + * struct lm3692x_led + * @lock: Lock for reading/writing the device + * @client: Pointer to the I2C client + * @led_dev: LED class device pointer + * @regmap: Devices register map + * @enable_gpio: VDDIO/EN gpio to enable communication interface + * @regulator: LED supply regulator pointer + * @led_enable: LED sync to be enabled + * @model_id: Current device model ID enumerated */ struct lm3692x_led { struct mutex lock; @@ -435,6 +435,7 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) ret = fwnode_property_read_u32(child, "reg", &led->led_enable); if (ret) { + fwnode_handle_put(child); dev_err(&led->client->dev, "reg DT property missing\n"); return ret; } @@ -449,12 +450,11 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) ret = devm_led_classdev_register_ext(&led->client->dev, &led->led_dev, &init_data); - if (ret) { + if (ret) dev_err(&led->client->dev, "led register err: %d\n", ret); - return ret; - } - return 0; + fwnode_handle_put(init_data.fwnode); + return ret; } static int lm3692x_probe(struct i2c_client *client, diff --git a/drivers/leds/leds-lm3697.c b/drivers/leds/leds-lm3697.c index 7d216cdb91a8..970a4f34791b 100644 --- a/drivers/leds/leds-lm3697.c +++ b/drivers/leds/leds-lm3697.c @@ -47,6 +47,8 @@ * @lmu_data: Register and setting values for common code * @control_bank: Control bank the LED is associated to. 0 is control bank A * 1 is control bank B + * @enabled: LED brightness level (or LED_OFF) + * @num_leds: Number of LEDs available */ struct lm3697_led { u32 hvled_strings[LM3697_MAX_LED_STRINGS]; @@ -68,6 +70,8 @@ struct lm3697_led { * @dev: Pointer to the devices device struct * @lock: Lock for reading/writing the device * @leds: Array of LED strings + * @bank_cfg: OUTPUT_CONFIG register values + * @num_banks: Number of control banks */ struct lm3697 { struct gpio_desc *enable_gpio; @@ -203,11 +207,9 @@ static int lm3697_probe_dt(struct lm3697 *priv) priv->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(priv->enable_gpio)) { - ret = PTR_ERR(priv->enable_gpio); - dev_err(dev, "Failed to get enable gpio: %d\n", ret); - return ret; - } + if (IS_ERR(priv->enable_gpio)) + return dev_err_probe(dev, PTR_ERR(priv->enable_gpio), + "Failed to get enable GPIO\n"); priv->regulator = devm_regulator_get(dev, "vled"); if (IS_ERR(priv->regulator)) diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c index 838e6f19d37e..437c711b2a27 100644 --- a/drivers/leds/leds-lp3944.c +++ b/drivers/leds/leds-lp3944.c @@ -92,7 +92,7 @@ static int lp3944_reg_write(struct i2c_client *client, u8 reg, u8 value) } /** - * Set the period for DIM status + * lp3944_dim_set_period() - Set the period for DIM status * * @client: the i2c client * @dim: either LP3944_DIM0 or LP3944_DIM1 @@ -123,7 +123,7 @@ static int lp3944_dim_set_period(struct i2c_client *client, u8 dim, u16 period) } /** - * Set the duty cycle for DIM status + * lp3944_dim_set_dutycycle - Set the duty cycle for DIM status * * @client: the i2c client * @dim: either LP3944_DIM0 or LP3944_DIM1 @@ -155,7 +155,7 @@ static int lp3944_dim_set_dutycycle(struct i2c_client *client, u8 dim, } /** - * Set the led status + * lp3944_led_set() - Set the led status * * @led: a lp3944_led_data structure * @status: one of LP3944_LED_STATUS_OFF diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 06230614fdc5..401df1e2e05d 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -490,6 +490,7 @@ static int lp50xx_probe_dt(struct lp50xx *priv) ret = fwnode_property_read_u32(led_node, "color", &color_id); if (ret) { + fwnode_handle_put(led_node); dev_err(priv->dev, "Cannot read color\n"); goto child_out; } @@ -512,7 +513,6 @@ static int lp50xx_probe_dt(struct lp50xx *priv) goto child_out; } i++; - fwnode_handle_put(child); } return 0; diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 81de1346bf5d..d1657c46ee2f 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -694,7 +694,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, of_property_read_u8(np, "clock-mode", &pdata->clock_mode); pdata->enable_gpiod = devm_gpiod_get_optional(dev, "enable", - GPIOD_ASIS); + GPIOD_OUT_LOW); if (IS_ERR(pdata->enable_gpiod)) return ERR_CAST(pdata->enable_gpiod); diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c index f0533a337bc1..3c693d5e3b44 100644 --- a/drivers/leds/leds-lp8860.c +++ b/drivers/leds/leds-lp8860.c @@ -85,14 +85,14 @@ #define LP8860_NAME "lp8860" /** - * struct lp8860_led - - * @lock - Lock for reading/writing the device - * @client - Pointer to the I2C client - * @led_dev - led class device pointer - * @regmap - Devices register map - * @eeprom_regmap - EEPROM register map - * @enable_gpio - VDDIO/EN gpio to enable communication interface - * @regulator - LED supply regulator pointer + * struct lp8860_led + * @lock: Lock for reading/writing the device + * @client: Pointer to the I2C client + * @led_dev: led class device pointer + * @regmap: Devices register map + * @eeprom_regmap: EEPROM register map + * @enable_gpio: VDDIO/EN gpio to enable communication interface + * @regulator: LED supply regulator pointer */ struct lp8860_led { struct mutex lock; diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c index 68e06434ac08..3bb52d3165d9 100644 --- a/drivers/leds/leds-lt3593.c +++ b/drivers/leds/leds-lt3593.c @@ -7,8 +7,9 @@ #include #include #include +#include #include -#include +#include #define LED_LT3593_NAME "lt3593" @@ -68,9 +69,6 @@ static int lt3593_led_probe(struct platform_device *pdev) struct led_init_data init_data = {}; const char *tmp; - if (!dev_of_node(dev)) - return -ENODEV; - led_data = devm_kzalloc(dev, sizeof(*led_data), GFP_KERNEL); if (!led_data) return -ENOMEM; @@ -119,7 +117,7 @@ static struct platform_driver lt3593_led_driver = { .probe = lt3593_led_probe, .driver = { .name = "leds-lt3593", - .of_match_table = of_match_ptr(of_lt3593_leds_match), + .of_match_table = of_lt3593_leds_match, }, }; diff --git a/drivers/leds/leds-mlxcpld.c b/drivers/leds/leds-mlxcpld.c index f4721f8065f0..1355c84a2919 100644 --- a/drivers/leds/leds-mlxcpld.c +++ b/drivers/leds/leds-mlxcpld.c @@ -64,10 +64,10 @@ #define MLXCPLD_LED_BLINK_6HZ 83 /* ~83 msec off/on */ /** - * mlxcpld_param - LED access parameters: - * @offset - offset for LED access in CPLD device - * @mask - mask for LED access in CPLD device - * @base_color - base color code for LED + * struct mlxcpld_param - LED access parameters: + * @offset: offset for LED access in CPLD device + * @mask: mask for LED access in CPLD device + * @base_color: base color code for LED **/ struct mlxcpld_param { u8 offset; @@ -76,9 +76,9 @@ struct mlxcpld_param { }; /** - * mlxcpld_led_priv - LED private data: - * @cled - LED class device instance - * @param - LED CPLD access parameters + * struct mlxcpld_led_priv - LED private data: + * @cled: LED class device instance + * @param: LED CPLD access parameters **/ struct mlxcpld_led_priv { struct led_classdev cdev; @@ -88,12 +88,12 @@ struct mlxcpld_led_priv { #define cdev_to_priv(c) container_of(c, struct mlxcpld_led_priv, cdev) /** - * mlxcpld_led_profile - system LED profile (defined per system class): - * @offset - offset for LED access in CPLD device - * @mask - mask for LED access in CPLD device - * @base_color - base color code - * @brightness - default brightness setting (on/off) - * @name - LED name + * struct mlxcpld_led_profile - system LED profile (defined per system class): + * @offset: offset for LED access in CPLD device + * @mask: mask for LED access in CPLD device + * @base_color: base color code + * @brightness: default brightness setting (on/off) + * @name: LED name **/ struct mlxcpld_led_profile { u8 offset; @@ -104,12 +104,12 @@ struct mlxcpld_led_profile { }; /** - * mlxcpld_led_pdata - system LED private data - * @pdev - platform device pointer - * @pled - LED class device instance - * @profile - system configuration profile - * @num_led_instances - number of LED instances - * @lock - device access lock + * struct mlxcpld_led_pdata - system LED private data + * @pdev: platform device pointer + * @pled: LED class device instance + * @profile: system configuration profile + * @num_led_instances: number of LED instances + * @lock: device access lock **/ struct mlxcpld_led_pdata { struct platform_device *pdev; diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c index 82aea1cd0c12..b7855c93bd72 100644 --- a/drivers/leds/leds-mlxreg.c +++ b/drivers/leds/leds-mlxreg.c @@ -28,10 +28,11 @@ * struct mlxreg_led_data - led control data: * * @data: led configuration data; - * @led_classdev: led class data; + * @led_cdev: led class data; * @base_color: base led color (other colors have constant offset from base); * @led_data: led data; * @data_parent: pointer to private device control data of parent; + * @led_cdev_name: class device name */ struct mlxreg_led_data { struct mlxreg_core_data *data; diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index f53f9309ca6c..d71e9fa5c8de 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c @@ -101,7 +101,7 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv) { struct fwnode_handle *fwnode; struct led_pwm led; - int ret = 0; + int ret; memset(&led, 0, sizeof(led)); @@ -111,8 +111,8 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv) led.name = to_of_node(fwnode)->name; if (!led.name) { - fwnode_handle_put(fwnode); - return -EINVAL; + ret = EINVAL; + goto err_child_out; } led.active_low = fwnode_property_read_bool(fwnode, @@ -121,12 +121,14 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv) &led.max_brightness); ret = led_pwm_add(dev, priv, &led, fwnode); - if (ret) { - fwnode_handle_put(fwnode); - break; - } + if (ret) + goto err_child_out; } + return 0; + +err_child_out: + fwnode_handle_put(fwnode); return ret; } diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c index 5b9dfdf743ec..cb7bd1353f9f 100644 --- a/drivers/leds/leds-tlc591xx.c +++ b/drivers/leds/leds-tlc591xx.c @@ -148,16 +148,20 @@ static int tlc591xx_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct device_node *np = dev_of_node(&client->dev), *child; + struct device_node *np, *child; struct device *dev = &client->dev; const struct tlc591xx *tlc591xx; struct tlc591xx_priv *priv; int err, count, reg; - tlc591xx = device_get_match_data(dev); + np = dev_of_node(dev); if (!np) return -ENODEV; + tlc591xx = device_get_match_data(dev); + if (!tlc591xx) + return -ENODEV; + count = of_get_available_child_count(np); if (!count || count > tlc591xx->max_leds) return -EINVAL; diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c index 2f9a289ab245..1adfed1c0619 100644 --- a/drivers/leds/leds-turris-omnia.c +++ b/drivers/leds/leds-turris-omnia.c @@ -274,6 +274,7 @@ static const struct i2c_device_id omnia_id[] = { { "omnia", 0 }, { } }; +MODULE_DEVICE_TABLE(i2c, omnia_id); static struct i2c_driver omnia_leds_driver = { .probe = omnia_leds_probe, diff --git a/drivers/leds/trigger/ledtrig-cpu.c b/drivers/leds/trigger/ledtrig-cpu.c index fca62d503590..8af4f9bb9cde 100644 --- a/drivers/leds/trigger/ledtrig-cpu.c +++ b/drivers/leds/trigger/ledtrig-cpu.c @@ -43,7 +43,7 @@ static atomic_t num_active_cpus = ATOMIC_INIT(0); /** * ledtrig_cpu - emit a CPU event as a trigger - * @evt: CPU event to be emitted + * @ledevt: CPU event to be emitted * * Emit a CPU event on a CPU core, which will trigger a * bound LED to turn on or turn off.