Skip to content

Commit d884efd

Browse files
committed
Merge tag 'leds-next-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
Pull LED updates from Lee Jones: Core: - Implement fallback to software node name for LED names - Fix formatting issues in `led-core.c` reported by checkpatch.pl - Make `led_remove_lookup()` NULL-aware - Switch from `class_find_device_by_of_node()` to `class_find_device_by_fwnode()` - Drop the unneeded dependency on `OF_GPIO` from `LEDS_NETXBIG` in Kconfig Kinetic KTD2692: - Make the `ktd2692_timing` variable static to resolve a sparse warning LGM SSO: - Fix a typo in the `GET_SRC_OFFSET` macro - Remove a duplicate assignment of `priv->mmap` in `intel_sso_led_probe()` Multicolor: - Fix a signedness error by changing the `intensity_value` type to `unsigned int` Qualcomm LPG: - Prevent array overflow when selecting high-resolution values Spreadtrum SC2731: - Add a compatible string for the SC2730 PMIC LED controller TI LM3642: - Use `guard(mutex)` to simplify locking and avoid manual `mutex_unlock()` calls TI LP5569: - Use `sysfs_emit()` instead of `sprintf()` for sysfs outputs TI LP5860: - Add the `enable-gpios` property for the `VIO_EN` pin" TI LP8860: - Do not unconditionally program the EEPROM on probe - Hold the mutex lock for the entirety of the EEPROM programming process - Return directly from `lp8860_init()` instead of using empty `goto` statements - Use a single regmap table and an access table instead of separate maps for normal and EEPROM registers - Remove an unused read of the `STATUS` register during EEPROM programming TTY Trigger: - Prefer `IS_ERR_OR_NULL()` over manual NULL checks" * tag 'leds-next-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: leds: class: Make led_remove_lookup() NULL-aware leds: led-class: Switch to using class_find_device_by_fwnode() leds: Kconfig: Drop unneeded dependency on OF_GPIO leds: lm3642: Use guard to simplify locking leds: core: Fix formatting issues leds: core: Implement fallback to software node name for LED names leds: lgm-sso: Fix typo in macro for src offset dt-bindings: leds: lp5860: add enable-gpio leds: Prefer IS_ERR_OR_NULL over manual NULL check dt-bindings: leds: sc2731: Add compatible for SC2730 leds: lp8860: Do not always program EEPROM on probe leds: lp8860: Remove unused read of STATUS register leds: lp8860: Hold lock for all of EEPROM programming leds: lp8860: Return directly from lp8860_init leds: lp8860: Use a single regmap table leds: lgm-sso: Remove duplicate assignments for priv->mmap leds: qcom-lpg: Check for array overflow when selecting the high resolution leds: ktd2692: Make ktd2692_timing variable static leds: lp5569: Use sysfs_emit instead of sprintf() leds: multicolor: Change intensity_value to unsigned int
2 parents 25c456d + 7a43ccf commit d884efd

13 files changed

Lines changed: 98 additions & 94 deletions

File tree

Documentation/devicetree/bindings/leds/leds-lp5860.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ properties:
3333
'#size-cells':
3434
const: 0
3535

36+
enable-gpios:
37+
maxItems: 1
38+
description: |
39+
GPIO attached to the chip's enable pin (VIO_EN).
40+
3641
patternProperties:
3742
'^multi-led@[0-9a-f]+$':
3843
type: object
@@ -74,6 +79,7 @@ unevaluatedProperties: false
7479

7580
examples:
7681
- |
82+
#include <dt-bindings/gpio/gpio.h>
7783
#include <dt-bindings/leds/common.h>
7884
7985
spi {
@@ -83,6 +89,7 @@ examples:
8389
led-controller@0 {
8490
compatible = "ti,lp5860";
8591
reg = <0x0>;
92+
enable-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
8693
#address-cells = <1>;
8794
#size-cells = <0>;
8895

Documentation/devicetree/bindings/leds/sprd,sc2731-bltc.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ description: |
1818
1919
properties:
2020
compatible:
21-
const: sprd,sc2731-bltc
21+
oneOf:
22+
- items:
23+
- enum:
24+
- sprd,sc2730-bltc
25+
- const: sprd,sc2731-bltc
26+
- const: sprd,sc2731-bltc
2227

2328
reg:
2429
maxItems: 1

drivers/leds/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,6 @@ config LEDS_NETXBIG
765765
tristate "LED support for Big Network series LEDs"
766766
depends on LEDS_CLASS
767767
depends on MACH_KIRKWOOD || COMPILE_TEST
768-
depends on OF_GPIO
769768
default MACH_KIRKWOOD
770769
help
771770
This option enables support for LEDs found on the LaCie 2Big

drivers/leds/blink/leds-lgm-sso.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#define LED_BLINK_H8_0 0x0
2626
#define LED_BLINK_H8_1 0x4
2727
#define GET_FREQ_OFFSET(pin, src) (((pin) * 6) + ((src) * 2))
28-
#define GET_SRC_OFFSET(pinc) (((pin) * 6) + 4)
28+
#define GET_SRC_OFFSET(pin) (((pin) * 6) + 4)
2929

3030
#define DUTY_CYCLE(x) (0x8 + ((x) * 4))
3131
#define SSO_CON0 0x2B0
@@ -808,8 +808,6 @@ static int intel_sso_led_probe(struct platform_device *pdev)
808808

809809
priv->fpid_clkrate = clk_get_rate(priv->clocks[1].clk);
810810

811-
priv->mmap = syscon_node_to_regmap(dev->of_node);
812-
813811
priv->mmap = syscon_node_to_regmap(dev->of_node);
814812
if (IS_ERR(priv->mmap)) {
815813
dev_err(dev, "Failed to map iomem!\n");

drivers/leds/flash/leds-ktd2692.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct ktd2692_led_config_data {
5959
enum led_brightness max_brightness;
6060
};
6161

62-
const struct expresswire_timing ktd2692_timing = {
62+
static const struct expresswire_timing ktd2692_timing = {
6363
.poweroff_us = 700,
6464
.data_start_us = 10,
6565
.end_of_data_low_us = 10,

drivers/leds/led-class-multicolor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ static ssize_t multi_intensity_store(struct device *dev,
3434
struct led_classdev *led_cdev = dev_get_drvdata(dev);
3535
struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev);
3636
int nrchars, offset = 0;
37-
int intensity_value[LED_COLOR_ID_MAX];
37+
unsigned int intensity_value[LED_COLOR_ID_MAX];
3838
int i;
3939
ssize_t ret;
4040

4141
mutex_lock(&led_cdev->led_access);
4242

4343
for (i = 0; i < mcled_cdev->num_colors; i++) {
44-
ret = sscanf(buf + offset, "%i%n",
44+
ret = sscanf(buf + offset, "%u%n",
4545
&intensity_value[i], &nrchars);
4646
if (ret != 1) {
4747
ret = -EINVAL;

drivers/leds/led-class.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static struct led_classdev *of_led_get(struct device_node *np, int index,
273273
if (!led_node)
274274
return ERR_PTR(-ENOENT);
275275

276-
led_dev = class_find_device_by_of_node(&leds_class, led_node);
276+
led_dev = class_find_device_by_fwnode(&leds_class, of_fwnode_handle(led_node));
277277
of_node_put(led_node);
278278

279279
return led_module_get(led_dev);
@@ -421,6 +421,9 @@ EXPORT_SYMBOL_GPL(led_add_lookup);
421421
*/
422422
void led_remove_lookup(struct led_lookup_data *led_lookup)
423423
{
424+
if (!led_lookup)
425+
return;
426+
424427
mutex_lock(&leds_lookup_lock);
425428
list_del(&led_lookup->list);
426429
mutex_unlock(&leds_lookup_lock);

drivers/leds/led-core.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static void led_timer_function(struct timer_list *t)
8585
if (!brightness) {
8686
/* Time to switch the LED on. */
8787
if (test_and_clear_bit(LED_BLINK_BRIGHTNESS_CHANGE,
88-
&led_cdev->work_flags))
88+
&led_cdev->work_flags))
8989
brightness = led_cdev->new_blink_brightness;
9090
else
9191
brightness = led_cdev->blink_brightness;
@@ -217,10 +217,9 @@ static void led_set_software_blink(struct led_classdev *led_cdev,
217217
mod_timer(&led_cdev->blink_timer, jiffies + 1);
218218
}
219219

220-
221220
static void led_blink_setup(struct led_classdev *led_cdev,
222-
unsigned long *delay_on,
223-
unsigned long *delay_off)
221+
unsigned long *delay_on,
222+
unsigned long *delay_off)
224223
{
225224
if (!test_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags) &&
226225
led_cdev->blink_set &&
@@ -262,7 +261,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev,
262261
int invert)
263262
{
264263
if (test_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags) &&
265-
timer_pending(&led_cdev->blink_timer))
264+
timer_pending(&led_cdev->blink_timer))
266265
return;
267266

268267
set_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags);
@@ -347,9 +346,9 @@ void led_set_brightness_nopm(struct led_classdev *led_cdev, unsigned int value)
347346
/* Ensure delayed_set_value is seen before work_flags modification */
348347
smp_mb__before_atomic();
349348

350-
if (value)
349+
if (value) {
351350
set_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags);
352-
else {
351+
} else {
353352
clear_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags);
354353
clear_bit(LED_SET_BLINK, &led_cdev->work_flags);
355354
set_bit(LED_SET_BRIGHTNESS_OFF, &led_cdev->work_flags);
@@ -499,7 +498,6 @@ static void led_parse_fwnode_props(struct device *dev,
499498
props->color_present = true;
500499
}
501500

502-
503501
if (!fwnode_property_present(fwnode, "function"))
504502
return;
505503

@@ -581,8 +579,12 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,
581579
} else if (is_of_node(fwnode)) {
582580
n = snprintf(led_classdev_name, LED_MAX_NAME_SIZE, "%s",
583581
to_of_node(fwnode)->name);
584-
} else
582+
} else if (is_software_node(fwnode)) {
583+
n = snprintf(led_classdev_name, LED_MAX_NAME_SIZE, "%s",
584+
fwnode_get_name(fwnode));
585+
} else {
585586
return -EINVAL;
587+
}
586588

587589
if (n >= LED_MAX_NAME_SIZE)
588590
return -E2BIG;

drivers/leds/leds-lm3642.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
* Simple driver for Texas Instruments LM3642 LED Flash driver chip
44
* Copyright (C) 2012 Texas Instruments
55
*/
6-
#include <linux/module.h>
6+
#include <linux/cleanup.h>
77
#include <linux/delay.h>
8+
#include <linux/fs.h>
89
#include <linux/i2c.h>
910
#include <linux/leds.h>
10-
#include <linux/slab.h>
11+
#include <linux/module.h>
12+
#include <linux/platform_data/leds-lm3642.h>
1113
#include <linux/platform_device.h>
12-
#include <linux/fs.h>
1314
#include <linux/regmap.h>
14-
#include <linux/platform_data/leds-lm3642.h>
15+
#include <linux/slab.h>
1516

1617
#define REG_FILT_TIME (0x0)
1718
#define REG_IVFM_MODE (0x1)
@@ -202,10 +203,9 @@ static int lm3642_torch_brightness_set(struct led_classdev *cdev,
202203
container_of(cdev, struct lm3642_chip_data, cdev_torch);
203204
int ret;
204205

205-
mutex_lock(&chip->lock);
206+
guard(mutex)(&chip->lock);
206207
chip->br_torch = brightness;
207208
ret = lm3642_control(chip, chip->br_torch, MODES_TORCH);
208-
mutex_unlock(&chip->lock);
209209
return ret;
210210
}
211211

@@ -249,10 +249,9 @@ static int lm3642_strobe_brightness_set(struct led_classdev *cdev,
249249
container_of(cdev, struct lm3642_chip_data, cdev_flash);
250250
int ret;
251251

252-
mutex_lock(&chip->lock);
252+
guard(mutex)(&chip->lock);
253253
chip->br_flash = brightness;
254254
ret = lm3642_control(chip, chip->br_flash, MODES_FLASH);
255-
mutex_unlock(&chip->lock);
256255
return ret;
257256
}
258257

@@ -264,10 +263,9 @@ static int lm3642_indicator_brightness_set(struct led_classdev *cdev,
264263
container_of(cdev, struct lm3642_chip_data, cdev_indicator);
265264
int ret;
266265

267-
mutex_lock(&chip->lock);
266+
guard(mutex)(&chip->lock);
268267
chip->br_indicator = brightness;
269268
ret = lm3642_control(chip, chip->br_indicator, MODES_INDIC);
270-
mutex_unlock(&chip->lock);
271269
return ret;
272270
}
273271

drivers/leds/leds-lp5569.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,12 @@ static ssize_t lp5569_selftest(struct device *dev,
410410
/* Test LED Open */
411411
pos = lp5569_led_open_test(led, buf);
412412
if (pos < 0)
413-
return sprintf(buf, "FAIL\n");
413+
return sysfs_emit(buf, "FAIL\n");
414414

415415
/* Test LED Shorted */
416416
pos += lp5569_led_short_test(led, buf);
417417
if (pos < 0)
418-
return sprintf(buf, "FAIL\n");
418+
return sysfs_emit(buf, "FAIL\n");
419419

420420
for (i = 0; i < chip->pdata->num_channels; i++) {
421421
/* Restore current */

0 commit comments

Comments
 (0)