2022-01-22 01:58:55

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 00/31] leds: start removing obsolete/useless enum

This series of patches aims to replace the enum led_brightness in
include/linux/leds.h with unsigned int, as requested in the TODO file in
the drivers/leds folder. The first step is to change the old definitions
LED_OFF, LED_ON, LED_HALF and LED_FULL with the values.

This was done using find/grep/sed and later I did a review of the patch
to check that everything was right. A compilation using allmodconfig was
done to test that nothing broke.

I have more patches coming that will replace all the enum led_brightness
with unsigned int, as the led class now has support for max_brightness.

Please help review this patch.

Best regards,

Signed-off-by: Luiz Sampaio <[email protected]>

Luiz Sampaio (31):
gpu: nouveau: nouveau_led: changing LED_FULL to actual value
hid: changing LED_* from enum led_brightness to actual value
hwmon: pmbus: changing LED_* from enum led_brightness to actual value
iio: light: cm3605: changing LED_* from enum led_brightness to actual
value
input: keyboard: changing LED_* from enum led_brightness to actual
value
input: misc: changing LED_* from enum led_brightness to actual value
input: touchscreen: changing LED_* from enum led_brightness to actual
value
leds: changing LED_* from enum led_brightness to actual value
macintosh: changing LED_* from enum led_brightness to actual value
media: radio: changing LED_* from enum led_brightness to actual value
media: rc: changing LED_* from enum led_brightness to actual value
media: v4l2-core: changing LED_* from enum led_brightness to actual
value
mmc: changing LED_* from enum led_brightness to actual value
net: wireless: ath: changing LED_* from enum led_brightness to actual
value
net: wireless: atmel: changing LED_* from enum led_brightness to
actual value
net: broadcom: changing LED_* from enum led_brightness to actual value
net: intersil: changing LED_* from enum led_brightness to actual value
net: wireless: ralink: changing LED_* from enum led_brightness to
actual value
net: realtek: changing LED_* from enum led_brightness to actual value
platform: x86: changing LED_* from enum led_brightness to actual value
power: supply: changing LED_* from enum led_brightness to actual value
tty: vt: changing LED_* from enum led_brightness to actual value
usb: core: changing LED_* from enum led_brightness to actual value
video: backlight: changing LED_* from enum led_brightness to actual
value
include: linux: leds: changing LED_* from enum led_brightness to
actual value
net: bluetooth: changing LED_* from enum led_brightness to actual
value
net: mac80211 : changing LED_* from enum led_brightness to actual
value
net: netfilter: changing LED_* from enum led_brightness to actual
value
net: rfkill: changing LED_* from enum led_brightness to actual value
sound: core: changing LED_* from enum led_brightness to actual value
sound: soc: sof: changing LED_* from enum led_brightness to actual
value

drivers/gpu/drm/nouveau/nouveau_led.c | 4 +--
drivers/hid/hid-bigbenff.c | 10 +++----
drivers/hid/hid-elan.c | 2 +-
drivers/hid/hid-lenovo.c | 2 +-
drivers/hid/hid-lg4ff.c | 10 +++----
drivers/hid/hid-picolcd_leds.c | 6 ++--
drivers/hid/hid-playstation.c | 2 +-
drivers/hid/hid-sony.c | 4 +--
drivers/hid/hid-steelseries.c | 14 ++++-----
drivers/hid/hid-u2fzero.c | 4 +--
drivers/hid/hid-wiimote-modules.c | 4 +--
drivers/hid/wacom_sys.c | 16 +++++-----
drivers/hid/wacom_wac.c | 2 +-
drivers/hwmon/pmbus/ibm-cffps.c | 8 ++---
drivers/iio/light/cm3605.c | 10 +++----
drivers/input/keyboard/cap11xx.c | 2 +-
drivers/input/keyboard/qt2160.c | 6 ++--
drivers/input/keyboard/tm2-touchkey.c | 12 ++++----
drivers/input/misc/apanel.c | 4 +--
drivers/input/misc/ims-pcu.c | 2 +-
drivers/input/misc/wistron_btns.c | 8 ++---
drivers/input/touchscreen/stmfts.c | 4 +--
drivers/leds/blink/leds-lgm-sso.c | 8 ++---
drivers/leds/flash/leds-ktd2692.c | 4 +--
drivers/leds/flash/leds-lm3601x.c | 10 +++----
drivers/leds/flash/leds-mt6360.c | 10 +++----
drivers/leds/flash/leds-rt4505.c | 8 ++---
drivers/leds/flash/leds-rt8515.c | 4 +--
drivers/leds/flash/leds-sgm3140.c | 4 +--
drivers/leds/led-class.c | 6 ++--
drivers/leds/led-core.c | 8 ++---
drivers/leds/led-triggers.c | 4 +--
drivers/leds/leds-adp5520.c | 2 +-
drivers/leds/leds-an30259a.c | 8 ++---
drivers/leds/leds-apu.c | 6 ++--
drivers/leds/leds-ariel.c | 8 ++---
drivers/leds/leds-asic3.c | 2 +-
drivers/leds/leds-aw2013.c | 6 ++--
drivers/leds/leds-bcm6328.c | 14 ++++-----
drivers/leds/leds-bcm6358.c | 14 ++++-----
drivers/leds/leds-bd2802.c | 14 ++++-----
drivers/leds/leds-clevo-mail.c | 6 ++--
drivers/leds/leds-cobalt-qube.c | 2 +-
drivers/leds/leds-cpcap.c | 10 +++----
drivers/leds/leds-da903x.c | 4 +--
drivers/leds/leds-da9052.c | 4 +--
drivers/leds/leds-dac124s085.c | 2 +-
drivers/leds/leds-el15203000.c | 4 +--
drivers/leds/leds-gpio.c | 4 +--
drivers/leds/leds-is31fl319x.c | 2 +-
drivers/leds/leds-lm3530.c | 4 +--
drivers/leds/leds-lm3532.c | 8 ++---
drivers/leds/leds-lm3533.c | 4 +--
drivers/leds/leds-lm3692x.c | 2 +-
drivers/leds/leds-lm3697.c | 6 ++--
drivers/leds/leds-lp3952.c | 4 +--
drivers/leds/leds-lt3593.c | 2 +-
drivers/leds/leds-max77650.c | 4 +--
drivers/leds/leds-menf21bmc.c | 2 +-
drivers/leds/leds-mlxcpld.c | 22 +++++++-------
drivers/leds/leds-mlxreg.c | 10 +++----
drivers/leds/leds-mt6323.c | 2 +-
drivers/leds/leds-netxbig.c | 4 +--
drivers/leds/leds-nic78bx.c | 2 +-
drivers/leds/leds-ns2.c | 4 +--
drivers/leds/leds-ot200.c | 2 +-
drivers/leds/leds-pca9532.c | 6 ++--
drivers/leds/leds-pca955x.c | 30 +++++++++----------
drivers/leds/leds-pca963x.c | 4 +--
drivers/leds/leds-pm8058.c | 8 ++---
drivers/leds/leds-powernv.c | 12 ++++----
drivers/leds/leds-pwm.c | 2 +-
drivers/leds/leds-rb532.c | 2 +-
drivers/leds/leds-regulator.c | 2 +-
drivers/leds/leds-sc27xx-bltc.c | 6 ++--
drivers/leds/leds-spi-byte.c | 2 +-
drivers/leds/leds-ss4200.c | 12 ++++----
drivers/leds/leds-sunfire.c | 2 +-
drivers/leds/leds-syscon.c | 2 +-
drivers/leds/leds-tca6507.c | 8 ++---
drivers/leds/leds-wm831x-status.c | 8 ++---
drivers/leds/leds-wm8350.c | 8 ++---
drivers/leds/simple/simatic-ipc-leds.c | 10 +++----
drivers/leds/trigger/ledtrig-activity.c | 2 +-
drivers/leds/trigger/ledtrig-backlight.c | 4 +--
drivers/leds/trigger/ledtrig-camera.c | 4 +--
drivers/leds/trigger/ledtrig-cpu.c | 4 +--
drivers/leds/trigger/ledtrig-gpio.c | 4 +--
drivers/leds/trigger/ledtrig-heartbeat.c | 4 +--
drivers/leds/trigger/ledtrig-netdev.c | 6 ++--
drivers/leds/trigger/ledtrig-oneshot.c | 6 ++--
drivers/leds/trigger/ledtrig-panic.c | 2 +-
drivers/leds/trigger/ledtrig-pattern.c | 2 +-
drivers/leds/trigger/ledtrig-timer.c | 2 +-
drivers/leds/trigger/ledtrig-transient.c | 6 ++--
drivers/leds/trigger/ledtrig-tty.c | 4 +--
drivers/macintosh/via-pmu-led.c | 2 +-
drivers/media/radio/radio-shark.c | 6 ++--
drivers/media/radio/radio-shark2.c | 4 +--
drivers/media/rc/rc-main.c | 4 +--
drivers/media/rc/redrat3.c | 4 +--
drivers/media/rc/ttusbir.c | 4 +--
drivers/media/rc/winbond-cir.c | 6 ++--
.../media/v4l2-core/v4l2-flash-led-class.c | 4 +--
drivers/mmc/core/core.c | 4 +--
drivers/mmc/host/rtsx_usb_sdmmc.c | 4 +--
drivers/mmc/host/sdhci.c | 4 +--
drivers/net/wireless/ath/ath5k/led.c | 2 +-
drivers/net/wireless/ath/ath9k/gpio.c | 4 +--
drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | 4 +--
drivers/net/wireless/atmel/at76c50x-usb.c | 4 +--
drivers/net/wireless/broadcom/b43/leds.c | 2 +-
.../net/wireless/broadcom/b43legacy/leds.c | 2 +-
drivers/net/wireless/intersil/p54/led.c | 2 +-
.../net/wireless/ralink/rt2x00/rt2400pci.c | 2 +-
.../net/wireless/ralink/rt2x00/rt2500pci.c | 2 +-
.../net/wireless/ralink/rt2x00/rt2500usb.c | 2 +-
.../net/wireless/ralink/rt2x00/rt2800lib.c | 4 +--
.../net/wireless/ralink/rt2x00/rt2x00leds.c | 16 +++++-----
drivers/net/wireless/ralink/rt2x00/rt61pci.c | 4 +--
drivers/net/wireless/ralink/rt2x00/rt73usb.c | 4 +--
.../wireless/realtek/rtl818x/rtl8187/leds.c | 4 +--
drivers/platform/x86/acer-wmi.c | 6 ++--
drivers/platform/x86/asus-wireless.c | 6 ++--
drivers/platform/x86/dell/dell-laptop.c | 2 +-
drivers/platform/x86/dell/dell-wmi-led.c | 4 +--
drivers/platform/x86/fujitsu-laptop.c | 28 ++++++++---------
drivers/platform/x86/lg-laptop.c | 18 +++++------
drivers/platform/x86/system76_acpi.c | 4 +--
drivers/platform/x86/thinkpad_acpi.c | 14 ++++-----
drivers/platform/x86/topstar-laptop.c | 4 +--
drivers/platform/x86/toshiba_acpi.c | 24 +++++++--------
drivers/power/supply/power_supply_leds.c | 26 ++++++++--------
drivers/tty/vt/keyboard.c | 4 +--
drivers/usb/core/ledtrig-usbport.c | 6 ++--
drivers/video/backlight/adp8860_bl.c | 4 +--
drivers/video/backlight/adp8870_bl.c | 4 +--
drivers/video/backlight/led_bl.c | 2 +-
include/linux/leds.h | 2 +-
net/bluetooth/leds.c | 6 ++--
net/mac80211/led.c | 10 +++----
net/netfilter/xt_LED.c | 6 ++--
net/rfkill/core.c | 8 ++---
sound/core/control_led.c | 2 +-
sound/soc/sof/control.c | 4 +--
145 files changed, 434 insertions(+), 434 deletions(-)

--
2.34.1


2022-01-22 01:59:08

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 04/31] iio: light: cm3605: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/iio/light/cm3605.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c
index 50d34a98839c..f60db6cd9e6d 100644
--- a/drivers/iio/light/cm3605.c
+++ b/drivers/iio/light/cm3605.c
@@ -238,7 +238,7 @@ static int cm3605_probe(struct platform_device *pdev)

/* Just name the trigger the same as the driver */
led_trigger_register_simple("cm3605", &cm3605->led);
- led_trigger_event(cm3605->led, LED_FULL);
+ led_trigger_event(cm3605->led, 255);

indio_dev->info = &cm3605_info;
indio_dev->name = "cm3605";
@@ -255,7 +255,7 @@ static int cm3605_probe(struct platform_device *pdev)
return 0;

out_remove_trigger:
- led_trigger_event(cm3605->led, LED_OFF);
+ led_trigger_event(cm3605->led, 0);
led_trigger_unregister_simple(cm3605->led);
out_disable_aset:
gpiod_set_value_cansleep(cm3605->aset, 0);
@@ -269,7 +269,7 @@ static int cm3605_remove(struct platform_device *pdev)
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct cm3605 *cm3605 = iio_priv(indio_dev);

- led_trigger_event(cm3605->led, LED_OFF);
+ led_trigger_event(cm3605->led, 0);
led_trigger_unregister_simple(cm3605->led);
gpiod_set_value_cansleep(cm3605->aset, 0);
iio_device_unregister(indio_dev);
@@ -283,7 +283,7 @@ static int __maybe_unused cm3605_pm_suspend(struct device *dev)
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct cm3605 *cm3605 = iio_priv(indio_dev);

- led_trigger_event(cm3605->led, LED_OFF);
+ led_trigger_event(cm3605->led, 0);
regulator_disable(cm3605->vdd);

return 0;
@@ -298,7 +298,7 @@ static int __maybe_unused cm3605_pm_resume(struct device *dev)
ret = regulator_enable(cm3605->vdd);
if (ret)
dev_err(dev, "failed to enable regulator in resume path\n");
- led_trigger_event(cm3605->led, LED_FULL);
+ led_trigger_event(cm3605->led, 255);

return 0;
}
--
2.34.1

2022-01-22 01:59:08

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 03/31] hwmon: pmbus: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/hwmon/pmbus/ibm-cffps.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
index e3294a1a54bb..cc20a70c723b 100644
--- a/drivers/hwmon/pmbus/ibm-cffps.c
+++ b/drivers/hwmon/pmbus/ibm-cffps.c
@@ -382,10 +382,10 @@ static int ibm_cffps_led_brightness_set(struct led_classdev *led_cdev,
u8 next_led_state;
struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led);

- if (brightness == LED_OFF) {
+ if (brightness == 0) {
next_led_state = CFFPS_LED_OFF;
} else {
- brightness = LED_FULL;
+ brightness = 255;

if (psu->led_state != CFFPS_LED_BLINK)
next_led_state = CFFPS_LED_ON;
@@ -426,7 +426,7 @@ static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev,
return rc;

psu->led_state = CFFPS_LED_BLINK;
- led_cdev->brightness = LED_FULL;
+ led_cdev->brightness = 255;
*delay_on = CFFPS_BLINK_RATE_MS;
*delay_off = CFFPS_BLINK_RATE_MS;

@@ -442,7 +442,7 @@ static void ibm_cffps_create_led_class(struct ibm_cffps *psu)
snprintf(psu->led_name, sizeof(psu->led_name), "%s-%02x", client->name,
client->addr);
psu->led.name = psu->led_name;
- psu->led.max_brightness = LED_FULL;
+ psu->led.max_brightness = 255;
psu->led.brightness_set_blocking = ibm_cffps_led_brightness_set;
psu->led.blink_set = ibm_cffps_led_blink_set;

--
2.34.1

2022-01-22 01:59:12

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 06/31] input: misc: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/input/misc/apanel.c | 4 ++--
drivers/input/misc/ims-pcu.c | 2 +-
drivers/input/misc/wistron_btns.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c
index 7276657ad7ca..3b7e2f032f33 100644
--- a/drivers/input/misc/apanel.c
+++ b/drivers/input/misc/apanel.c
@@ -115,7 +115,7 @@ static int mail_led_set(struct led_classdev *led,
enum led_brightness value)
{
struct apanel *ap = container_of(led, struct apanel, mail_led);
- u16 led_bits = value != LED_OFF ? 0x8000 : 0x0000;
+ u16 led_bits = value != 0 ? 0x8000 : 0x0000;

return i2c_smbus_write_word_data(ap->client, 0x10, led_bits);
}
@@ -189,7 +189,7 @@ static void apanel_shutdown(struct i2c_client *client)
struct apanel *ap = i2c_get_clientdata(client);

if (device_chip[APANEL_DEV_LED] != CHIP_NONE)
- led_set_brightness(&ap->mail_led, LED_OFF);
+ led_set_brightness(&ap->mail_led, 0);
}

static const struct i2c_device_id apanel_id[] = {
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 6f38aa23a1ff..9665f371837d 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -986,7 +986,7 @@ ims_pcu_backlight_get_brightness(struct led_classdev *cdev)
"Failed to get current brightness, error: %d\n",
error);
/* Assume the LED is OFF */
- brightness = LED_OFF;
+ brightness = 0;
} else {
brightness =
get_unaligned_le16(&pcu->cmd_buf[IMS_PCU_DATA_OFFSET]);
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 80dfd72a02d3..cd290722a389 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -1039,14 +1039,14 @@ static bool bluetooth_enabled;
static void wistron_mail_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
- bios_set_state(MAIL_LED, (value != LED_OFF) ? 1 : 0);
+ bios_set_state(MAIL_LED, (value != 0) ? 1 : 0);
}

/* same as setting up wifi card, but for laptops on which the led is managed */
static void wistron_wifi_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
- bios_set_state(WIFI, (value != LED_OFF) ? 1 : 0);
+ bios_set_state(WIFI, (value != 0) ? 1 : 0);
}

static struct led_classdev wistron_mail_led = {
@@ -1064,7 +1064,7 @@ static void wistron_led_init(struct device *parent)
if (leds_present & FE_WIFI_LED) {
u16 wifi = bios_get_default_setting(WIFI);
if (wifi & 1) {
- wistron_wifi_led.brightness = (wifi & 2) ? LED_FULL : LED_OFF;
+ wistron_wifi_led.brightness = (wifi & 2) ? LED_FULL : 0;
if (led_classdev_register(parent, &wistron_wifi_led))
leds_present &= ~FE_WIFI_LED;
else
@@ -1076,7 +1076,7 @@ static void wistron_led_init(struct device *parent)

if (leds_present & FE_MAIL_LED) {
/* bios_get_default_setting(MAIL) always retuns 0, so just turn the led off */
- wistron_mail_led.brightness = LED_OFF;
+ wistron_mail_led.brightness = 0;
if (led_classdev_register(parent, &wistron_mail_led))
leds_present &= ~FE_MAIL_LED;
else
--
2.34.1

2022-01-22 01:59:24

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 08/31] leds: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/leds/blink/leds-lgm-sso.c | 8 +++----
drivers/leds/flash/leds-ktd2692.c | 4 ++--
drivers/leds/flash/leds-lm3601x.c | 10 ++++----
drivers/leds/flash/leds-mt6360.c | 10 ++++----
drivers/leds/flash/leds-rt4505.c | 8 +++----
drivers/leds/flash/leds-rt8515.c | 4 ++--
drivers/leds/flash/leds-sgm3140.c | 4 ++--
drivers/leds/led-class.c | 6 ++---
drivers/leds/led-core.c | 8 +++----
drivers/leds/led-triggers.c | 4 ++--
drivers/leds/leds-adp5520.c | 2 +-
drivers/leds/leds-an30259a.c | 8 +++----
drivers/leds/leds-apu.c | 6 ++---
drivers/leds/leds-ariel.c | 8 +++----
drivers/leds/leds-asic3.c | 2 +-
drivers/leds/leds-aw2013.c | 6 ++---
drivers/leds/leds-bcm6328.c | 14 +++++------
drivers/leds/leds-bcm6358.c | 14 +++++------
drivers/leds/leds-bd2802.c | 14 +++++------
drivers/leds/leds-clevo-mail.c | 6 ++---
drivers/leds/leds-cobalt-qube.c | 2 +-
drivers/leds/leds-cpcap.c | 10 ++++----
drivers/leds/leds-da903x.c | 4 ++--
drivers/leds/leds-da9052.c | 4 ++--
drivers/leds/leds-dac124s085.c | 2 +-
drivers/leds/leds-el15203000.c | 4 ++--
drivers/leds/leds-gpio.c | 4 ++--
drivers/leds/leds-is31fl319x.c | 2 +-
drivers/leds/leds-lm3530.c | 4 ++--
drivers/leds/leds-lm3532.c | 8 +++----
drivers/leds/leds-lm3533.c | 4 ++--
drivers/leds/leds-lm3692x.c | 2 +-
drivers/leds/leds-lm3697.c | 6 ++---
drivers/leds/leds-lp3952.c | 4 ++--
drivers/leds/leds-lt3593.c | 2 +-
drivers/leds/leds-max77650.c | 4 ++--
drivers/leds/leds-menf21bmc.c | 2 +-
drivers/leds/leds-mlxcpld.c | 22 ++++++++---------
drivers/leds/leds-mlxreg.c | 10 ++++----
drivers/leds/leds-mt6323.c | 2 +-
drivers/leds/leds-netxbig.c | 4 ++--
drivers/leds/leds-nic78bx.c | 2 +-
drivers/leds/leds-ns2.c | 4 ++--
drivers/leds/leds-ot200.c | 2 +-
drivers/leds/leds-pca9532.c | 6 ++---
drivers/leds/leds-pca955x.c | 30 ++++++++++++------------
drivers/leds/leds-pca963x.c | 4 ++--
drivers/leds/leds-pm8058.c | 8 +++----
drivers/leds/leds-powernv.c | 12 +++++-----
drivers/leds/leds-pwm.c | 2 +-
drivers/leds/leds-rb532.c | 2 +-
drivers/leds/leds-regulator.c | 2 +-
drivers/leds/leds-sc27xx-bltc.c | 6 ++---
drivers/leds/leds-spi-byte.c | 2 +-
drivers/leds/leds-ss4200.c | 12 +++++-----
drivers/leds/leds-sunfire.c | 2 +-
drivers/leds/leds-syscon.c | 2 +-
drivers/leds/leds-tca6507.c | 8 +++----
drivers/leds/leds-wm831x-status.c | 8 +++----
drivers/leds/leds-wm8350.c | 8 +++----
drivers/leds/simple/simatic-ipc-leds.c | 10 ++++----
drivers/leds/trigger/ledtrig-activity.c | 2 +-
drivers/leds/trigger/ledtrig-backlight.c | 4 ++--
drivers/leds/trigger/ledtrig-camera.c | 4 ++--
drivers/leds/trigger/ledtrig-cpu.c | 4 ++--
drivers/leds/trigger/ledtrig-gpio.c | 4 ++--
drivers/leds/trigger/ledtrig-heartbeat.c | 4 ++--
drivers/leds/trigger/ledtrig-netdev.c | 6 ++---
drivers/leds/trigger/ledtrig-oneshot.c | 6 ++---
drivers/leds/trigger/ledtrig-panic.c | 2 +-
drivers/leds/trigger/ledtrig-pattern.c | 2 +-
drivers/leds/trigger/ledtrig-timer.c | 2 +-
drivers/leds/trigger/ledtrig-transient.c | 6 ++---
drivers/leds/trigger/ledtrig-tty.c | 4 ++--
74 files changed, 217 insertions(+), 217 deletions(-)

diff --git a/drivers/leds/blink/leds-lgm-sso.c b/drivers/leds/blink/leds-lgm-sso.c
index 6f270c0272fb..26c17c64bd4f 100644
--- a/drivers/leds/blink/leds-lgm-sso.c
+++ b/drivers/leds/blink/leds-lgm-sso.c
@@ -51,7 +51,7 @@
#define SSO_LED_MAX_NUM SZ_32
#define MAX_FREQ_RANK 10
#define DEF_GPTC_CLK_RATE 200000000
-#define SSO_DEF_BRIGHTNESS LED_HALF
+#define SSO_DEF_BRIGHTNESS 127
#define DATA_CLK_EDGE 0 /* 0-rising, 1-falling */

static const u32 freq_div_tbl[] = {4000, 2000, 1000, 800};
@@ -244,7 +244,7 @@ static void sso_led_brightness_set(struct led_classdev *led_cdev,
desc->brightness = brightness;
regmap_write(priv->mmap, DUTY_CYCLE(desc->pin), brightness);

- if (brightness == LED_OFF)
+ if (brightness == 0)
val = 0;
else
val = 1;
@@ -360,7 +360,7 @@ static int sso_create_led(struct sso_led_priv *priv, struct sso_led *led,
led->cdev.brightness_set = sso_led_brightness_set;
led->cdev.brightness_get = sso_led_brightness_get;
led->cdev.brightness = desc->brightness;
- led->cdev.max_brightness = LED_FULL;
+ led->cdev.max_brightness = 255;

if (desc->retain_state_shutdown)
led->cdev.flags |= LED_RETAIN_AT_SHUTDOWN;
@@ -696,7 +696,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)

if (!fwnode_property_read_string(fwnode_child, "default-state", &tmp)) {
if (!strcmp(tmp, "on"))
- desc->brightness = LED_FULL;
+ desc->brightness = 255;
}

ret = sso_create_led(priv, led, fwnode_child);
diff --git a/drivers/leds/flash/leds-ktd2692.c b/drivers/leds/flash/leds-ktd2692.c
index ed1f20a58bf6..30937156d156 100644
--- a/drivers/leds/flash/leds-ktd2692.c
+++ b/drivers/leds/flash/leds-ktd2692.c
@@ -161,7 +161,7 @@ static int ktd2692_led_brightness_set(struct led_classdev *led_cdev,

mutex_lock(&led->lock);

- if (brightness == LED_OFF) {
+ if (brightness == 0) {
led->mode = KTD2692_MODE_DISABLE;
gpiod_direction_output(led->aux_gpio, KTD2692_LOW);
} else {
@@ -199,7 +199,7 @@ static int ktd2692_led_flash_strobe_set(struct led_classdev_flash *fled_cdev,

ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE);

- fled_cdev->led_cdev.brightness = LED_OFF;
+ fled_cdev->led_cdev.brightness = 0;
led->mode = KTD2692_MODE_DISABLE;

mutex_unlock(&led->lock);
diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c
index d0e1d4814042..0edcb56a8e8d 100644
--- a/drivers/leds/flash/leds-lm3601x.c
+++ b/drivers/leds/flash/leds-lm3601x.c
@@ -185,9 +185,9 @@ static int lm3601x_brightness_set(struct led_classdev *cdev,
else
led_mode_val = LM3601X_MODE_IR_DRV;

- if (brightness == LED_OFF) {
+ if (brightness == 0) {
ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
- led_mode_val, LED_OFF);
+ led_mode_val, 0);
goto out;
}

@@ -232,7 +232,7 @@ static int lm3601x_strobe_set(struct led_classdev_flash *fled_cdev,
LM3601X_MODE_STROBE);
else
ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
- LM3601X_MODE_STROBE, LED_OFF);
+ LM3601X_MODE_STROBE, 0);

ret = lm3601x_read_faults(led);
out:
@@ -252,9 +252,9 @@ static int lm3601x_flash_brightness_set(struct led_classdev_flash *fled_cdev,
if (ret < 0)
goto out;

- if (brightness == LED_OFF) {
+ if (brightness == 0) {
ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
- LM3601X_MODE_STROBE, LED_OFF);
+ LM3601X_MODE_STROBE, 0);
goto out;
}

diff --git a/drivers/leds/flash/leds-mt6360.c b/drivers/leds/flash/leds-mt6360.c
index e1066a52d2d2..69145a154b53 100644
--- a/drivers/leds/flash/leds-mt6360.c
+++ b/drivers/leds/flash/leds-mt6360.c
@@ -402,7 +402,7 @@ static int mt6360_isnk_init_default_state(struct mt6360_led *led)
return ret;

if (!(regval & MT6360_ISNK_ENMASK(led->led_no)))
- level = LED_OFF;
+ level = 0;

switch (led->default_state) {
case STATE_ON:
@@ -412,7 +412,7 @@ static int mt6360_isnk_init_default_state(struct mt6360_led *led)
led->isnk.brightness = min(level, led->isnk.max_brightness);
break;
default:
- led->isnk.brightness = LED_OFF;
+ led->isnk.brightness = 0;
}

return mt6360_isnk_brightness_set(&led->isnk, led->isnk.brightness);
@@ -440,7 +440,7 @@ static int mt6360_flash_init_default_state(struct mt6360_led *led)
if ((regval & enable_mask) == enable_mask)
level += 1;
else
- level = LED_OFF;
+ level = 0;

switch (led->default_state) {
case STATE_ON:
@@ -451,7 +451,7 @@ static int mt6360_flash_init_default_state(struct mt6360_led *led)
min(level, flash->led_cdev.max_brightness);
break;
default:
- flash->led_cdev.brightness = LED_OFF;
+ flash->led_cdev.brightness = 0;
}

return mt6360_torch_brightness_set(&flash->led_cdev,
@@ -542,7 +542,7 @@ static int mt6360_led_register(struct device *parent, struct mt6360_led *led,

switch (led->led_no) {
case MT6360_VIRTUAL_MULTICOLOR:
- ret = mt6360_mc_brightness_set(&led->mc.led_cdev, LED_OFF);
+ ret = mt6360_mc_brightness_set(&led->mc.led_cdev, 0);
if (ret) {
dev_err(parent,
"Failed to init multicolor brightness\n");
diff --git a/drivers/leds/flash/leds-rt4505.c b/drivers/leds/flash/leds-rt4505.c
index ee129ab7255d..d92899347928 100644
--- a/drivers/leds/flash/leds-rt4505.c
+++ b/drivers/leds/flash/leds-rt4505.c
@@ -59,7 +59,7 @@ static int rt4505_torch_brightness_set(struct led_classdev *lcdev,

mutex_lock(&priv->lock);

- if (level != LED_OFF) {
+ if (level != 0) {
ret = regmap_update_bits(priv->regmap,
RT4505_REG_ILED, RT4505_ITORCH_MASK,
(level - 1) << RT4505_ITORCH_SHIFT);
@@ -90,19 +90,19 @@ static enum led_brightness rt4505_torch_brightness_get(
ret = regmap_read(priv->regmap, RT4505_REG_ENABLE, &val);
if (ret) {
dev_err(lcdev->dev, "Failed to get LED enable\n");
- ret = LED_OFF;
+ ret = 0;
goto unlock;
}

if ((val & RT4505_ENABLE_MASK) != RT4505_TORCH_SET) {
- ret = LED_OFF;
+ ret = 0;
goto unlock;
}

ret = regmap_read(priv->regmap, RT4505_REG_ILED, &val);
if (ret) {
dev_err(lcdev->dev, "Failed to get LED brightness\n");
- ret = LED_OFF;
+ ret = 0;
goto unlock;
}

diff --git a/drivers/leds/flash/leds-rt8515.c b/drivers/leds/flash/leds-rt8515.c
index 44904fdee3cc..e9eb5f57fe50 100644
--- a/drivers/leds/flash/leds-rt8515.c
+++ b/drivers/leds/flash/leds-rt8515.c
@@ -95,7 +95,7 @@ static int rt8515_led_brightness_set(struct led_classdev *led,

mutex_lock(&rt->lock);

- if (brightness == LED_OFF) {
+ if (brightness == 0) {
/* Off */
rt8515_gpio_led_off(rt);
} else if (brightness < RT8515_TORCH_MAX) {
@@ -132,7 +132,7 @@ static int rt8515_led_flash_strobe_set(struct led_classdev_flash *fled,
rt8515_gpio_led_off(rt);
}

- fled->led_cdev.brightness = LED_OFF;
+ fled->led_cdev.brightness = 0;
/* After this the torch LED will be disabled */

mutex_unlock(&rt->lock);
diff --git a/drivers/leds/flash/leds-sgm3140.c b/drivers/leds/flash/leds-sgm3140.c
index f4f831570f11..4c36488a33bb 100644
--- a/drivers/leds/flash/leds-sgm3140.c
+++ b/drivers/leds/flash/leds-sgm3140.c
@@ -101,7 +101,7 @@ static int sgm3140_brightness_set(struct led_classdev *led_cdev,
{
struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
struct sgm3140 *priv = flcdev_to_sgm3140(fled_cdev);
- bool enable = brightness == LED_ON;
+ bool enable = brightness == 1;
int ret;

if (priv->enabled == enable)
@@ -241,7 +241,7 @@ static int sgm3140_probe(struct platform_device *pdev)
fled_cdev->ops = &sgm3140_flash_ops;

led_cdev->brightness_set_blocking = sgm3140_brightness_set;
- led_cdev->max_brightness = LED_ON;
+ led_cdev->max_brightness = 1;
led_cdev->flags |= LED_DEV_CAP_FLASH;

sgm3140_init_flash_timeout(priv);
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 6a8ea94834fa..786132946a10 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -53,7 +53,7 @@ static ssize_t brightness_store(struct device *dev,
if (ret)
goto unlock;

- if (state == LED_OFF)
+ if (state == 0)
led_trigger_remove(led_cdev);
led_set_brightness(led_cdev, state);
flush_work(&led_cdev->set_brightness_work);
@@ -405,7 +405,7 @@ int led_classdev_register_ext(struct device *parent,
up_write(&leds_list_lock);

if (!led_cdev->max_brightness)
- led_cdev->max_brightness = LED_FULL;
+ led_cdev->max_brightness = 255;

led_update_brightness(led_cdev);

@@ -448,7 +448,7 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
led_stop_software_blink(led_cdev);

if (!(led_cdev->flags & LED_RETAIN_AT_SHUTDOWN))
- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);

flush_work(&led_cdev->set_brightness_work);

diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 4a97cb745788..eb51f9f7d81c 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -64,7 +64,7 @@ static void led_timer_function(struct timer_list *t)
unsigned long delay;

if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) {
- led_set_brightness_nosleep(led_cdev, LED_OFF);
+ led_set_brightness_nosleep(led_cdev, 0);
clear_bit(LED_BLINK_SW, &led_cdev->work_flags);
return;
}
@@ -89,7 +89,7 @@ static void led_timer_function(struct timer_list *t)
* to restore it when the delay_off period is over.
*/
led_cdev->blink_brightness = brightness;
- brightness = LED_OFF;
+ brightness = 0;
delay = led_cdev->blink_delay_off;
}

@@ -121,7 +121,7 @@ static void set_brightness_delayed(struct work_struct *ws)
int ret = 0;

if (test_and_clear_bit(LED_BLINK_DISABLE, &led_cdev->work_flags)) {
- led_cdev->delayed_set_value = LED_OFF;
+ led_cdev->delayed_set_value = 0;
led_stop_software_blink(led_cdev);
}

@@ -154,7 +154,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev,

/* never on - just set to off */
if (!delay_on) {
- led_set_brightness_nosleep(led_cdev, LED_OFF);
+ led_set_brightness_nosleep(led_cdev, 0);
return;
}

diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 072491d3e17b..17fba1ad0d3d 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -185,7 +185,7 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
led_cdev->trigger = NULL;
led_cdev->trigger_data = NULL;
led_cdev->activated = false;
- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);
}
if (trig) {
spin_lock(&trig->leddev_list_lock);
@@ -231,7 +231,7 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
synchronize_rcu();
led_cdev->trigger = NULL;
led_cdev->trigger_data = NULL;
- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);
kfree(event);

return ret;
diff --git a/drivers/leds/leds-adp5520.c b/drivers/leds/leds-adp5520.c
index 5a0cc7af2df8..0cc92acffbed 100644
--- a/drivers/leds/leds-adp5520.c
+++ b/drivers/leds/leds-adp5520.c
@@ -125,7 +125,7 @@ static int adp5520_led_probe(struct platform_device *pdev)
led_dat->cdev.name = cur_led->name;
led_dat->cdev.default_trigger = cur_led->default_trigger;
led_dat->cdev.brightness_set_blocking = adp5520_led_set;
- led_dat->cdev.brightness = LED_OFF;
+ led_dat->cdev.brightness = 0;

if (cur_led->flags & ADP5520_FLAG_LED_MASK)
led_dat->flags = cur_led->flags;
diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c
index a0df1fb28774..8df45d78418b 100644
--- a/drivers/leds/leds-an30259a.c
+++ b/drivers/leds/leds-an30259a.c
@@ -93,7 +93,7 @@ static int an30259a_brightness_set(struct led_classdev *cdev,
goto error;

switch (brightness) {
- case LED_OFF:
+ case 0:
led_on &= ~AN30259A_LED_EN(led->num);
led_on &= ~AN30259A_LED_SLOPE(led->num);
led->sloping = false;
@@ -262,7 +262,7 @@ static void an30259a_init_default_state(struct an30259a_led *led)

switch (led->default_state) {
case STATE_ON:
- led->cdev.brightness = LED_FULL;
+ led->cdev.brightness = 255;
break;
case STATE_KEEP:
err = regmap_read(chip->regmap, AN30259A_REG_LED_ON, &led_on);
@@ -270,14 +270,14 @@ static void an30259a_init_default_state(struct an30259a_led *led)
break;

if (!(led_on & AN30259A_LED_EN(led->num))) {
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
break;
}
regmap_read(chip->regmap, AN30259A_REG_LEDCC(led->num),
&led->cdev.brightness);
break;
default:
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
}

an30259a_brightness_set(&led->cdev, led->cdev.brightness);
diff --git a/drivers/leds/leds-apu.c b/drivers/leds/leds-apu.c
index c409b80c236d..172f86daab3b 100644
--- a/drivers/leds/leds-apu.c
+++ b/drivers/leds/leds-apu.c
@@ -77,9 +77,9 @@ struct apu_led_pdata {
static struct apu_led_pdata *apu_led;

static const struct apu_led_profile apu1_led_profile[] = {
- { "apu:green:1", LED_ON, APU1_FCH_GPIO_BASE + 0 * APU1_IOSIZE },
- { "apu:green:2", LED_OFF, APU1_FCH_GPIO_BASE + 1 * APU1_IOSIZE },
- { "apu:green:3", LED_OFF, APU1_FCH_GPIO_BASE + 2 * APU1_IOSIZE },
+ { "apu:green:1", 1, APU1_FCH_GPIO_BASE + 0 * APU1_IOSIZE },
+ { "apu:green:2", 0, APU1_FCH_GPIO_BASE + 1 * APU1_IOSIZE },
+ { "apu:green:3", 0, APU1_FCH_GPIO_BASE + 2 * APU1_IOSIZE },
};

static const struct dmi_system_id apu_led_dmi_table[] __initconst = {
diff --git a/drivers/leds/leds-ariel.c b/drivers/leds/leds-ariel.c
index 49e1bddaa15e..6a6cfdf7c7df 100644
--- a/drivers/leds/leds-ariel.c
+++ b/drivers/leds/leds-ariel.c
@@ -37,12 +37,12 @@ static enum led_brightness ariel_led_get(struct led_classdev *led_cdev)
unsigned int led_status = 0;

if (regmap_read(led->ec_ram, led->ec_index, &led_status))
- return LED_OFF;
+ return 0;

if (led_status == EC_LED_STILL)
- return LED_FULL;
+ return 255;
else
- return LED_OFF;
+ return 0;
}

static void ariel_led_set(struct led_classdev *led_cdev,
@@ -50,7 +50,7 @@ static void ariel_led_set(struct led_classdev *led_cdev,
{
struct ariel_led *led = led_cdev_to_ariel_led(led_cdev);

- if (brightness == LED_OFF)
+ if (brightness == 0)
regmap_write(led->ec_ram, led->ec_index, EC_LED_OFF);
else
regmap_write(led->ec_ram, led->ec_index, EC_LED_STILL);
diff --git a/drivers/leds/leds-asic3.c b/drivers/leds/leds-asic3.c
index 8cbc1b8bafa5..53b7b8551808 100644
--- a/drivers/leds/leds-asic3.c
+++ b/drivers/leds/leds-asic3.c
@@ -42,7 +42,7 @@ static void brightness_set(struct led_classdev *cdev,
u32 timebase;
unsigned int base;

- timebase = (value == LED_OFF) ? 0 : (LED_EN|0x4);
+ timebase = (value == 0) ? 0 : (LED_EN|0x4);

base = led_n_base[cell->id];
asic3_write_register(asic, (base + ASIC3_LED_PeriodTime), 32);
diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c
index 80d937454aee..4b3043ed1d69 100644
--- a/drivers/leds/leds-aw2013.c
+++ b/drivers/leds/leds-aw2013.c
@@ -206,7 +206,7 @@ static int aw2013_blink_set(struct led_classdev *cdev,
}

if (!led->cdev.brightness) {
- led->cdev.brightness = LED_FULL;
+ led->cdev.brightness = 255;
ret = aw2013_brightness_set(&led->cdev, led->cdev.brightness);
if (ret)
return ret;
@@ -214,8 +214,8 @@ static int aw2013_blink_set(struct led_classdev *cdev,

/* Never on - just set to off */
if (!*delay_on) {
- led->cdev.brightness = LED_OFF;
- return aw2013_brightness_set(&led->cdev, LED_OFF);
+ led->cdev.brightness = 0;
+ return aw2013_brightness_set(&led->cdev, 0);
}

mutex_lock(&led->chip->mutex);
diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c
index 2d4d87957a30..7a2d26429653 100644
--- a/drivers/leds/leds-bcm6328.c
+++ b/drivers/leds/leds-bcm6328.c
@@ -138,8 +138,8 @@ static void bcm6328_led_set(struct led_classdev *led_cdev,
led->blink_leds[1] &= ~BIT(led->pin);

/* Set LED on/off */
- if ((led->active_low && value == LED_OFF) ||
- (!led->active_low && value != LED_OFF))
+ if ((led->active_low && value == 0) ||
+ (!led->active_low && value != 0))
bcm6328_led_mode(led, BCM6328_LED_MODE_ON);
else
bcm6328_led_mode(led, BCM6328_LED_MODE_OFF);
@@ -348,7 +348,7 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,

if (!of_property_read_string(nc, "default-state", &state)) {
if (!strcmp(state, "on")) {
- led->cdev.brightness = LED_FULL;
+ led->cdev.brightness = 255;
} else if (!strcmp(state, "keep")) {
void __iomem *mode;
unsigned long val, shift;
@@ -364,14 +364,14 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
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;
+ led->cdev.brightness = 255;
else
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
} else {
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
}
} else {
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
}

bcm6328_led_set(&led->cdev, led->cdev.brightness);
diff --git a/drivers/leds/leds-bcm6358.c b/drivers/leds/leds-bcm6358.c
index 9d2e487fa08a..955fdd4e0967 100644
--- a/drivers/leds/leds-bcm6358.c
+++ b/drivers/leds/leds-bcm6358.c
@@ -82,8 +82,8 @@ static void bcm6358_led_set(struct led_classdev *led_cdev,
spin_lock_irqsave(led->lock, flags);
bcm6358_led_busy(led->mem);
val = bcm6358_led_read(led->mem + BCM6358_REG_MODE);
- if ((led->active_low && value == LED_OFF) ||
- (!led->active_low && value != LED_OFF))
+ if ((led->active_low && value == 0) ||
+ (!led->active_low && value != 0))
val |= BIT(led->pin);
else
val &= ~(BIT(led->pin));
@@ -112,21 +112,21 @@ static int bcm6358_led(struct device *dev, struct device_node *nc, u32 reg,

if (!of_property_read_string(nc, "default-state", &state)) {
if (!strcmp(state, "on")) {
- led->cdev.brightness = LED_FULL;
+ led->cdev.brightness = 255;
} 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;
+ led->cdev.brightness = 255;
else
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
} else {
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
}
} else {
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
}

bcm6358_led_set(&led->cdev, led->cdev.brightness);
diff --git a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c
index 8bbaef5a2986..096b8c86c0ea 100644
--- a/drivers/leds/leds-bd2802.c
+++ b/drivers/leds/leds-bd2802.c
@@ -522,7 +522,7 @@ static int bd2802_set_##name##_brightness(struct led_classdev *led_cdev,\
container_of(led_cdev, struct bd2802_led, cdev_##name); \
led->led_id = id; \
led->color = clr; \
- if (value == LED_OFF) { \
+ if (value == 0) { \
led->state = BD2802_OFF; \
bd2802_turn_off(led, led->led_id, led->color); \
} else { \
@@ -557,7 +557,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led)
int ret;

led->cdev_led1r.name = "led1_R";
- led->cdev_led1r.brightness = LED_OFF;
+ led->cdev_led1r.brightness = 0;
led->cdev_led1r.brightness_set_blocking = bd2802_set_led1r_brightness;
led->cdev_led1r.blink_set = bd2802_set_led1r_blink;

@@ -569,7 +569,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led)
}

led->cdev_led1g.name = "led1_G";
- led->cdev_led1g.brightness = LED_OFF;
+ led->cdev_led1g.brightness = 0;
led->cdev_led1g.brightness_set_blocking = bd2802_set_led1g_brightness;
led->cdev_led1g.blink_set = bd2802_set_led1g_blink;

@@ -581,7 +581,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led)
}

led->cdev_led1b.name = "led1_B";
- led->cdev_led1b.brightness = LED_OFF;
+ led->cdev_led1b.brightness = 0;
led->cdev_led1b.brightness_set_blocking = bd2802_set_led1b_brightness;
led->cdev_led1b.blink_set = bd2802_set_led1b_blink;

@@ -593,7 +593,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led)
}

led->cdev_led2r.name = "led2_R";
- led->cdev_led2r.brightness = LED_OFF;
+ led->cdev_led2r.brightness = 0;
led->cdev_led2r.brightness_set_blocking = bd2802_set_led2r_brightness;
led->cdev_led2r.blink_set = bd2802_set_led2r_blink;

@@ -605,7 +605,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led)
}

led->cdev_led2g.name = "led2_G";
- led->cdev_led2g.brightness = LED_OFF;
+ led->cdev_led2g.brightness = 0;
led->cdev_led2g.brightness_set_blocking = bd2802_set_led2g_brightness;
led->cdev_led2g.blink_set = bd2802_set_led2g_blink;

@@ -617,7 +617,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led)
}

led->cdev_led2b.name = "led2_B";
- led->cdev_led2b.brightness = LED_OFF;
+ led->cdev_led2b.brightness = 0;
led->cdev_led2b.brightness_set_blocking = bd2802_set_led2b_brightness;
led->cdev_led2b.blink_set = bd2802_set_led2b_blink;
led->cdev_led2b.flags |= LED_CORE_SUSPENDRESUME;
diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c
index f512e99b976b..24e985539b18 100644
--- a/drivers/leds/leds-clevo-mail.c
+++ b/drivers/leds/leds-clevo-mail.c
@@ -97,9 +97,9 @@ static void clevo_mail_led_set(struct led_classdev *led_cdev,
{
i8042_lock_chip();

- if (value == LED_OFF)
+ if (value == 0)
i8042_command(NULL, CLEVO_MAIL_LED_OFF);
- else if (value <= LED_HALF)
+ else if (value <= 127)
i8042_command(NULL, CLEVO_MAIL_LED_BLINK_0_5HZ);
else
i8042_command(NULL, CLEVO_MAIL_LED_BLINK_1HZ);
@@ -210,7 +210,7 @@ static void __exit clevo_mail_led_exit(void)
platform_device_unregister(pdev);
platform_driver_unregister(&clevo_mail_led_driver);

- clevo_mail_led_set(NULL, LED_OFF);
+ clevo_mail_led_set(NULL, 0);
}

module_init(clevo_mail_led_init);
diff --git a/drivers/leds/leds-cobalt-qube.c b/drivers/leds/leds-cobalt-qube.c
index ef22e1e94048..4af123a10342 100644
--- a/drivers/leds/leds-cobalt-qube.c
+++ b/drivers/leds/leds-cobalt-qube.c
@@ -29,7 +29,7 @@ static void qube_front_led_set(struct led_classdev *led_cdev,

static struct led_classdev qube_front_led = {
.name = "qube::front",
- .brightness = LED_FULL,
+ .brightness = 255,
.brightness_set = qube_front_led_set,
.default_trigger = "default-on",
};
diff --git a/drivers/leds/leds-cpcap.c b/drivers/leds/leds-cpcap.c
index 7d41ce8c9bb1..8f7eba98a636 100644
--- a/drivers/leds/leds-cpcap.c
+++ b/drivers/leds/leds-cpcap.c
@@ -108,13 +108,13 @@ static int cpcap_led_set(struct led_classdev *ledc, enum led_brightness value)

mutex_lock(&led->update_lock);

- if (value > LED_OFF) {
+ if (value > 0) {
err = cpcap_led_set_power(led, true);
if (err)
goto exit;
}

- if (value == LED_OFF) {
+ if (value == 0) {
/* Avoid HW issue by turning off current before duty cycle */
err = regmap_update_bits(led->regmap,
led->info->reg, led->info->mask, CPCAP_LED_NO_CURRENT);
@@ -123,9 +123,9 @@ static int cpcap_led_set(struct led_classdev *ledc, enum led_brightness value)
goto exit;
}

- brightness = cpcap_led_val(value, LED_OFF);
+ brightness = cpcap_led_val(value, 0);
} else {
- brightness = cpcap_led_val(value, LED_ON);
+ brightness = cpcap_led_val(value, 1);
}

err = regmap_update_bits(led->regmap, led->info->reg, led->info->mask,
@@ -135,7 +135,7 @@ static int cpcap_led_set(struct led_classdev *ledc, enum led_brightness value)
goto exit;
}

- if (value == LED_OFF) {
+ if (value == 0) {
err = cpcap_led_set_power(led, false);
if (err)
goto exit;
diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c
index 2b5fb00438a2..a09446591add 100644
--- a/drivers/leds/leds-da903x.c
+++ b/drivers/leds/leds-da903x.c
@@ -66,7 +66,7 @@ static int da903x_led_set(struct led_classdev *led_cdev,
case DA9034_ID_LED_1:
case DA9034_ID_LED_2:
offset = DA9034_LED_OFFSET(led->id);
- val = (value * 0x5f / LED_FULL) & 0x7f;
+ val = (value * 0x5f / 255) & 0x7f;
val |= (led->flags & DA9034_LED_RAMP) ? 0x80 : 0;
ret = da903x_write(led->master, DA9034_LED1_CONTROL + offset,
val);
@@ -104,7 +104,7 @@ static int da903x_led_probe(struct platform_device *pdev)
led->cdev.name = pdata->name;
led->cdev.default_trigger = pdata->default_trigger;
led->cdev.brightness_set_blocking = da903x_led_set;
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;

led->id = id;
led->flags = pdata->flags;
diff --git a/drivers/leds/leds-da9052.c b/drivers/leds/leds-da9052.c
index 04060c862bf9..69b72892b540 100644
--- a/drivers/leds/leds-da9052.c
+++ b/drivers/leds/leds-da9052.c
@@ -119,7 +119,7 @@ static int da9052_led_probe(struct platform_device *pdev)
for (i = 0; i < pled->num_leds; i++) {
led[i].cdev.name = pled->leds[i].name;
led[i].cdev.brightness_set_blocking = da9052_led_set;
- led[i].cdev.brightness = LED_OFF;
+ led[i].cdev.brightness = 0;
led[i].cdev.max_brightness = DA9052_MAX_BRIGHTNESS;
led[i].led_index = pled->leds[i].flags;
led[i].da9052 = dev_get_drvdata(pdev->dev.parent);
@@ -169,7 +169,7 @@ static int da9052_led_remove(struct platform_device *pdev)
pled = pdata->pled;

for (i = 0; i < pled->num_leds; i++) {
- da9052_set_led_brightness(&led[i], LED_OFF);
+ da9052_set_led_brightness(&led[i], 0);
led_classdev_unregister(&led[i].cdev);
}

diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 20dc9b9d7dea..582d9a070115 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -66,7 +66,7 @@ static int dac124s085_probe(struct spi_device *spi)
snprintf(led->name, sizeof(led->name), "dac124s085-%d", i);
mutex_init(&led->mutex);
led->ldev.name = led->name;
- led->ldev.brightness = LED_OFF;
+ led->ldev.brightness = 0;
led->ldev.max_brightness = 0xfff;
led->ldev.brightness_set_blocking = dac124s085_set_brightness;
ret = led_classdev_register(&spi->dev, &led->ldev);
diff --git a/drivers/leds/leds-el15203000.c b/drivers/leds/leds-el15203000.c
index f9eb59a25570..b1a7ceaca434 100644
--- a/drivers/leds/leds-el15203000.c
+++ b/drivers/leds/leds-el15203000.c
@@ -133,7 +133,7 @@ static int el15203000_set_blocking(struct led_classdev *ldev,
{
struct el15203000_led *led = to_el15203000_led(ldev);

- return el15203000_cmd(led, brightness == LED_OFF ? EL_OFF : EL_ON);
+ return el15203000_cmd(led, brightness == 0 ? EL_OFF : EL_ON);
}

static int el15203000_pattern_set_S(struct led_classdev *ldev,
@@ -256,7 +256,7 @@ static int el15203000_probe_dt(struct el15203000 *priv)
}

led->priv = priv;
- led->ldev.max_brightness = LED_ON;
+ led->ldev.max_brightness = 1;
led->ldev.brightness_set_blocking = el15203000_set_blocking;

if (led->reg == 'S') {
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 092eb59a7d32..ac363efc37bc 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -38,7 +38,7 @@ static void gpio_led_set(struct led_classdev *led_cdev,
struct gpio_led_data *led_dat = cdev_to_gpio_led_data(led_cdev);
int level;

- if (value == LED_OFF)
+ if (value == 0)
level = 0;
else
level = 1;
@@ -292,7 +292,7 @@ static void gpio_led_shutdown(struct platform_device *pdev)
struct gpio_led_data *led = &priv->leds[i];

if (!(led->cdev.flags & LED_RETAIN_AT_SHUTDOWN))
- gpio_led_set(&led->cdev, LED_OFF);
+ gpio_led_set(&led->cdev, 0);
}
}

diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index 4161b9dd7e48..2a9c8dcc9a2c 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -140,7 +140,7 @@ static int is31fl319x_brightness_set(struct led_classdev *cdev,
ret = regmap_read(is31->regmap, IS31FL319X_PWM(i), &pwm_value);
dev_dbg(&is31->client->dev, "%s read %d: ret=%d: %d\n",
__func__, i, ret, pwm_value);
- on = ret >= 0 && pwm_value > LED_OFF;
+ on = ret >= 0 && pwm_value > 0;

if (i < 3)
ctrl1 |= on << i; /* 0..2 => bit 0..2 */
diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c
index e72393534b72..a5358cac5d4d 100644
--- a/drivers/leds/leds-lm3530.c
+++ b/drivers/leds/leds-lm3530.c
@@ -174,7 +174,7 @@ static void lm3530_als_configure(struct lm3530_platform_data *pdata,

for (i = 0; i < LM3530_ALS_ZB_MAX; i++)
als->zones[i] = (((als_vmin + LM3530_ALS_OFFSET_mV) +
- als_vstep + (i * als_vstep)) * LED_FULL) / 1000;
+ als_vstep + (i * als_vstep)) * 255) / 1000;

als->config =
(pdata->als_avrg_time << LM3530_ALS_AVG_TIME_SHIFT) |
@@ -436,7 +436,7 @@ static int lm3530_probe(struct i2c_client *client,
drvdata->mode = pdata->mode;
drvdata->client = client;
drvdata->pdata = pdata;
- drvdata->brightness = LED_OFF;
+ drvdata->brightness = 0;
drvdata->enable = false;
drvdata->led_dev.name = LM3530_LED_DEV;
drvdata->led_dev.brightness_set = lm3530_brightness_set;
diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
index beb53040e09e..b0671fe4957b 100644
--- a/drivers/leds/leds-lm3532.c
+++ b/drivers/leds/leds-lm3532.c
@@ -354,7 +354,7 @@ static int lm3532_brightness_set(struct led_classdev *led_cdev,
mutex_lock(&led->priv->lock);

if (led->mode == LM3532_ALS_CTRL) {
- if (brt_val > LED_OFF)
+ if (brt_val > 0)
ret = lm3532_led_enable(led);
else
ret = lm3532_led_disable(led);
@@ -362,7 +362,7 @@ static int lm3532_brightness_set(struct led_classdev *led_cdev,
goto unlock;
}

- if (brt_val == LED_OFF) {
+ if (brt_val == 0) {
ret = lm3532_led_disable(led);
goto unlock;
}
@@ -459,9 +459,9 @@ static int lm3532_als_configure(struct lm3532_data *priv,

for (i = 0; i < LM3532_ALS_ZB_MAX; i++) {
als->zones_lo[i] = ((als_vmin + als_vstep + (i * als_vstep)) *
- LED_FULL) / 1000;
+ 255) / 1000;
als->zones_hi[i] = ((als_vmin + LM3532_ALS_OFFSET_mV +
- als_vstep + (i * als_vstep)) * LED_FULL) / 1000;
+ als_vstep + (i * als_vstep)) * 255) / 1000;

zone_reg = LM3532_REG_ZN_0_HI + i * 2;
ret = regmap_write(priv->regmap, zone_reg, als->zones_lo[i]);
diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c
index 43d5970d96aa..7411c528a0d4 100644
--- a/drivers/leds/leds-lm3533.c
+++ b/drivers/leds/leds-lm3533.c
@@ -678,7 +678,7 @@ static int lm3533_led_probe(struct platform_device *pdev)
led->cdev.brightness_set_blocking = lm3533_led_set;
led->cdev.brightness_get = lm3533_led_get;
led->cdev.blink_set = lm3533_led_blink_set;
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
led->cdev.groups = lm3533_led_attribute_groups;
led->id = pdev->id;

@@ -738,7 +738,7 @@ static void lm3533_led_shutdown(struct platform_device *pdev)
dev_dbg(&pdev->dev, "%s\n", __func__);

lm3533_ctrlbank_disable(&led->cb);
- lm3533_led_set(&led->cdev, LED_OFF); /* disable blink */
+ lm3533_led_set(&led->cdev, 0); /* disable blink */
}

static struct platform_driver lm3533_led_driver = {
diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c
index afe6fb297855..be5fbed7f428 100644
--- a/drivers/leds/leds-lm3692x.c
+++ b/drivers/leds/leds-lm3692x.c
@@ -440,7 +440,7 @@ static int lm3692x_probe_dt(struct lm3692x_led *led)
}

ret = fwnode_property_read_u32(child, "led-max-microamp", &max_cur);
- led->led_dev.max_brightness = ret ? LED_FULL :
+ led->led_dev.max_brightness = ret ? 255 :
lm3692x_max_brightness(led, max_cur);

init_data.fwnode = child;
diff --git a/drivers/leds/leds-lm3697.c b/drivers/leds/leds-lm3697.c
index a8c9322558cc..9366e0b7fb4d 100644
--- a/drivers/leds/leds-lm3697.c
+++ b/drivers/leds/leds-lm3697.c
@@ -52,7 +52,7 @@
* @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)
+ * @enabled: LED brightness level (or 0)
* @num_leds: Number of LEDs available
*/
struct lm3697_led {
@@ -130,7 +130,7 @@ static int lm3697_brightness_set(struct led_classdev *led_cdev,

mutex_lock(&led->priv->lock);

- if (brt_val == LED_OFF) {
+ if (brt_val == 0) {
ret = regmap_update_bits(led->priv->regmap, LM3697_CTRL_ENABLE,
ctrl_en_val, ~ctrl_en_val);
if (ret) {
@@ -138,7 +138,7 @@ static int lm3697_brightness_set(struct led_classdev *led_cdev,
goto brightness_out;
}

- led->enabled = LED_OFF;
+ led->enabled = 0;
} else {
ret = ti_lmu_common_set_brightness(&led->lmu_data, brt_val);
if (ret) {
diff --git a/drivers/leds/leds-lp3952.c b/drivers/leds/leds-lp3952.c
index 6ee9131fbf25..3b65b0206312 100644
--- a/drivers/leds/leds-lp3952.c
+++ b/drivers/leds/leds-lp3952.c
@@ -67,7 +67,7 @@ static int lp3952_set_brightness(struct led_classdev *cdev,
dev_dbg(cdev->dev, "Brightness request: %d on %d\n", value,
led->channel);

- if (value == LED_OFF) {
+ if (value == 0) {
lp3952_on_off(priv, led->channel, false);
return 0;
}
@@ -124,7 +124,7 @@ static int lp3952_register_led_classdev(struct lp3952_led_array *priv)
continue;

priv->leds[i].cdev.name = priv->leds[i].name;
- priv->leds[i].cdev.brightness = LED_OFF;
+ priv->leds[i].cdev.brightness = 0;
priv->leds[i].cdev.max_brightness = LP3952_BRIGHT_MAX;
priv->leds[i].cdev.brightness_set_blocking =
lp3952_set_brightness;
diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
index d0160fde0f94..dd69c190ce10 100644
--- a/drivers/leds/leds-lt3593.c
+++ b/drivers/leds/leds-lt3593.c
@@ -90,7 +90,7 @@ static int lt3593_led_probe(struct platform_device *pdev)
}

led_data->cdev.brightness_set_blocking = lt3593_led_set;
- led_data->cdev.brightness = state ? LED_FULL : LED_OFF;
+ led_data->cdev.brightness = state ? 255 : 0;

init_data.fwnode = child;
init_data.devicename = LED_LT3593_NAME;
diff --git a/drivers/leds/leds-max77650.c b/drivers/leds/leds-max77650.c
index 1eeac56b0014..5ea67e3c319c 100644
--- a/drivers/leds/leds-max77650.c
+++ b/drivers/leds/leds-max77650.c
@@ -45,14 +45,14 @@ static struct max77650_led *max77650_to_led(struct led_classdev *cdev)
}

static int max77650_led_brightness_set(struct led_classdev *cdev,
- enum led_brightness brightness)
+ unsigned int brightness)
{
struct max77650_led *led = max77650_to_led(cdev);
int val, mask;

mask = MAX77650_LED_BR_MASK | MAX77650_LED_EN_MASK;

- if (brightness == LED_OFF)
+ if (brightness == 0)
val = MAX77650_LED_DISABLE;
else
val = MAX77650_LED_ENABLE | brightness;
diff --git a/drivers/leds/leds-menf21bmc.c b/drivers/leds/leds-menf21bmc.c
index 6b1b47160602..0203db50cda2 100644
--- a/drivers/leds/leds-menf21bmc.c
+++ b/drivers/leds/leds-menf21bmc.c
@@ -62,7 +62,7 @@ menf21bmc_led_set(struct led_classdev *led_cdev, enum led_brightness value)
if (led_val < 0)
goto err_out;

- if (value == LED_OFF)
+ if (value == 0)
led_val &= ~led->led_bit;
else
led_val |= led->led_bit;
diff --git a/drivers/leds/leds-mlxcpld.c b/drivers/leds/leds-mlxcpld.c
index 1355c84a2919..93526857e766 100644
--- a/drivers/leds/leds-mlxcpld.c
+++ b/drivers/leds/leds-mlxcpld.c
@@ -131,7 +131,7 @@ static struct mlxcpld_led_profile mlxcpld_led_default_profile[] = {
"mlxcpld:fan1:green",
},
{
- 0x21, 0xf0, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x21, 0xf0, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:fan1:red",
},
{
@@ -139,7 +139,7 @@ static struct mlxcpld_led_profile mlxcpld_led_default_profile[] = {
"mlxcpld:fan2:green",
},
{
- 0x21, 0x0f, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x21, 0x0f, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:fan2:red",
},
{
@@ -147,7 +147,7 @@ static struct mlxcpld_led_profile mlxcpld_led_default_profile[] = {
"mlxcpld:fan3:green",
},
{
- 0x22, 0xf0, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x22, 0xf0, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:fan3:red",
},
{
@@ -155,7 +155,7 @@ static struct mlxcpld_led_profile mlxcpld_led_default_profile[] = {
"mlxcpld:fan4:green",
},
{
- 0x22, 0x0f, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x22, 0x0f, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:fan4:red",
},
{
@@ -163,7 +163,7 @@ static struct mlxcpld_led_profile mlxcpld_led_default_profile[] = {
"mlxcpld:psu:green",
},
{
- 0x20, 0x0f, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x20, 0x0f, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:psu:red",
},
{
@@ -171,7 +171,7 @@ static struct mlxcpld_led_profile mlxcpld_led_default_profile[] = {
"mlxcpld:status:green",
},
{
- 0x20, 0xf0, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x20, 0xf0, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:status:red",
},
};
@@ -183,7 +183,7 @@ static struct mlxcpld_led_profile mlxcpld_led_msn2100_profile[] = {
"mlxcpld:fan:green",
},
{
- 0x21, 0xf0, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x21, 0xf0, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:fan:red",
},
{
@@ -191,7 +191,7 @@ static struct mlxcpld_led_profile mlxcpld_led_msn2100_profile[] = {
"mlxcpld:psu1:green",
},
{
- 0x23, 0xf0, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x23, 0xf0, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:psu1:red",
},
{
@@ -199,7 +199,7 @@ static struct mlxcpld_led_profile mlxcpld_led_msn2100_profile[] = {
"mlxcpld:psu2:green",
},
{
- 0x23, 0x0f, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x23, 0x0f, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:psu2:red",
},
{
@@ -207,11 +207,11 @@ static struct mlxcpld_led_profile mlxcpld_led_msn2100_profile[] = {
"mlxcpld:status:green",
},
{
- 0x20, 0xf0, MLXCPLD_LED_RED_STATIC_ON, LED_OFF,
+ 0x20, 0xf0, MLXCPLD_LED_RED_STATIC_ON, 0,
"mlxcpld:status:red",
},
{
- 0x24, 0xf0, MLXCPLD_LED_GREEN_STATIC_ON, LED_OFF,
+ 0x24, 0xf0, MLXCPLD_LED_GREEN_STATIC_ON, 0,
"mlxcpld:uid:blue",
},
};
diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c
index b7855c93bd72..2340a205ce44 100644
--- a/drivers/leds/leds-mlxreg.c
+++ b/drivers/leds/leds-mlxreg.c
@@ -119,7 +119,7 @@ mlxreg_led_get_hw(struct mlxreg_led_data *led_data)
dev_warn(led_data->led_cdev.dev, "Failed to get current brightness, error: %d\n",
err);
/* Assume the LED is OFF */
- return LED_OFF;
+ return 0;
}

regval = regval & ~data->mask;
@@ -220,20 +220,20 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv)
led_data->data_parent = priv;
if (strstr(data->label, "red") ||
strstr(data->label, "orange")) {
- brightness = LED_OFF;
+ brightness = 0;
led_data->base_color = MLXREG_LED_RED_SOLID;
} else if (strstr(data->label, "amber")) {
- brightness = LED_OFF;
+ brightness = 0;
led_data->base_color = MLXREG_LED_AMBER_SOLID;
} else {
- brightness = LED_OFF;
+ brightness = 0;
led_data->base_color = MLXREG_LED_GREEN_SOLID;
}
snprintf(led_data->led_cdev_name, sizeof(led_data->led_cdev_name),
"mlxreg:%s", data->label);
led_cdev->name = led_data->led_cdev_name;
led_cdev->brightness = brightness;
- led_cdev->max_brightness = LED_ON;
+ led_cdev->max_brightness = 1;
led_cdev->brightness_set_blocking =
mlxreg_led_brightness_set;
led_cdev->brightness_get = mlxreg_led_brightness_get;
diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c
index f59e0e8bda8b..cbefd78f2d49 100644
--- a/drivers/leds/leds-mt6323.c
+++ b/drivers/leds/leds-mt6323.c
@@ -354,7 +354,7 @@ static int mt6323_led_set_dt_default(struct led_classdev *cdev,
ret =
mt6323_led_set_brightness(cdev, cdev->max_brightness);
} else {
- ret = mt6323_led_set_brightness(cdev, LED_OFF);
+ ret = mt6323_led_set_brightness(cdev, 0);
}
}

diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
index 77213b79f84d..8ffbe5e19952 100644
--- a/drivers/leds/leds-netxbig.c
+++ b/drivers/leds/leds-netxbig.c
@@ -177,7 +177,7 @@ static void netxbig_led_set(struct led_classdev *led_cdev,

spin_lock_irqsave(&led_dat->lock, flags);

- if (value == LED_OFF) {
+ if (value == 0) {
mode = NETXBIG_LED_OFF;
set_brightness = 0;
} else {
@@ -295,7 +295,7 @@ static int create_netxbig_led(struct platform_device *pdev,
* the whole boot process (bootloader+linux).
*/
led_dat->sata = 0;
- led_dat->cdev.brightness = LED_OFF;
+ led_dat->cdev.brightness = 0;
led_dat->cdev.max_brightness = template->bright_max;
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
led_dat->mode_addr = template->mode_addr;
diff --git a/drivers/leds/leds-nic78bx.c b/drivers/leds/leds-nic78bx.c
index f196f52eec1e..25639c40975c 100644
--- a/drivers/leds/leds-nic78bx.c
+++ b/drivers/leds/leds-nic78bx.c
@@ -72,7 +72,7 @@ static enum led_brightness nic78bx_brightness_get(struct led_classdev *cdev)
value = inb(nled->data->io_base);
spin_unlock_irqrestore(&nled->data->lock, flags);

- return (value & nled->bit) ? 1 : LED_OFF;
+ return (value & nled->bit) ? 1 : 0;
}

static struct nic78bx_led nic78bx_leds[] = {
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index 1677d66d8b0e..34e899adfc0d 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -106,7 +106,7 @@ static void ns2_led_set(struct led_classdev *led_cdev,
struct ns2_led *led = container_of(led_cdev, struct ns2_led, cdev);
enum ns2_led_modes mode;

- if (value == LED_OFF)
+ if (value == 0)
mode = NS_V2_LED_OFF;
else if (led->sata)
mode = NS_V2_LED_SATA;
@@ -224,7 +224,7 @@ static int ns2_led_register(struct device *dev, struct fwnode_handle *node,

/* Set LED initial state. */
led->sata = (mode == NS_V2_LED_SATA) ? 1 : 0;
- led->cdev.brightness = (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL;
+ led->cdev.brightness = (mode == NS_V2_LED_OFF) ? 0 : 255;

init_data.fwnode = node;

diff --git a/drivers/leds/leds-ot200.c b/drivers/leds/leds-ot200.c
index 12af1127d9b7..693fbfeced6c 100644
--- a/drivers/leds/leds-ot200.c
+++ b/drivers/leds/leds-ot200.c
@@ -105,7 +105,7 @@ static void ot200_led_brightness_set(struct led_classdev *led_cdev,
else
BUG();

- if (value == LED_OFF)
+ if (value == 0)
*val &= ~led->mask;
else
*val |= led->mask;
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index 017794bb87ae..3e14a61e9807 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -177,9 +177,9 @@ static int pca9532_set_brightness(struct led_classdev *led_cdev,
int err = 0;
struct pca9532_led *led = ldev_to_led(led_cdev);

- if (value == LED_OFF)
+ if (value == 0)
led->state = PCA9532_OFF;
- else if (value == LED_FULL)
+ else if (value == 255)
led->state = PCA9532_ON;
else {
led->state = PCA9532_PWM0; /* Thecus: hardcode one pwm */
@@ -386,7 +386,7 @@ static int pca9532_configure(struct i2c_client *client,
led->name = pled->name;
led->ldev.name = led->name;
led->ldev.default_trigger = pled->default_trigger;
- led->ldev.brightness = LED_OFF;
+ led->ldev.brightness = 0;
led->ldev.brightness_set_blocking =
pca9532_set_brightness;
led->ldev.blink_set = pca9532_set_blink;
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index a6b5699aeae4..2230d3f0e846 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -57,9 +57,9 @@
#define PCA955X_LS_BLINK0 0x2 /* Blink at PWM0 rate */
#define PCA955X_LS_BLINK1 0x3 /* Blink at PWM1 rate */

-#define PCA955X_GPIO_INPUT LED_OFF
-#define PCA955X_GPIO_HIGH LED_OFF
-#define PCA955X_GPIO_LOW LED_FULL
+#define PCA955X_GPIO_INPUT 0
+#define PCA955X_GPIO_HIGH 0
+#define PCA955X_GPIO_LOW 255

enum pca955x_type {
pca9550,
@@ -265,13 +265,13 @@ static enum led_brightness pca955x_led_get(struct led_classdev *led_cdev)
ls = (ls >> ((pca955x_led->led_num % 4) << 1)) & 0x3;
switch (ls) {
case PCA955X_LS_LED_ON:
- ret = LED_FULL;
+ ret = 255;
break;
case PCA955X_LS_LED_OFF:
- ret = LED_OFF;
+ ret = 0;
break;
case PCA955X_LS_BLINK0:
- ret = LED_HALF;
+ ret = 127;
break;
case PCA955X_LS_BLINK1:
ret = pca955x_read_pwm(pca955x->client, 1, &pwm);
@@ -307,13 +307,13 @@ static int pca955x_led_set(struct led_classdev *led_cdev,
goto out;

switch (value) {
- case LED_FULL:
+ case 255:
ls = pca955x_ledsel(ls, ls_led, PCA955X_LS_LED_ON);
break;
- case LED_OFF:
+ case 0:
ls = pca955x_ledsel(ls, ls_led, PCA955X_LS_LED_OFF);
break;
- case LED_HALF:
+ case 127:
ls = pca955x_ledsel(ls, ls_led, PCA955X_LS_BLINK0);
break;
default:
@@ -578,12 +578,12 @@ static int pca955x_probe(struct i2c_client *client)

if (pdata->leds[i].default_state ==
LEDS_GPIO_DEFSTATE_OFF) {
- err = pca955x_led_set(led, LED_OFF);
+ err = pca955x_led_set(led, 0);
if (err)
return err;
} else if (pdata->leds[i].default_state ==
LEDS_GPIO_DEFSTATE_ON) {
- err = pca955x_led_set(led, LED_FULL);
+ err = pca955x_led_set(led, 255);
if (err)
return err;
}
@@ -621,16 +621,16 @@ static int pca955x_probe(struct i2c_client *client)
*/
if (pdata->leds[i].default_state ==
LEDS_GPIO_DEFSTATE_KEEP) {
- if (led->brightness != LED_FULL &&
- led->brightness != LED_OFF &&
- led->brightness != LED_HALF)
+ if (led->brightness != 255 &&
+ led->brightness != 0 &&
+ led->brightness != 127)
keep_pwm = true;
}
}
}

/* PWM0 is used for half brightness or 50% duty cycle */
- err = pca955x_write_pwm(client, 0, 255 - LED_HALF);
+ err = pca955x_write_pwm(client, 0, 255 - 127);
if (err)
return err;

diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c
index 00aecd67e348..17612f5021b9 100644
--- a/drivers/leds/leds-pca963x.c
+++ b/drivers/leds/leds-pca963x.c
@@ -128,11 +128,11 @@ static int pca963x_brightness(struct pca963x_led *led,
ledout = i2c_smbus_read_byte_data(client, ledout_addr);

switch (brightness) {
- case LED_FULL:
+ case 255:
val = (ledout & ~mask) | (PCA963X_LED_ON << shift);
ret = i2c_smbus_write_byte_data(client, ledout_addr, val);
break;
- case LED_OFF:
+ case 0:
val = ledout & ~mask;
ret = i2c_smbus_write_byte_data(client, ledout_addr, val);
break;
diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c
index fb2ab72c0c40..535b471a634a 100644
--- a/drivers/leds/leds-pm8058.c
+++ b/drivers/leds/leds-pm8058.c
@@ -64,7 +64,7 @@ static enum led_brightness pm8058_led_get(struct led_classdev *cled)
ret = regmap_read(led->map, led->reg, &val);
if (ret) {
pr_err("Failed to get LED brightness\n");
- return LED_OFF;
+ return 0;
}

switch (led->ledtype) {
@@ -78,7 +78,7 @@ static enum led_brightness pm8058_led_get(struct led_classdev *cled)
val >>= PM8058_LED_TYPE_KEYPAD_SHIFT;
break;
default:
- val = LED_OFF;
+ val = 0;
break;
}

@@ -133,8 +133,8 @@ static int pm8058_led_probe(struct platform_device *pdev)
led->cdev.brightness = maxbright;
pm8058_led_set(&led->cdev, maxbright);
} else {
- led->cdev.brightness = LED_OFF;
- pm8058_led_set(&led->cdev, LED_OFF);
+ led->cdev.brightness = 0;
+ pm8058_led_set(&led->cdev, 0);
}
}

diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c
index 743e2cdd0891..9ee3ad46a82c 100644
--- a/drivers/leds/leds-powernv.c
+++ b/drivers/leds/leds-powernv.c
@@ -146,7 +146,7 @@ static enum led_brightness powernv_led_get(struct powernv_led_data *powernv_led)
if (rc != OPAL_SUCCESS && rc != OPAL_PARTIAL) {
dev_err(dev, "%s: OPAL get led call failed [rc=%d]\n",
__func__, rc);
- return LED_OFF;
+ return 0;
}

led_mask = be64_to_cpu(mask);
@@ -156,14 +156,14 @@ static enum led_brightness powernv_led_get(struct powernv_led_data *powernv_led)
if (!((led_mask >> powernv_led->led_type) & OPAL_SLOT_LED_STATE_ON)) {
dev_err(dev, "%s: LED status not available for %s\n",
__func__, powernv_led->cdev.name);
- return LED_OFF;
+ return 0;
}

/* LED status value */
if ((led_value >> powernv_led->led_type) & OPAL_SLOT_LED_STATE_ON)
- return LED_FULL;
+ return 255;

- return LED_OFF;
+ return 0;
}

/*
@@ -225,8 +225,8 @@ static int powernv_led_create(struct device *dev,

powernv_led->cdev.brightness_set_blocking = powernv_brightness_set;
powernv_led->cdev.brightness_get = powernv_brightness_get;
- powernv_led->cdev.brightness = LED_OFF;
- powernv_led->cdev.max_brightness = LED_FULL;
+ powernv_led->cdev.brightness = 0;
+ powernv_led->cdev.max_brightness = 255;

/* Register the classdev */
rc = devm_led_classdev_register(dev, &powernv_led->cdev);
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 6832180c1c54..50e97e70051a 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -67,7 +67,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,

led_data->active_low = led->active_low;
led_data->cdev.name = led->name;
- led_data->cdev.brightness = LED_OFF;
+ led_data->cdev.brightness = 0;
led_data->cdev.max_brightness = led->max_brightness;
led_data->cdev.flags = LED_CORE_SUSPENDRESUME;

diff --git a/drivers/leds/leds-rb532.c b/drivers/leds/leds-rb532.c
index b6447c1721b4..350418795353 100644
--- a/drivers/leds/leds-rb532.c
+++ b/drivers/leds/leds-rb532.c
@@ -27,7 +27,7 @@ static void rb532_led_set(struct led_classdev *cdev,

static enum led_brightness rb532_led_get(struct led_classdev *cdev)
{
- return (get_latch_u5() & LO_ULED) ? LED_FULL : LED_OFF;
+ return (get_latch_u5() & LO_ULED) ? 255 : 0;
}

static struct led_classdev rb532_uled = {
diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c
index 208c98918433..c99460ac1d3c 100644
--- a/drivers/leds/leds-regulator.c
+++ b/drivers/leds/leds-regulator.c
@@ -96,7 +96,7 @@ static int regulator_led_brightness_set(struct led_classdev *led_cdev,

mutex_lock(&led->mutex);

- if (value == LED_OFF) {
+ if (value == 0) {
regulator_led_disable(led);
goto out;
}
diff --git a/drivers/leds/leds-sc27xx-bltc.c b/drivers/leds/leds-sc27xx-bltc.c
index e199ea15e406..e7c105e45a81 100644
--- a/drivers/leds/leds-sc27xx-bltc.c
+++ b/drivers/leds/leds-sc27xx-bltc.c
@@ -114,14 +114,14 @@ static int sc27xx_led_disable(struct sc27xx_led *leds)
(SC27XX_LED_RUN | SC27XX_LED_TYPE) << ctrl_shift, 0);
}

-static int sc27xx_led_set(struct led_classdev *ldev, enum led_brightness value)
+static int sc27xx_led_set(struct led_classdev *ldev, unsigned int value)
{
struct sc27xx_led *leds = to_sc27xx_led(ldev);
int err;

mutex_lock(&leds->priv->lock);

- if (value == LED_OFF)
+ if (value == 0)
err = sc27xx_led_disable(leds);
else
err = sc27xx_led_enable(leds, value);
@@ -161,7 +161,7 @@ static int sc27xx_led_pattern_clear(struct led_classdev *ldev)
err = regmap_update_bits(regmap, ctrl_base,
(SC27XX_LED_RUN | SC27XX_LED_TYPE) << ctrl_shift, 0);

- ldev->brightness = LED_OFF;
+ ldev->brightness = 0;

mutex_unlock(&leds->priv->lock);

diff --git a/drivers/leds/leds-spi-byte.c b/drivers/leds/leds-spi-byte.c
index f1964c96fb15..e96fc874c0f4 100644
--- a/drivers/leds/leds-spi-byte.c
+++ b/drivers/leds/leds-spi-byte.c
@@ -103,7 +103,7 @@ static int spi_byte_probe(struct spi_device *spi)
mutex_init(&led->mutex);
led->cdef = device_get_match_data(dev);
led->ldev.name = led->name;
- led->ldev.brightness = LED_OFF;
+ led->ldev.brightness = 0;
led->ldev.max_brightness = led->cdef->max_value - led->cdef->off_value;
led->ldev.brightness_set_blocking = spi_byte_brightness_set_blocking;

diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c
index fcaa34706b6c..08cbe2ba5417 100644
--- a/drivers/leds/leds-ss4200.c
+++ b/drivers/leds/leds-ss4200.c
@@ -220,7 +220,7 @@ static void nasgpio_led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
u32 setting = 0;
- if (brightness >= LED_HALF)
+ if (brightness >= 127)
setting = 1;
/*
* Hold the lock across both operations. This ensures
@@ -433,12 +433,12 @@ static void set_power_light_amber_noblink(void)
if (!amber || !blue)
return;
/*
- * LED_OFF implies disabling future blinking
+ * 0 implies disabling future blinking
*/
pr_debug("setting blue off and amber on\n");

- nasgpio_led_set_brightness(&blue->led_cdev, LED_OFF);
- nasgpio_led_set_brightness(&amber->led_cdev, LED_FULL);
+ nasgpio_led_set_brightness(&blue->led_cdev, 0);
+ nasgpio_led_set_brightness(&amber->led_cdev, 255);
}

static ssize_t blink_show(struct device *dev,
@@ -482,9 +482,9 @@ static int register_nasgpio_led(int led_nr)
struct led_classdev *led = get_classdev_for_led_nr(led_nr);

led->name = nas_led->name;
- led->brightness = LED_OFF;
+ led->brightness = 0;
if (nasgpio_led_get_attr(led, GP_LVL))
- led->brightness = LED_FULL;
+ led->brightness = 255;
led->brightness_set = nasgpio_led_set_brightness;
led->blink_set = nasgpio_led_set_blink;
led->groups = nasgpio_led_groups;
diff --git a/drivers/leds/leds-sunfire.c b/drivers/leds/leds-sunfire.c
index eba7313719bf..f9e42661d02a 100644
--- a/drivers/leds/leds-sunfire.c
+++ b/drivers/leds/leds-sunfire.c
@@ -144,7 +144,7 @@ static int sunfire_led_generic_probe(struct platform_device *pdev,

p->leds[i].reg = (void __iomem *) pdev->resource[0].start;
lp->name = types[i].name;
- lp->brightness = LED_FULL;
+ lp->brightness = 255;
lp->brightness_set = types[i].handler;
lp->default_trigger = types[i].default_trigger;

diff --git a/drivers/leds/leds-syscon.c b/drivers/leds/leds-syscon.c
index 7eddb8ecb44e..1533b39e22ec 100644
--- a/drivers/leds/leds-syscon.c
+++ b/drivers/leds/leds-syscon.c
@@ -40,7 +40,7 @@ static void syscon_led_set(struct led_classdev *led_cdev,
u32 val;
int ret;

- if (value == LED_OFF) {
+ if (value == 0) {
val = 0;
sled->state = false;
} else {
diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index 1473ced8664c..e40d659b6119 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -423,7 +423,7 @@ static int led_prepare(struct tca6507_led *led)
if (best == -1) {
/* Best brightness is full-on */
set_select(tca, led->num, TCA6507_LS_LED_ON);
- led->led_cdev.brightness = LED_FULL;
+ led->led_cdev.brightness = 255;
return 0;
}

@@ -577,12 +577,12 @@ static int tca6507_blink_set(struct led_classdev *led_cdev,
if (led->offtime == 0)
led->offtime = 512;

- if (led->led_cdev.brightness == LED_OFF)
- led->led_cdev.brightness = LED_FULL;
+ if (led->led_cdev.brightness == 0)
+ led->led_cdev.brightness = 255;
if (led_assign(led) < 0) {
led->ontime = 0;
led->offtime = 0;
- led->led_cdev.brightness = LED_OFF;
+ led->led_cdev.brightness = 0;
return -EINVAL;
}
*delay_on = led->ontime;
diff --git a/drivers/leds/leds-wm831x-status.c b/drivers/leds/leds-wm831x-status.c
index c48b80574f02..37328c0c00b1 100644
--- a/drivers/leds/leds-wm831x-status.c
+++ b/drivers/leds/leds-wm831x-status.c
@@ -52,7 +52,7 @@ static void wm831x_status_set(struct wm831x_status *led)
led->reg_val |= led->blink_time << WM831X_LED_DUR_SHIFT;
led->reg_val |= led->blink_cyc;
} else {
- if (led->brightness != LED_OFF)
+ if (led->brightness != 0)
led->reg_val |= 1 << WM831X_LED_MODE_SHIFT;
}

@@ -71,7 +71,7 @@ static int wm831x_status_brightness_set(struct led_classdev *led_cdev,

spin_lock_irqsave(&led->value_lock, flags);
led->brightness = value;
- if (value == LED_OFF)
+ if (value == 0)
led->blink = 0;
spin_unlock_irqrestore(&led->value_lock, flags);
wm831x_status_set(led);
@@ -248,9 +248,9 @@ static int wm831x_status_probe(struct platform_device *pdev)
drvdata->reg_val = wm831x_reg_read(wm831x, drvdata->reg);

if (drvdata->reg_val & WM831X_LED_MODE_MASK)
- drvdata->brightness = LED_FULL;
+ drvdata->brightness = 255;
else
- drvdata->brightness = LED_OFF;
+ drvdata->brightness = 0;

/* Set a default source if configured, otherwise leave the
* current hardware setting.
diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c
index 8f243c413723..512bbc266258 100644
--- a/drivers/leds/leds-wm8350.c
+++ b/drivers/leds/leds-wm8350.c
@@ -150,7 +150,7 @@ static int wm8350_led_set(struct led_classdev *led_cdev,

spin_lock_irqsave(&led->value_lock, flags);

- if (led->value == LED_OFF) {
+ if (led->value == 0) {
spin_unlock_irqrestore(&led->value_lock, flags);
return wm8350_led_disable(led);
}
@@ -160,7 +160,7 @@ static int wm8350_led_set(struct led_classdev *led_cdev,
* brightness due to the non-linear current settings provided
* by the hardware.
*/
- uA = (led->max_uA_index * led->value) / LED_FULL;
+ uA = (led->max_uA_index * led->value) / 255;
spin_unlock_irqrestore(&led->value_lock, flags);
BUG_ON(uA >= ARRAY_SIZE(isink_cur));

@@ -179,7 +179,7 @@ static void wm8350_led_shutdown(struct platform_device *pdev)
{
struct wm8350_led *led = platform_get_drvdata(pdev);

- led->value = LED_OFF;
+ led->value = 0;
wm8350_led_disable(led);
}

@@ -236,7 +236,7 @@ static int wm8350_led_probe(struct platform_device *pdev)
pdata->max_uA);

spin_lock_init(&led->value_lock);
- led->value = LED_OFF;
+ led->value = 0;
platform_set_drvdata(pdev, led);

return led_classdev_register(&pdev->dev, &led->cdev);
diff --git a/drivers/leds/simple/simatic-ipc-leds.c b/drivers/leds/simple/simatic-ipc-leds.c
index ff2c96e73241..be5d7e1e4145 100644
--- a/drivers/leds/simple/simatic-ipc-leds.c
+++ b/drivers/leds/simple/simatic-ipc-leds.c
@@ -73,7 +73,7 @@ static void simatic_ipc_led_set_io(struct led_classdev *led_cd,
spin_lock_irqsave(&reg_lock, flags);

val = inw(SIMATIC_IPC_LED_PORT_BASE);
- if (brightness == LED_OFF)
+ if (brightness == 0)
outw(val | led->value, SIMATIC_IPC_LED_PORT_BASE);
else
outw(val & ~led->value, SIMATIC_IPC_LED_PORT_BASE);
@@ -85,7 +85,7 @@ static enum led_brightness simatic_ipc_led_get_io(struct led_classdev *led_cd)
{
struct simatic_ipc_led *led = cdev_to_led(led_cd);

- return inw(SIMATIC_IPC_LED_PORT_BASE) & led->value ? LED_OFF : led_cd->max_brightness;
+ return inw(SIMATIC_IPC_LED_PORT_BASE) & led->value ? 0 : led_cd->max_brightness;
}

static void simatic_ipc_led_set_mem(struct led_classdev *led_cd,
@@ -96,7 +96,7 @@ static void simatic_ipc_led_set_mem(struct led_classdev *led_cd,
u32 *p;

p = simatic_ipc_led_memory + led->value;
- *p = (*p & ~1) | (brightness == LED_OFF);
+ *p = (*p & ~1) | (brightness == 0);
}

static enum led_brightness simatic_ipc_led_get_mem(struct led_classdev *led_cd)
@@ -106,7 +106,7 @@ static enum led_brightness simatic_ipc_led_get_mem(struct led_classdev *led_cd)
u32 *p;

p = simatic_ipc_led_memory + led->value;
- return (*p & 1) ? LED_OFF : led_cd->max_brightness;
+ return (*p & 1) ? 0 : led_cd->max_brightness;
}

static int simatic_ipc_leds_probe(struct platform_device *pdev)
@@ -176,7 +176,7 @@ static int simatic_ipc_leds_probe(struct platform_device *pdev)
cdev->brightness_set = simatic_ipc_led_set_io;
cdev->brightness_get = simatic_ipc_led_get_io;
}
- cdev->max_brightness = LED_ON;
+ cdev->max_brightness = 1;
cdev->name = ipcled->name;

err = devm_led_classdev_register(dev, cdev);
diff --git a/drivers/leds/trigger/ledtrig-activity.c b/drivers/leds/trigger/ledtrig-activity.c
index 30bc9df03636..d0d8cc8db8c6 100644
--- a/drivers/leds/trigger/ledtrig-activity.c
+++ b/drivers/leds/trigger/ledtrig-activity.c
@@ -129,7 +129,7 @@ static void led_activity_function(struct timer_list *t)
activity_data->state = !activity_data->state;
led_set_brightness_nosleep(led_cdev,
(activity_data->state ^ activity_data->invert) ?
- led_cdev->blink_brightness : LED_OFF);
+ led_cdev->blink_brightness : 0);
}

target = (cpus > 1) ? (100 / cpus) : 50;
diff --git a/drivers/leds/trigger/ledtrig-backlight.c b/drivers/leds/trigger/ledtrig-backlight.c
index 487577d22cfc..ec965e192365 100644
--- a/drivers/leds/trigger/ledtrig-backlight.c
+++ b/drivers/leds/trigger/ledtrig-backlight.c
@@ -47,7 +47,7 @@ static int fb_notifier_callback(struct notifier_block *p,

if ((n->old_status == UNBLANK) ^ n->invert) {
n->brightness = led->brightness;
- led_set_brightness_nosleep(led, LED_OFF);
+ led_set_brightness_nosleep(led, 0);
} else {
led_set_brightness_nosleep(led, n->brightness);
}
@@ -84,7 +84,7 @@ static ssize_t bl_trig_invert_store(struct device *dev,

/* After inverting, we need to update the LED. */
if ((n->old_status == BLANK) ^ n->invert)
- led_set_brightness_nosleep(led, LED_OFF);
+ led_set_brightness_nosleep(led, 0);
else
led_set_brightness_nosleep(led, n->brightness);

diff --git a/drivers/leds/trigger/ledtrig-camera.c b/drivers/leds/trigger/ledtrig-camera.c
index ab1c410872ff..1c9707c60a19 100644
--- a/drivers/leds/trigger/ledtrig-camera.c
+++ b/drivers/leds/trigger/ledtrig-camera.c
@@ -19,7 +19,7 @@ DEFINE_LED_TRIGGER(ledtrig_torch);

void ledtrig_flash_ctrl(bool on)
{
- enum led_brightness brt = on ? LED_FULL : LED_OFF;
+ unsigned int brt = on ? 255 : 0;

led_trigger_event(ledtrig_flash, brt);
}
@@ -27,7 +27,7 @@ EXPORT_SYMBOL_GPL(ledtrig_flash_ctrl);

void ledtrig_torch_ctrl(bool on)
{
- enum led_brightness brt = on ? LED_FULL : LED_OFF;
+ unsigned int brt = on ? 255 : 0;

led_trigger_event(ledtrig_torch, brt);
}
diff --git a/drivers/leds/trigger/ledtrig-cpu.c b/drivers/leds/trigger/ledtrig-cpu.c
index 8af4f9bb9cde..a7d358412f8a 100644
--- a/drivers/leds/trigger/ledtrig-cpu.c
+++ b/drivers/leds/trigger/ledtrig-cpu.c
@@ -84,11 +84,11 @@ void ledtrig_cpu(enum cpu_led_event ledevt)
total_cpus = num_present_cpus();

led_trigger_event(trig->_trig,
- is_active ? LED_FULL : LED_OFF);
+ is_active ? 255 : 0);


led_trigger_event(trig_cpu_all,
- DIV_ROUND_UP(LED_FULL * active_cpus, total_cpus));
+ DIV_ROUND_UP(255 * active_cpus, total_cpus));

}
}
diff --git a/drivers/leds/trigger/ledtrig-gpio.c b/drivers/leds/trigger/ledtrig-gpio.c
index 0120faa3dafa..d794e44f2eff 100644
--- a/drivers/leds/trigger/ledtrig-gpio.c
+++ b/drivers/leds/trigger/ledtrig-gpio.c
@@ -37,9 +37,9 @@ static irqreturn_t gpio_trig_irq(int irq, void *_led)
led_set_brightness_nosleep(gpio_data->led,
gpio_data->desired_brightness);
else
- led_set_brightness_nosleep(gpio_data->led, LED_FULL);
+ led_set_brightness_nosleep(gpio_data->led, 255);
} else {
- led_set_brightness_nosleep(gpio_data->led, LED_OFF);
+ led_set_brightness_nosleep(gpio_data->led, 0);
}

return IRQ_HANDLED;
diff --git a/drivers/leds/trigger/ledtrig-heartbeat.c b/drivers/leds/trigger/ledtrig-heartbeat.c
index 7fe0a05574d2..0b5ec7dc14fa 100644
--- a/drivers/leds/trigger/ledtrig-heartbeat.c
+++ b/drivers/leds/trigger/ledtrig-heartbeat.c
@@ -35,13 +35,13 @@ static void led_heartbeat_function(struct timer_list *t)
struct heartbeat_trig_data *heartbeat_data =
from_timer(heartbeat_data, t, timer);
struct led_classdev *led_cdev;
- unsigned long brightness = LED_OFF;
+ unsigned long brightness = 0;
unsigned long delay = 0;

led_cdev = heartbeat_data->led_cdev;

if (unlikely(panic_heartbeats)) {
- led_set_brightness_nosleep(led_cdev, LED_OFF);
+ led_set_brightness_nosleep(led_cdev, 0);
return;
}

diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
index d5e774d83021..e3174d09111c 100644
--- a/drivers/leds/trigger/ledtrig-netdev.c
+++ b/drivers/leds/trigger/ledtrig-netdev.c
@@ -74,13 +74,13 @@ static void set_baseline_state(struct led_netdev_data *trigger_data)
led_cdev->blink_brightness = led_cdev->max_brightness;

if (!test_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode))
- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);
else {
if (test_bit(NETDEV_LED_LINK, &trigger_data->mode))
led_set_brightness(led_cdev,
led_cdev->blink_brightness);
else
- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);

/* If we are looking for RX/TX start periodically
* checking stats
@@ -355,7 +355,7 @@ static void netdev_trig_work(struct work_struct *work)

/* If we dont have a device, insure we are off */
if (!trigger_data->net_dev) {
- led_set_brightness(trigger_data->led_cdev, LED_OFF);
+ led_set_brightness(trigger_data->led_cdev, 0);
return;
}

diff --git a/drivers/leds/trigger/ledtrig-oneshot.c b/drivers/leds/trigger/ledtrig-oneshot.c
index bee3bd452abf..bc5ff2d2fd6c 100644
--- a/drivers/leds/trigger/ledtrig-oneshot.c
+++ b/drivers/leds/trigger/ledtrig-oneshot.c
@@ -58,9 +58,9 @@ static ssize_t led_invert_store(struct device *dev,
oneshot_data->invert = !!state;

if (oneshot_data->invert)
- led_set_brightness_nosleep(led_cdev, LED_FULL);
+ led_set_brightness_nosleep(led_cdev, 255);
else
- led_set_brightness_nosleep(led_cdev, LED_OFF);
+ led_set_brightness_nosleep(led_cdev, 0);

return size;
}
@@ -184,7 +184,7 @@ static void oneshot_trig_deactivate(struct led_classdev *led_cdev)
kfree(oneshot_data);

/* Stop blinking */
- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);
}

static struct led_trigger oneshot_led_trigger = {
diff --git a/drivers/leds/trigger/ledtrig-panic.c b/drivers/leds/trigger/ledtrig-panic.c
index 64abf2e91608..2576632d2264 100644
--- a/drivers/leds/trigger/ledtrig-panic.c
+++ b/drivers/leds/trigger/ledtrig-panic.c
@@ -58,7 +58,7 @@ static struct notifier_block led_trigger_panic_nb = {

static long led_panic_blink(int state)
{
- led_trigger_event(trigger, state ? LED_FULL : LED_OFF);
+ led_trigger_event(trigger, state ? 255 : 0);
return 0;
}

diff --git a/drivers/leds/trigger/ledtrig-pattern.c b/drivers/leds/trigger/ledtrig-pattern.c
index 43a265dc4696..d49e45395aca 100644
--- a/drivers/leds/trigger/ledtrig-pattern.c
+++ b/drivers/leds/trigger/ledtrig-pattern.c
@@ -432,7 +432,7 @@ static void pattern_trig_deactivate(struct led_classdev *led_cdev)

del_timer_sync(&data->timer);

- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);
kfree(data);
led_cdev->activated = false;
}
diff --git a/drivers/leds/trigger/ledtrig-timer.c b/drivers/leds/trigger/ledtrig-timer.c
index b4688d1d9d2b..cb2b4dcd4a2c 100644
--- a/drivers/leds/trigger/ledtrig-timer.c
+++ b/drivers/leds/trigger/ledtrig-timer.c
@@ -124,7 +124,7 @@ static int timer_trig_activate(struct led_classdev *led_cdev)
static void timer_trig_deactivate(struct led_classdev *led_cdev)
{
/* Stop blinking */
- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);
}

static struct led_trigger timer_led_trigger = {
diff --git a/drivers/leds/trigger/ledtrig-transient.c b/drivers/leds/trigger/ledtrig-transient.c
index 80635183fac8..b35ba2527346 100644
--- a/drivers/leds/trigger/ledtrig-transient.c
+++ b/drivers/leds/trigger/ledtrig-transient.c
@@ -79,7 +79,7 @@ static ssize_t transient_activate_store(struct device *dev,
transient_data->activate = state;
led_set_brightness_nosleep(led_cdev, transient_data->state);
transient_data->restore_state =
- (transient_data->state == LED_FULL) ? LED_OFF : LED_FULL;
+ (transient_data->state == 255) ? 0 : 255;
mod_timer(&transient_data->timer,
jiffies + msecs_to_jiffies(transient_data->duration));
}
@@ -123,7 +123,7 @@ static ssize_t transient_state_show(struct device *dev,
led_trigger_get_drvdata(dev);
int state;

- state = (transient_data->state == LED_FULL) ? 1 : 0;
+ state = (transient_data->state == 255) ? 1 : 0;
return sprintf(buf, "%d\n", state);
}

@@ -142,7 +142,7 @@ static ssize_t transient_state_store(struct device *dev,
if (state != 1 && state != 0)
return -EINVAL;

- transient_data->state = (state == 1) ? LED_FULL : LED_OFF;
+ transient_data->state = (state == 1) ? 255 : 0;
return size;
}

diff --git a/drivers/leds/trigger/ledtrig-tty.c b/drivers/leds/trigger/ledtrig-tty.c
index f62db7e520b5..378ccb7b12df 100644
--- a/drivers/leds/trigger/ledtrig-tty.c
+++ b/drivers/leds/trigger/ledtrig-tty.c
@@ -122,12 +122,12 @@ static void ledtrig_tty_work(struct work_struct *work)

if (icount.rx != trigger_data->rx ||
icount.tx != trigger_data->tx) {
- led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
+ led_set_brightness_sync(trigger_data->led_cdev, 1);

trigger_data->rx = icount.rx;
trigger_data->tx = icount.tx;
} else {
- led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
+ led_set_brightness_sync(trigger_data->led_cdev, 0);
}

out:
--
2.34.1

2022-01-22 01:59:31

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 10/31] media: radio: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/media/radio/radio-shark.c | 6 +++---
drivers/media/radio/radio-shark2.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/radio/radio-shark.c b/drivers/media/radio/radio-shark.c
index 8230da828d0e..7998b75df525 100644
--- a/drivers/media/radio/radio-shark.c
+++ b/drivers/media/radio/radio-shark.c
@@ -217,19 +217,19 @@ static void shark_led_set_red(struct led_classdev *led_cdev,
static const struct led_classdev shark_led_templates[NO_LEDS] = {
[BLUE_LED] = {
.name = "%s:blue:",
- .brightness = LED_OFF,
+ .brightness = 0,
.max_brightness = 127,
.brightness_set = shark_led_set_blue,
},
[BLUE_PULSE_LED] = {
.name = "%s:blue-pulse:",
- .brightness = LED_OFF,
+ .brightness = 0,
.max_brightness = 255,
.brightness_set = shark_led_set_blue_pulse,
},
[RED_LED] = {
.name = "%s:red:",
- .brightness = LED_OFF,
+ .brightness = 0,
.max_brightness = 1,
.brightness_set = shark_led_set_red,
},
diff --git a/drivers/media/radio/radio-shark2.c b/drivers/media/radio/radio-shark2.c
index d150f12382c6..776877a294d8 100644
--- a/drivers/media/radio/radio-shark2.c
+++ b/drivers/media/radio/radio-shark2.c
@@ -189,13 +189,13 @@ static void shark_led_set_red(struct led_classdev *led_cdev,
static const struct led_classdev shark_led_templates[NO_LEDS] = {
[BLUE_LED] = {
.name = "%s:blue:",
- .brightness = LED_OFF,
+ .brightness = 0,
.max_brightness = 127,
.brightness_set = shark_led_set_blue,
},
[RED_LED] = {
.name = "%s:red:",
- .brightness = LED_OFF,
+ .brightness = 0,
.max_brightness = 1,
.brightness_set = shark_led_set_red,
},
--
2.34.1

2022-01-22 01:59:34

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 11/31] media: rc: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/media/rc/rc-main.c | 4 ++--
drivers/media/rc/redrat3.c | 4 ++--
drivers/media/rc/ttusbir.c | 4 ++--
drivers/media/rc/winbond-cir.c | 6 +++---
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index b90438a71c80..76580f1920e2 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -641,7 +641,7 @@ static void ir_do_keyup(struct rc_dev *dev, bool sync)
dev_dbg(&dev->dev, "keyup key 0x%04x\n", dev->last_keycode);
del_timer(&dev->timer_repeat);
input_report_key(dev->input_dev, dev->last_keycode, 0);
- led_trigger_event(led_feedback, LED_OFF);
+ led_trigger_event(led_feedback, 0);
if (sync)
input_sync(dev->input_dev);
dev->keypressed = false;
@@ -812,7 +812,7 @@ static void ir_do_keydown(struct rc_dev *dev, enum rc_proto protocol,
dev->device_name, keycode, protocol, scancode);
input_report_key(dev->input_dev, keycode, 1);

- led_trigger_event(led_feedback, LED_FULL);
+ led_trigger_event(led_feedback, 255);
}

/*
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index cb22316b3f00..7c255f7d790c 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -855,7 +855,7 @@ static void redrat3_brightness_set(struct led_classdev *led_dev, enum
struct redrat3_dev *rr3 = container_of(led_dev, struct redrat3_dev,
led);

- if (brightness != LED_OFF && atomic_cmpxchg(&rr3->flash, 0, 1) == 0) {
+ if (brightness != 0 && atomic_cmpxchg(&rr3->flash, 0, 1) == 0) {
int ret = usb_submit_urb(rr3->flash_urb, GFP_ATOMIC);
if (ret != 0) {
dev_dbg(rr3->dev, "%s: unexpected ret of %d\n",
@@ -919,7 +919,7 @@ static void redrat3_led_complete(struct urb *urb)
break;
}

- rr3->led.brightness = LED_OFF;
+ rr3->led.brightness = 0;
atomic_dec(&rr3->flash);
}

diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index 629787d53ee1..a295112644c3 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -44,7 +44,7 @@ static enum led_brightness ttusbir_brightness_get(struct led_classdev *led_dev)
{
struct ttusbir *tt = container_of(led_dev, struct ttusbir, led);

- return tt->led_on ? LED_FULL : LED_OFF;
+ return tt->led_on ? 255 : 0;
}

static void ttusbir_set_led(struct ttusbir *tt)
@@ -70,7 +70,7 @@ static void ttusbir_brightness_set(struct led_classdev *led_dev, enum
{
struct ttusbir *tt = container_of(led_dev, struct ttusbir, led);

- tt->led_on = brightness != LED_OFF;
+ tt->led_on = brightness != 0;

ttusbir_set_led(tt);
}
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index 94efb035d21b..d14e495a8641 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -265,7 +265,7 @@ wbcir_led_brightness_get(struct led_classdev *led_cdev)
if (inb(data->ebase + WBCIR_REG_ECEIR_CTS) & WBCIR_LED_ENABLE)
return LED_FULL;
else
- return LED_OFF;
+ return 0;
}

static void
@@ -277,7 +277,7 @@ wbcir_led_brightness_set(struct led_classdev *led_cdev,
led);

wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CTS,
- brightness == LED_OFF ? 0x00 : WBCIR_LED_ENABLE,
+ brightness == 0 ? 0x00 : WBCIR_LED_ENABLE,
WBCIR_LED_ENABLE);
}

@@ -1167,7 +1167,7 @@ wbcir_remove(struct pnp_dev *device)
led_classdev_unregister(&data->led);

/* This is ok since &data->led isn't actually used */
- wbcir_led_brightness_set(&data->led, LED_OFF);
+ wbcir_led_brightness_set(&data->led, 0);

release_region(data->wbase, WAKEUP_IOMEM_LEN);
release_region(data->ebase, EHFUNC_IOMEM_LEN);
--
2.34.1

2022-01-22 01:59:38

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 12/31] media: v4l2-core: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/media/v4l2-core/v4l2-flash-led-class.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c
index e70e128ccc9c..a47ac654c9f4 100644
--- a/drivers/media/v4l2-core/v4l2-flash-led-class.c
+++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
@@ -234,11 +234,11 @@ static int v4l2_flash_s_ctrl(struct v4l2_ctrl *c)
case V4L2_CID_FLASH_LED_MODE:
switch (c->val) {
case V4L2_FLASH_LED_MODE_NONE:
- led_set_brightness_sync(led_cdev, LED_OFF);
+ led_set_brightness_sync(led_cdev, 0);
return led_set_flash_strobe(fled_cdev, false);
case V4L2_FLASH_LED_MODE_FLASH:
/* Turn the torch LED off */
- led_set_brightness_sync(led_cdev, LED_OFF);
+ led_set_brightness_sync(led_cdev, 0);
if (ctrls[STROBE_SOURCE]) {
external_strobe = (ctrls[STROBE_SOURCE]->val ==
V4L2_FLASH_STROBE_SOURCE_EXTERNAL);
--
2.34.1

2022-01-22 01:59:48

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 13/31] mmc: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/mmc/core/core.c | 4 ++--
drivers/mmc/host/rtsx_usb_sdmmc.c | 4 ++--
drivers/mmc/host/sdhci.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 368f10405e13..66bc9c780e06 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -175,7 +175,7 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
mmc_should_fail_request(host, mrq);

if (!host->ongoing_mrq)
- led_trigger_event(host->led, LED_OFF);
+ led_trigger_event(host->led, 0);

if (mrq->sbc) {
pr_debug("%s: req done <CMD%u>: %d: %08x %08x %08x %08x\n",
@@ -352,7 +352,7 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
if (err)
return err;

- led_trigger_event(host->led, LED_FULL);
+ led_trigger_event(host->led, 255);
__mmc_start_request(host, mrq);

return 0;
diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index 5fe4528e296e..64fe7a75f401 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -1287,7 +1287,7 @@ static void rtsx_usb_update_led(struct work_struct *work)
if (host->power_mode == MMC_POWER_OFF)
goto out;

- if (host->led.brightness == LED_OFF)
+ if (host->led.brightness == 0)
rtsx_usb_turn_off_led(ucr);
else
rtsx_usb_turn_on_led(ucr);
@@ -1357,7 +1357,7 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
snprintf(host->led_name, sizeof(host->led_name),
"%s::", mmc_hostname(mmc));
host->led.name = host->led_name;
- host->led.brightness = LED_OFF;
+ host->led.brightness = 0;
host->led.default_trigger = mmc_hostname(mmc);
host->led.brightness_set = rtsx_usb_led_control;

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 07c6da1f2f0f..ddc58a8f0c4f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -395,7 +395,7 @@ static void sdhci_led_control(struct led_classdev *led,
if (host->runtime_suspended)
goto out;

- if (brightness == LED_OFF)
+ if (brightness == 0)
__sdhci_led_deactivate(host);
else
__sdhci_led_activate(host);
@@ -414,7 +414,7 @@ static int sdhci_led_register(struct sdhci_host *host)
"%s::", mmc_hostname(mmc));

host->led.name = host->led_name;
- host->led.brightness = LED_OFF;
+ host->led.brightness = 0;
host->led.default_trigger = mmc_hostname(mmc);
host->led.brightness_set = sdhci_led_control;

--
2.34.1

2022-01-22 01:59:55

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 16/31] net: broadcom: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/net/wireless/broadcom/b43/leds.c | 2 +-
drivers/net/wireless/broadcom/b43legacy/leds.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43/leds.c b/drivers/net/wireless/broadcom/b43/leds.c
index 982a772a9d87..bdb46168e019 100644
--- a/drivers/net/wireless/broadcom/b43/leds.c
+++ b/drivers/net/wireless/broadcom/b43/leds.c
@@ -59,7 +59,7 @@ static void b43_led_update(struct b43_wldev *dev,
* with the brightness_set handler, we will be called again soon
* to fixup our state. */
if (radio_enabled)
- turn_on = atomic_read(&led->state) != LED_OFF;
+ turn_on = atomic_read(&led->state) != 0;
else
turn_on = false;
if (turn_on == led->hw_state)
diff --git a/drivers/net/wireless/broadcom/b43legacy/leds.c b/drivers/net/wireless/broadcom/b43legacy/leds.c
index 38b5be3a84e2..5803d41185e7 100644
--- a/drivers/net/wireless/broadcom/b43legacy/leds.c
+++ b/drivers/net/wireless/broadcom/b43legacy/leds.c
@@ -66,7 +66,7 @@ static void b43legacy_led_brightness_set(struct led_classdev *led_dev,
* whether the LED has the wrong state for a second. */
radio_enabled = (dev->phy.radio_on && dev->radio_hw_enable);

- if (brightness == LED_OFF || !radio_enabled)
+ if (brightness == 0 || !radio_enabled)
b43legacy_led_turn_off(dev, led->index, led->activelow);
else
b43legacy_led_turn_on(dev, led->index, led->activelow);
--
2.34.1

2022-01-22 02:00:00

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 01/31] gpu: nouveau: nouveau_led: changing LED_FULL to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/gpu/drm/nouveau/nouveau_led.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_led.c b/drivers/gpu/drm/nouveau/nouveau_led.c
index 2c5e0628da12..df4a734510e1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_led.c
+++ b/drivers/gpu/drm/nouveau/nouveau_led.c
@@ -45,7 +45,7 @@ nouveau_led_get_brightness(struct led_classdev *led)
duty = nvif_rd32(device, 0x61c884) & 0x00ffffff;

if (div > 0)
- return duty * LED_FULL / div;
+ return duty * 255 / div;
else
return 0;
}
@@ -62,7 +62,7 @@ nouveau_led_set_brightness(struct led_classdev *led, enum led_brightness value)
u32 div, duty;

div = input_clk / freq;
- duty = value * div / LED_FULL;
+ duty = value * div / 255;

/* for now, this is safe to directly poke those registers because:
* - A: nvidia never puts the logo led to any other PWM controler
--
2.34.1

2022-01-22 02:00:01

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 02/31] hid: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/hid/hid-bigbenff.c | 10 +++++-----
drivers/hid/hid-elan.c | 2 +-
drivers/hid/hid-lenovo.c | 2 +-
drivers/hid/hid-lg4ff.c | 10 +++++-----
drivers/hid/hid-picolcd_leds.c | 6 +++---
drivers/hid/hid-playstation.c | 2 +-
drivers/hid/hid-sony.c | 4 ++--
drivers/hid/hid-steelseries.c | 14 +++++++-------
drivers/hid/hid-u2fzero.c | 4 ++--
drivers/hid/hid-wiimote-modules.c | 4 ++--
drivers/hid/wacom_sys.c | 16 ++++++++--------
drivers/hid/wacom_wac.c | 2 +-
12 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c
index 74ad8bf98bfd..3882b514f581 100644
--- a/drivers/hid/hid-bigbenff.c
+++ b/drivers/hid/hid-bigbenff.c
@@ -267,7 +267,7 @@ static void bigben_set_led(struct led_classdev *led,

for (n = 0; n < NUM_LEDS; n++) {
if (led == bigben->leds[n]) {
- if (value == LED_OFF) {
+ if (value == 0) {
work = (bigben->led_state & BIT(n));
bigben->led_state &= ~BIT(n);
} else {
@@ -293,15 +293,15 @@ static enum led_brightness bigben_get_led(struct led_classdev *led)

if (!bigben) {
hid_err(hid, "no device data\n");
- return LED_OFF;
+ return 0;
}

for (n = 0; n < NUM_LEDS; n++) {
if (led == bigben->leds[n])
- return (bigben->led_state & BIT(n)) ? LED_ON : LED_OFF;
+ return (bigben->led_state & BIT(n)) ? 1 : 0;
}

- return LED_OFF;
+ return 0;
}

static void bigben_remove(struct hid_device *hid)
@@ -375,7 +375,7 @@ static int bigben_probe(struct hid_device *hid,
dev_name(&hid->dev), n + 1
);
led->name = name;
- led->brightness = (n == 0) ? LED_ON : LED_OFF;
+ led->brightness = (n == 0) ? 1 : 0;
led->max_brightness = 1;
led->brightness_get = bigben_get_led;
led->brightness_set = bigben_set_led;
diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c
index 3091355d48df..44c20b60ba3e 100644
--- a/drivers/hid/hid-elan.c
+++ b/drivers/hid/hid-elan.c
@@ -453,7 +453,7 @@ static int elan_init_mute_led(struct hid_device *hdev)
mute_led->name = "elan:red:mute";
mute_led->default_trigger = "audio-mute";
mute_led->brightness_set_blocking = elan_mute_led_set_brigtness;
- mute_led->max_brightness = LED_ON;
+ mute_led->max_brightness = 1;
mute_led->flags = LED_HW_PLUGGABLE;
mute_led->dev = &hdev->dev;

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 93b1f935e526..b65d3a5175d5 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -842,7 +842,7 @@ static int lenovo_led_brightness_set(struct led_classdev *led_cdev,
if (led_cdev == &data_pointer->led_micmute)
led_nr = 1;

- if (value == LED_OFF)
+ if (value == 0)
data_pointer->led_state &= ~(1 << led_nr);
else
data_pointer->led_state |= 1 << led_nr;
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 5e6a0cef2a06..6e65f92e6aec 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -1136,10 +1136,10 @@ static void lg4ff_led_set_brightness(struct led_classdev *led_cdev,
if (led_cdev != entry->wdata.led[i])
continue;
state = (entry->wdata.led_state >> i) & 1;
- if (value == LED_OFF && state) {
+ if (value == 0 && state) {
entry->wdata.led_state &= ~(1 << i);
lg4ff_set_leds(hid, entry->wdata.led_state);
- } else if (value != LED_OFF && !state) {
+ } else if (value != 0 && !state) {
entry->wdata.led_state |= 1 << i;
lg4ff_set_leds(hid, entry->wdata.led_state);
}
@@ -1157,14 +1157,14 @@ static enum led_brightness lg4ff_led_get_brightness(struct led_classdev *led_cde

if (!drv_data) {
hid_err(hid, "Device data not found.");
- return LED_OFF;
+ return 0;
}

entry = drv_data->device_props;

if (!entry) {
hid_err(hid, "Device properties not found.");
- return LED_OFF;
+ return 0;
}

for (i = 0; i < 5; i++)
@@ -1173,7 +1173,7 @@ static enum led_brightness lg4ff_led_get_brightness(struct led_classdev *led_cde
break;
}

- return value ? LED_FULL : LED_OFF;
+ return value ? 255 : 0;
}
#endif

diff --git a/drivers/hid/hid-picolcd_leds.c b/drivers/hid/hid-picolcd_leds.c
index 6b505a753511..b000ee63b1c9 100644
--- a/drivers/hid/hid-picolcd_leds.c
+++ b/drivers/hid/hid-picolcd_leds.c
@@ -64,10 +64,10 @@ static void picolcd_led_set_brightness(struct led_classdev *led_cdev,
if (led_cdev != data->led[i])
continue;
state = (data->led_state >> i) & 1;
- if (value == LED_OFF && state) {
+ if (value == 0 && state) {
data->led_state &= ~(1 << i);
picolcd_leds_set(data);
- } else if (value != LED_OFF && !state) {
+ } else if (value != 0 && !state) {
data->led_state |= 1 << i;
picolcd_leds_set(data);
}
@@ -90,7 +90,7 @@ static enum led_brightness picolcd_led_get_brightness(struct led_classdev *led_c
value = (data->led_state >> i) & 1;
break;
}
- return value ? LED_FULL : LED_OFF;
+ return value ? 255 : 0;
}

int picolcd_init_leds(struct picolcd_data *data, struct hid_report *report)
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index b1b5721b5d8f..95ed22a533ec 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -873,7 +873,7 @@ static int dualsense_player_led_set_brightness(struct led_classdev *led, enum le
spin_lock_irqsave(&ds->base.lock, flags);

led_index = led - ds->player_leds;
- if (value == LED_OFF)
+ if (value == 0)
ds->player_leds_state &= ~BIT(led_index);
else
ds->player_leds_state |= BIT(led_index);
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 60ec2b29d54d..f4198cd8b94d 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -2048,7 +2048,7 @@ static enum led_brightness sony_led_get_brightness(struct led_classdev *led)
drv_data = hid_get_drvdata(hdev);
if (!drv_data) {
hid_err(hdev, "No device data\n");
- return LED_OFF;
+ return 0;
}

for (n = 0; n < drv_data->led_count; n++) {
@@ -2056,7 +2056,7 @@ static enum led_brightness sony_led_get_brightness(struct led_classdev *led)
return drv_data->led_state[n];
}

- return LED_OFF;
+ return 0;
}

static int sony_led_blink_set(struct led_classdev *led, unsigned long *delay_on,
diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 37353c41cba7..b53587891b32 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -146,7 +146,7 @@ static void steelseries_srws1_led_all_set_brightness(struct led_classdev *led_cd
return;
}

- if (value == LED_OFF)
+ if (value == 0)
drv_data->led_state = 0;
else
drv_data->led_state = (1 << (SRWS1_NUMBER_LEDS + 1)) - 1;
@@ -164,10 +164,10 @@ static enum led_brightness steelseries_srws1_led_all_get_brightness(struct led_c

if (!drv_data) {
hid_err(hid, "Device data not found.");
- return LED_OFF;
+ return 0;
}

- return (drv_data->led_state >> SRWS1_NUMBER_LEDS) ? LED_FULL : LED_OFF;
+ return (drv_data->led_state >> SRWS1_NUMBER_LEDS) ? 255 : 0;
}

static void steelseries_srws1_led_set_brightness(struct led_classdev *led_cdev,
@@ -188,10 +188,10 @@ static void steelseries_srws1_led_set_brightness(struct led_classdev *led_cdev,
continue;

state = (drv_data->led_state >> i) & 1;
- if (value == LED_OFF && state) {
+ if (value == 0 && state) {
drv_data->led_state &= ~(1 << i);
steelseries_srws1_set_leds(hid, drv_data->led_state);
- } else if (value != LED_OFF && !state) {
+ } else if (value != 0 && !state) {
drv_data->led_state |= 1 << i;
steelseries_srws1_set_leds(hid, drv_data->led_state);
}
@@ -210,7 +210,7 @@ static enum led_brightness steelseries_srws1_led_get_brightness(struct led_class

if (!drv_data) {
hid_err(hid, "Device data not found.");
- return LED_OFF;
+ return 0;
}

for (i = 0; i < SRWS1_NUMBER_LEDS; i++)
@@ -219,7 +219,7 @@ static enum led_brightness steelseries_srws1_led_get_brightness(struct led_class
break;
}

- return value ? LED_FULL : LED_OFF;
+ return value ? 255 : 0;
}

static int steelseries_srws1_probe(struct hid_device *hdev,
diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c
index ad489caf53ad..1e73bd85b9b7 100644
--- a/drivers/hid/hid-u2fzero.c
+++ b/drivers/hid/hid-u2fzero.c
@@ -187,7 +187,7 @@ static int u2fzero_blink(struct led_classdev *ldev)
static int u2fzero_brightness_set(struct led_classdev *ldev,
enum led_brightness brightness)
{
- ldev->brightness = LED_OFF;
+ ldev->brightness = 0;
if (brightness)
return u2fzero_blink(ldev);
else
@@ -244,7 +244,7 @@ static int u2fzero_init_led(struct u2fzero_device *dev,
return -ENOMEM;

dev->ldev.name = dev->led_name;
- dev->ldev.max_brightness = LED_ON;
+ dev->ldev.max_brightness = 1;
dev->ldev.flags = LED_HW_PLUGGABLE;
dev->ldev.brightness_set_blocking = u2fzero_brightness_set;

diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c
index 213c58bf2495..9416f0e2a092 100644
--- a/drivers/hid/hid-wiimote-modules.c
+++ b/drivers/hid/hid-wiimote-modules.c
@@ -308,7 +308,7 @@ static enum led_brightness wiimod_led_get(struct led_classdev *led_dev)
}
}

- return value ? LED_FULL : LED_OFF;
+ return value ? 255 : 0;
}

static void wiimod_led_set(struct led_classdev *led_dev,
@@ -325,7 +325,7 @@ static void wiimod_led_set(struct led_classdev *led_dev,
flag = WIIPROTO_FLAG_LED(i + 1);
spin_lock_irqsave(&wdata->state.lock, flags);
state = wdata->state.flags;
- if (value == LED_OFF)
+ if (value == 0)
wiiproto_req_leds(wdata, state & ~flag);
else
wiiproto_req_leds(wdata, state | flag);
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 066c567dbaa2..9b0786f48867 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -1304,13 +1304,13 @@ enum led_brightness wacom_leds_brightness_get(struct wacom_led *led)
struct wacom *wacom = led->wacom;

if (wacom->led.max_hlv)
- return led->hlv * LED_FULL / wacom->led.max_hlv;
+ return led->hlv * 255 / wacom->led.max_hlv;

if (wacom->led.max_llv)
- return led->llv * LED_FULL / wacom->led.max_llv;
+ return led->llv * 255 / wacom->led.max_llv;

/* device doesn't support brightness tuning */
- return LED_FULL;
+ return 255;
}

static enum led_brightness __wacom_led_brightness_get(struct led_classdev *cdev)
@@ -1319,7 +1319,7 @@ static enum led_brightness __wacom_led_brightness_get(struct led_classdev *cdev)
struct wacom *wacom = led->wacom;

if (wacom->led.groups[led->group].select != led->id)
- return LED_OFF;
+ return 0;

return wacom_leds_brightness_get(led);
}
@@ -1333,14 +1333,14 @@ static int wacom_led_brightness_set(struct led_classdev *cdev,

mutex_lock(&wacom->lock);

- if (!wacom->led.groups || (brightness == LED_OFF &&
+ if (!wacom->led.groups || (brightness == 0 &&
wacom->led.groups[led->group].select != led->id)) {
error = 0;
goto out;
}

- led->llv = wacom->led.llv = wacom->led.max_llv * brightness / LED_FULL;
- led->hlv = wacom->led.hlv = wacom->led.max_hlv * brightness / LED_FULL;
+ led->llv = wacom->led.llv = wacom->led.max_llv * brightness / 255;
+ led->hlv = wacom->led.hlv = wacom->led.max_hlv * brightness / 255;

wacom->led.groups[led->group].select = led->id;

@@ -1389,7 +1389,7 @@ static int wacom_led_register_one(struct device *dev, struct wacom *wacom,
led->llv = wacom->led.llv;
led->hlv = wacom->led.hlv;
led->cdev.name = name;
- led->cdev.max_brightness = LED_FULL;
+ led->cdev.max_brightness = 255;
led->cdev.flags = LED_HW_PLUGGABLE;
led->cdev.brightness_get = __wacom_led_brightness_get;
if (!read_only) {
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 2a4cc39962e7..d47e8c59aa4d 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -3958,7 +3958,7 @@ static void wacom_24hd_update_leds(struct wacom *wacom, int mask, int group)
}
if (!updated && mask & BIT(i)) {
led->held = true;
- led_trigger_event(&led->trigger, LED_FULL);
+ led_trigger_event(&led->trigger, 255);
} else {
led->held = false;
}
--
2.34.1

2022-01-22 02:00:02

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 23/31] usb: core: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/usb/core/ledtrig-usbport.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c
index ba371a24ff78..85fa5699bb3d 100644
--- a/drivers/usb/core/ledtrig-usbport.c
+++ b/drivers/usb/core/ledtrig-usbport.c
@@ -73,7 +73,7 @@ static void usbport_trig_update_count(struct usbport_trig_data *usbport_data)

usbport_data->count = 0;
usb_for_each_dev(usbport_data, usbport_trig_usb_dev_check);
- led_set_brightness(led_cdev, usbport_data->count ? LED_FULL : LED_OFF);
+ led_set_brightness(led_cdev, usbport_data->count ? 255 : 0);
}

/***************************************
@@ -287,12 +287,12 @@ static int usbport_trig_notify(struct notifier_block *nb, unsigned long action,
case USB_DEVICE_ADD:
usbport_trig_add_usb_dev_ports(usb_dev, usbport_data);
if (observed && usbport_data->count++ == 0)
- led_set_brightness(led_cdev, LED_FULL);
+ led_set_brightness(led_cdev, 255);
return NOTIFY_OK;
case USB_DEVICE_REMOVE:
usbport_trig_remove_usb_dev_ports(usbport_data, usb_dev);
if (observed && --usbport_data->count == 0)
- led_set_brightness(led_cdev, LED_OFF);
+ led_set_brightness(led_cdev, 0);
return NOTIFY_OK;
}

--
2.34.1

2022-01-22 02:00:08

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 05/31] input: keyboard: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/input/keyboard/cap11xx.c | 2 +-
drivers/input/keyboard/qt2160.c | 6 +++---
drivers/input/keyboard/tm2-touchkey.c | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index 7c85343cd32f..04c03157ef8a 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -290,7 +290,7 @@ static int cap11xx_init_leds(struct device *dev,
led->cdev.flags = 0;
led->cdev.brightness_set_blocking = cap11xx_led_set;
led->cdev.max_brightness = 1;
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;

error = of_property_read_u32(child, "reg", &reg);
if (error != 0 || reg >= num_leds) {
diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c
index 32d4a076eaa3..b80c2195dabb 100644
--- a/drivers/input/keyboard/qt2160.c
+++ b/drivers/input/keyboard/qt2160.c
@@ -78,7 +78,7 @@ static int qt2160_led_set(struct led_classdev *cdev,
if (value != led->brightness) {
drive = qt2160_read(client, QT2160_CMD_DRIVE_X);
pwmen = qt2160_read(client, QT2160_CMD_PWMEN_X);
- if (value != LED_OFF) {
+ if (value != 0) {
drive |= BIT(led->id);
pwmen |= BIT(led->id);

@@ -93,7 +93,7 @@ static int qt2160_led_set(struct led_classdev *cdev,
* Changing this register will change the brightness
* of every LED in the qt2160. It's a HW limitation.
*/
- if (value != LED_OFF)
+ if (value != 0)
qt2160_write(client, QT2160_CMD_PWM_DUTY, value);

led->brightness = value;
@@ -269,7 +269,7 @@ static int qt2160_register_leds(struct qt2160_data *qt2160)
snprintf(led->name, sizeof(led->name), "qt2160:x%d", i);
led->cdev.name = led->name;
led->cdev.brightness_set_blocking = qt2160_led_set;
- led->cdev.brightness = LED_OFF;
+ led->cdev.brightness = 0;
led->id = i;
led->qt2160 = qt2160;

diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
index 632cd6c1c8d4..b28ebbc75d11 100644
--- a/drivers/input/keyboard/tm2-touchkey.c
+++ b/drivers/input/keyboard/tm2-touchkey.c
@@ -91,7 +91,7 @@ static int tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
u32 volt;
u8 data;

- if (brightness == LED_OFF) {
+ if (brightness == 0) {
volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
data = touchkey->variant->cmd_led_off;
} else {
@@ -173,9 +173,9 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
if (touchkey->variant->fixed_regulator &&
data & TM2_TOUCHKEY_BIT_PRESS_EV) {
/* touch turns backlight on, so make sure we're in sync */
- if (touchkey->led_dev.brightness == LED_OFF)
+ if (touchkey->led_dev.brightness == 0)
tm2_touchkey_led_brightness_set(&touchkey->led_dev,
- LED_OFF);
+ 0);
}

return IRQ_HANDLED;
@@ -280,8 +280,8 @@ static int tm2_touchkey_probe(struct i2c_client *client,

/* led device */
touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
- touchkey->led_dev.brightness = LED_ON;
- touchkey->led_dev.max_brightness = LED_ON;
+ touchkey->led_dev.brightness = 1;
+ touchkey->led_dev.max_brightness = 1;
touchkey->led_dev.brightness_set_blocking =
tm2_touchkey_led_brightness_set;

@@ -293,7 +293,7 @@ static int tm2_touchkey_probe(struct i2c_client *client,
}

if (touchkey->variant->fixed_regulator)
- tm2_touchkey_led_brightness_set(&touchkey->led_dev, LED_ON);
+ tm2_touchkey_led_brightness_set(&touchkey->led_dev, 1);

return 0;
}
--
2.34.1

2022-01-22 02:00:18

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 07/31] input: touchscreen: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/input/touchscreen/stmfts.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
index bc11203c9cf7..7e7cb5f4d6d3 100644
--- a/drivers/input/touchscreen/stmfts.c
+++ b/drivers/input/touchscreen/stmfts.c
@@ -608,8 +608,8 @@ static int stmfts_enable_led(struct stmfts_data *sdata)
return PTR_ERR(sdata->ledvdd);

sdata->led_cdev.name = STMFTS_DEV_NAME;
- sdata->led_cdev.max_brightness = LED_ON;
- sdata->led_cdev.brightness = LED_OFF;
+ sdata->led_cdev.max_brightness = 1;
+ sdata->led_cdev.brightness = 0;
sdata->led_cdev.brightness_set_blocking = stmfts_brightness_set;
sdata->led_cdev.brightness_get = stmfts_brightness_get;

--
2.34.1

2022-01-22 02:00:23

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 09/31] macintosh: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/macintosh/via-pmu-led.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index ae067ab2373d..b0a727ad0157 100644
--- a/drivers/macintosh/via-pmu-led.c
+++ b/drivers/macintosh/via-pmu-led.c
@@ -54,7 +54,7 @@ static void pmu_led_set(struct led_classdev *led_cdev,

spin_lock_irqsave(&pmu_blink_lock, flags);
switch (brightness) {
- case LED_OFF:
+ case 0:
requested_change = 0;
break;
case LED_FULL:
--
2.34.1

2022-01-22 02:00:25

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 26/31] net: bluetooth: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
net/bluetooth/leds.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/leds.c b/net/bluetooth/leds.c
index f46847632ffa..7f7e3eed9407 100644
--- a/net/bluetooth/leds.c
+++ b/net/bluetooth/leds.c
@@ -22,7 +22,7 @@ void hci_leds_update_powered(struct hci_dev *hdev, bool enabled)
{
if (hdev->power_led)
led_trigger_event(hdev->power_led,
- enabled ? LED_FULL : LED_OFF);
+ enabled ? 255 : 0);

if (!enabled) {
struct hci_dev *d;
@@ -37,7 +37,7 @@ void hci_leds_update_powered(struct hci_dev *hdev, bool enabled)
read_unlock(&hci_dev_list_lock);
}

- led_trigger_event(bt_power_led_trigger, enabled ? LED_FULL : LED_OFF);
+ led_trigger_event(bt_power_led_trigger, enabled ? 255 : 0);
}

static int power_activate(struct led_classdev *led_cdev)
@@ -48,7 +48,7 @@ static int power_activate(struct led_classdev *led_cdev)
htrig = to_hci_basic_led_trigger(led_cdev->trigger);
powered = test_bit(HCI_UP, &htrig->hdev->flags);

- led_trigger_event(led_cdev->trigger, powered ? LED_FULL : LED_OFF);
+ led_trigger_event(led_cdev->trigger, powered ? 255 : 0);

return 0;
}
--
2.34.1

2022-01-22 02:00:48

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 21/31] power: supply: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/power/supply/power_supply_leds.c | 26 ++++++++++++------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/power/supply/power_supply_leds.c b/drivers/power/supply/power_supply_leds.c
index d69880cc3593..16f25179f710 100644
--- a/drivers/power/supply/power_supply_leds.c
+++ b/drivers/power/supply/power_supply_leds.c
@@ -31,25 +31,25 @@ static void power_supply_update_bat_leds(struct power_supply *psy)

switch (status.intval) {
case POWER_SUPPLY_STATUS_FULL:
- led_trigger_event(psy->charging_full_trig, LED_FULL);
- led_trigger_event(psy->charging_trig, LED_OFF);
- led_trigger_event(psy->full_trig, LED_FULL);
+ led_trigger_event(psy->charging_full_trig, 255);
+ led_trigger_event(psy->charging_trig, 0);
+ led_trigger_event(psy->full_trig, 255);
led_trigger_event(psy->charging_blink_full_solid_trig,
- LED_FULL);
+ 255);
break;
case POWER_SUPPLY_STATUS_CHARGING:
- led_trigger_event(psy->charging_full_trig, LED_FULL);
- led_trigger_event(psy->charging_trig, LED_FULL);
- led_trigger_event(psy->full_trig, LED_OFF);
+ led_trigger_event(psy->charging_full_trig, 255);
+ led_trigger_event(psy->charging_trig, 255);
+ led_trigger_event(psy->full_trig, 0);
led_trigger_blink(psy->charging_blink_full_solid_trig,
&delay_on, &delay_off);
break;
default:
- led_trigger_event(psy->charging_full_trig, LED_OFF);
- led_trigger_event(psy->charging_trig, LED_OFF);
- led_trigger_event(psy->full_trig, LED_OFF);
+ led_trigger_event(psy->charging_full_trig, 0);
+ led_trigger_event(psy->charging_trig, 0);
+ led_trigger_event(psy->full_trig, 0);
led_trigger_event(psy->charging_blink_full_solid_trig,
- LED_OFF);
+ 0);
break;
}
}
@@ -120,9 +120,9 @@ static void power_supply_update_gen_leds(struct power_supply *psy)
dev_dbg(&psy->dev, "%s %d\n", __func__, online.intval);

if (online.intval)
- led_trigger_event(psy->online_trig, LED_FULL);
+ led_trigger_event(psy->online_trig, 255);
else
- led_trigger_event(psy->online_trig, LED_OFF);
+ led_trigger_event(psy->online_trig, 0);
}

static int power_supply_create_gen_triggers(struct power_supply *psy)
--
2.34.1

2022-01-22 02:01:08

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 20/31] platform: x86: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/platform/x86/acer-wmi.c | 6 ++---
drivers/platform/x86/asus-wireless.c | 6 ++---
drivers/platform/x86/dell/dell-laptop.c | 2 +-
drivers/platform/x86/dell/dell-wmi-led.c | 4 ++--
drivers/platform/x86/fujitsu-laptop.c | 28 ++++++++++++------------
drivers/platform/x86/lg-laptop.c | 18 +++++++--------
drivers/platform/x86/system76_acpi.c | 4 ++--
drivers/platform/x86/thinkpad_acpi.c | 14 ++++++------
drivers/platform/x86/topstar-laptop.c | 4 ++--
drivers/platform/x86/toshiba_acpi.c | 24 ++++++++++----------
10 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 9c6943e401a6..ce960164a397 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1597,7 +1597,7 @@ static int acer_led_init(struct device *dev)

static void acer_led_exit(void)
{
- set_u32(LED_OFF, ACER_CAP_MAILLED);
+ set_u32(0, ACER_CAP_MAILLED);
led_classdev_unregister(&mail_led);
}

@@ -2332,7 +2332,7 @@ static int acer_suspend(struct device *dev)

if (has_cap(ACER_CAP_MAILLED)) {
get_u32(&value, ACER_CAP_MAILLED);
- set_u32(LED_OFF, ACER_CAP_MAILLED);
+ set_u32(0, ACER_CAP_MAILLED);
data->mailled = value;
}

@@ -2377,7 +2377,7 @@ static void acer_platform_shutdown(struct platform_device *device)
return;

if (has_cap(ACER_CAP_MAILLED))
- set_u32(LED_OFF, ACER_CAP_MAILLED);
+ set_u32(0, ACER_CAP_MAILLED);
}

static struct platform_driver acer_platform_driver = {
diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
index d3e7171928e5..139257bf71ea 100644
--- a/drivers/platform/x86/asus-wireless.c
+++ b/drivers/platform/x86/asus-wireless.c
@@ -84,8 +84,8 @@ static enum led_brightness led_state_get(struct led_classdev *led)
s = asus_wireless_method(acpi_device_handle(data->adev), "HSWC",
data->hswc_params->status, &ret);
if (ACPI_SUCCESS(s) && ret == data->hswc_params->on)
- return LED_FULL;
- return LED_OFF;
+ return 255;
+ return 0;
}

static void led_state_update(struct work_struct *work)
@@ -103,7 +103,7 @@ static void led_state_set(struct led_classdev *led, enum led_brightness value)
struct asus_wireless_data *data;

data = container_of(led, struct asus_wireless_data, led);
- data->led_state = value == LED_OFF ? data->hswc_params->off :
+ data->led_state = value == 0 ? data->hswc_params->off :
data->hswc_params->on;
queue_work(data->wq, &data->led_work);
}
diff --git a/drivers/platform/x86/dell/dell-laptop.c b/drivers/platform/x86/dell/dell-laptop.c
index 8230e7a68a5e..4dd530e3b47b 100644
--- a/drivers/platform/x86/dell/dell-laptop.c
+++ b/drivers/platform/x86/dell/dell-laptop.c
@@ -2141,7 +2141,7 @@ static int micmute_led_set(struct led_classdev *led_cdev,
{
struct calling_interface_buffer buffer;
struct calling_interface_token *token;
- int state = brightness != LED_OFF;
+ int state = brightness != 0;

if (state == 0)
token = dell_smbios_find_token(GLOBAL_MIC_MUTE_DISABLE);
diff --git a/drivers/platform/x86/dell/dell-wmi-led.c b/drivers/platform/x86/dell/dell-wmi-led.c
index 5bedaf7f0633..fcfd6dd60583 100644
--- a/drivers/platform/x86/dell/dell-wmi-led.c
+++ b/drivers/platform/x86/dell/dell-wmi-led.c
@@ -122,7 +122,7 @@ static int led_blink(unsigned char on_eighths, unsigned char off_eighths)
static void dell_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
- if (value == LED_OFF)
+ if (value == 0)
led_off();
else
led_on();
@@ -154,7 +154,7 @@ static int dell_led_blink(struct led_classdev *led_cdev,

static struct led_classdev dell_led = {
.name = "dell::lid",
- .brightness = LED_OFF,
+ .brightness = 0,
.max_brightness = 1,
.brightness_set = dell_led_set,
.blink_set = dell_led_blink,
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 80929380ec7e..6ebfda771209 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -584,10 +584,10 @@ static int logolamp_set(struct led_classdev *cdev,
int poweron = FUNC_LED_ON, always = FUNC_LED_ON;
int ret;

- if (brightness < LED_HALF)
+ if (brightness < 127)
poweron = FUNC_LED_OFF;

- if (brightness < LED_FULL)
+ if (brightness < 255)
always = FUNC_LED_OFF;

ret = call_fext_func(device, FUNC_LEDS, 0x1, LOGOLAMP_POWERON, poweron);
@@ -604,13 +604,13 @@ static enum led_brightness logolamp_get(struct led_classdev *cdev)

ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
if (ret == FUNC_LED_ON)
- return LED_FULL;
+ return 255;

ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
if (ret == FUNC_LED_ON)
- return LED_HALF;
+ return 127;

- return LED_OFF;
+ return 0;
}

static int kblamps_set(struct led_classdev *cdev,
@@ -618,7 +618,7 @@ static int kblamps_set(struct led_classdev *cdev,
{
struct acpi_device *device = to_acpi_device(cdev->dev->parent);

- if (brightness >= LED_FULL)
+ if (brightness >= 255)
return call_fext_func(device, FUNC_LEDS, 0x1, KEYBOARD_LAMPS,
FUNC_LED_ON);
else
@@ -629,11 +629,11 @@ static int kblamps_set(struct led_classdev *cdev,
static enum led_brightness kblamps_get(struct led_classdev *cdev)
{
struct acpi_device *device = to_acpi_device(cdev->dev->parent);
- enum led_brightness brightness = LED_OFF;
+ unsigned int brightness = 0;

if (call_fext_func(device,
FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON)
- brightness = LED_FULL;
+ brightness = 255;

return brightness;
}
@@ -643,7 +643,7 @@ static int radio_led_set(struct led_classdev *cdev,
{
struct acpi_device *device = to_acpi_device(cdev->dev->parent);

- if (brightness >= LED_FULL)
+ if (brightness >= 255)
return call_fext_func(device, FUNC_FLAGS, 0x5, RADIO_LED_ON,
RADIO_LED_ON);
else
@@ -654,10 +654,10 @@ static int radio_led_set(struct led_classdev *cdev,
static enum led_brightness radio_led_get(struct led_classdev *cdev)
{
struct acpi_device *device = to_acpi_device(cdev->dev->parent);
- enum led_brightness brightness = LED_OFF;
+ unsigned int brightness = 0;

if (call_fext_func(device, FUNC_FLAGS, 0x4, 0x0, 0x0) & RADIO_LED_ON)
- brightness = LED_FULL;
+ brightness = 255;

return brightness;
}
@@ -669,7 +669,7 @@ static int eco_led_set(struct led_classdev *cdev,
int curr;

curr = call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0);
- if (brightness >= LED_FULL)
+ if (brightness >= 255)
return call_fext_func(device, FUNC_LEDS, 0x1, ECO_LED,
curr | ECO_LED_ON);
else
@@ -680,10 +680,10 @@ static int eco_led_set(struct led_classdev *cdev,
static enum led_brightness eco_led_get(struct led_classdev *cdev)
{
struct acpi_device *device = to_acpi_device(cdev->dev->parent);
- enum led_brightness brightness = LED_OFF;
+ unsigned int brightness = 0;

if (call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
- brightness = LED_FULL;
+ brightness = 255;

return brightness;
}
diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
index a91847a551a7..cbcc945c2d9d 100644
--- a/drivers/platform/x86/lg-laptop.c
+++ b/drivers/platform/x86/lg-laptop.c
@@ -547,13 +547,13 @@ static void tpad_led_set(struct led_classdev *cdev,
{
union acpi_object *r;

- r = lg_wmab(WM_TLED, WM_SET, brightness > LED_OFF);
+ r = lg_wmab(WM_TLED, WM_SET, brightness > 0);
kfree(r);
}

static enum led_brightness tpad_led_get(struct led_classdev *cdev)
{
- return ggov(GOV_TLED) > 0 ? LED_ON : LED_OFF;
+ return ggov(GOV_TLED) > 0 ? 1 : 0;
}

static LED_DEVICE(tpad_led, 1, 0);
@@ -565,9 +565,9 @@ static void kbd_backlight_set(struct led_classdev *cdev,
union acpi_object *r;

val = 0x22;
- if (brightness <= LED_OFF)
+ if (brightness <= 0)
val = 0;
- if (brightness >= LED_FULL)
+ if (brightness >= 255)
val = 0x24;
r = lg_wmab(WM_KEY_LIGHT, WM_SET, val);
kfree(r);
@@ -581,22 +581,22 @@ static enum led_brightness get_kbd_backlight_level(void)
r = lg_wmab(WM_KEY_LIGHT, WM_GET, 0);

if (!r)
- return LED_OFF;
+ return 0;

if (r->type != ACPI_TYPE_BUFFER || r->buffer.pointer[1] != 0x05) {
kfree(r);
- return LED_OFF;
+ return 0;
}

switch (r->buffer.pointer[0] & 0x27) {
case 0x24:
- val = LED_FULL;
+ val = 255;
break;
case 0x22:
- val = LED_HALF;
+ val = 127;
break;
default:
- val = LED_OFF;
+ val = 0;
}

kfree(r);
diff --git a/drivers/platform/x86/system76_acpi.c b/drivers/platform/x86/system76_acpi.c
index 7299ad08c838..9f2b11a0e02f 100644
--- a/drivers/platform/x86/system76_acpi.c
+++ b/drivers/platform/x86/system76_acpi.c
@@ -299,7 +299,7 @@ static enum led_brightness ap_led_get(struct led_classdev *led)
if (value > 0)
return (enum led_brightness)value;
else
- return LED_OFF;
+ return 0;
}

// Set the airplane mode LED brightness
@@ -308,7 +308,7 @@ static int ap_led_set(struct led_classdev *led, enum led_brightness value)
struct system76_data *data;

data = container_of(led, struct system76_data, ap_led);
- return system76_set(data, "SAPL", value == LED_OFF ? 0 : 1);
+ return system76_set(data, "SAPL", value == 0 ? 0 : 1);
}

// Get the last set keyboard LED brightness
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 82fa6148216c..01fe0a2995fd 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -5421,13 +5421,13 @@ static int light_set_status(int status)
static int light_sysfs_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
- return light_set_status((brightness != LED_OFF) ?
+ return light_set_status((brightness != 0) ?
TPACPI_LED_ON : TPACPI_LED_OFF);
}

static enum led_brightness light_sysfs_get(struct led_classdev *led_cdev)
{
- return (light_get_status() == 1) ? LED_FULL : LED_OFF;
+ return (light_get_status() == 1) ? 255 : 0;
}

static struct tpacpi_led_classdev tpacpi_led_thinklight = {
@@ -5759,7 +5759,7 @@ static int led_sysfs_set(struct led_classdev *led_cdev,
struct tpacpi_led_classdev, led_classdev);
enum led_status_t new_state;

- if (brightness == LED_OFF)
+ if (brightness == 0)
new_state = TPACPI_LED_OFF;
else if (tpacpi_led_state_cache[data->led] != TPACPI_LED_BLINK)
new_state = TPACPI_LED_ON;
@@ -5796,9 +5796,9 @@ static enum led_brightness led_sysfs_get(struct led_classdev *led_cdev)
rc = led_get_status(data->led);

if (rc == TPACPI_LED_OFF || rc < 0)
- rc = LED_OFF; /* no error handling in led class :( */
+ rc = 0; /* no error handling in led class :( */
else
- rc = LED_FULL;
+ rc = 255;

return rc;
}
@@ -9145,13 +9145,13 @@ static int tpacpi_led_set(int whichled, bool on)
static int tpacpi_led_mute_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
- return tpacpi_led_set(LED_AUDIO_MUTE, brightness != LED_OFF);
+ return tpacpi_led_set(LED_AUDIO_MUTE, brightness != 0);
}

static int tpacpi_led_micmute_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
- return tpacpi_led_set(LED_AUDIO_MICMUTE, brightness != LED_OFF);
+ return tpacpi_led_set(LED_AUDIO_MICMUTE, brightness != 0);
}

static struct led_classdev mute_led_cdev[TPACPI_LED_MAX] = {
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
index f7761d98c0fd..1382b91c2860 100644
--- a/drivers/platform/x86/topstar-laptop.c
+++ b/drivers/platform/x86/topstar-laptop.c
@@ -71,8 +71,8 @@ static int topstar_led_set(struct led_classdev *led,
* it seems to be faulty on some models like the Topstar U931
* Notebook).
*/
- if ((ret == 0x30001 && state == LED_OFF)
- || (ret == 0x30000 && state != LED_OFF)) {
+ if ((ret == 0x30001 && state == 0)
+ || (ret == 0x30000 && state != 0)) {
status = acpi_execute_simple_method(topstar->device->handle,
"FNCX", 0x83);
if (ACPI_FAILURE(status))
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 352508d30467..641c6766febe 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -501,19 +501,19 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)

/* First request : initialize communication. */
if (!sci_open(dev))
- return LED_OFF;
+ return 0;

/* Check the illumination */
result = sci_read(dev, SCI_ILLUMINATION, &state);
sci_close(dev);
if (result == TOS_FAILURE) {
pr_err("ACPI call for illumination failed\n");
- return LED_OFF;
+ return 0;
} else if (result != TOS_SUCCESS) {
- return LED_OFF;
+ return 0;
}

- return state ? LED_FULL : LED_OFF;
+ return state ? 255 : 0;
}

/* KBD Illumination */
@@ -602,12 +602,12 @@ static enum led_brightness toshiba_kbd_backlight_get(struct led_classdev *cdev)
result = hci_read(dev, HCI_KBD_ILLUMINATION, &state);
if (result == TOS_FAILURE) {
pr_err("ACPI call to get the keyboard backlight failed\n");
- return LED_OFF;
+ return 0;
} else if (result != TOS_SUCCESS) {
- return LED_OFF;
+ return 0;
}

- return state ? LED_FULL : LED_OFF;
+ return state ? 255 : 0;
}

static void toshiba_kbd_backlight_set(struct led_classdev *cdev,
@@ -711,13 +711,13 @@ toshiba_eco_mode_get_status(struct led_classdev *cdev)
status = tci_raw(dev, in, out);
if (ACPI_FAILURE(status)) {
pr_err("ACPI call to get ECO led failed\n");
- return LED_OFF;
+ return 0;
}

if (out[0] != TOS_SUCCESS)
- return LED_OFF;
+ return 0;

- return out[2] ? LED_FULL : LED_OFF;
+ return out[2] ? 255 : 0;
}

static void toshiba_eco_mode_set_status(struct led_classdev *cdev,
@@ -2402,7 +2402,7 @@ static void toshiba_acpi_kbd_bl_work(struct work_struct *work)
toshiba_acpi->kbd_mode != SCI_KBD_MODE_AUTO)
led_classdev_notify_brightness_hw_changed(&toshiba_acpi->kbd_led,
(toshiba_acpi->kbd_mode == SCI_KBD_MODE_ON) ?
- LED_FULL : LED_OFF);
+ 255 : 0);

/* Emulate the keyboard backlight event */
acpi_bus_generate_netlink_event(toshiba_acpi->acpi_dev->pnp.device_class,
@@ -3225,7 +3225,7 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event)
if (dev->kbd_type == 2 && dev->kbd_mode != SCI_KBD_MODE_AUTO)
led_classdev_notify_brightness_hw_changed(&dev->kbd_led,
(dev->kbd_mode == SCI_KBD_MODE_ON) ?
- LED_FULL : LED_OFF);
+ 255 : 0);
break;
case 0x85: /* Unknown */
case 0x8d: /* Unknown */
--
2.34.1

2022-01-22 02:01:16

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 28/31] net: netfilter: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
net/netfilter/xt_LED.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/xt_LED.c b/net/netfilter/xt_LED.c
index 0371c387b0d1..eb66e12c7ff7 100644
--- a/net/netfilter/xt_LED.c
+++ b/net/netfilter/xt_LED.c
@@ -54,7 +54,7 @@ led_tg(struct sk_buff *skb, const struct xt_action_param *par)
led_trigger_blink_oneshot(&ledinternal->netfilter_led_trigger,
&led_delay, &led_delay, 1);
else
- led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL);
+ led_trigger_event(&ledinternal->netfilter_led_trigger, 255);

/* If there's a positive delay, start/update the timer */
if (ledinfo->delay > 0) {
@@ -63,7 +63,7 @@ led_tg(struct sk_buff *skb, const struct xt_action_param *par)

/* Otherwise if there was no delay given, blink as fast as possible */
} else if (ledinfo->delay == 0) {
- led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF);
+ led_trigger_event(&ledinternal->netfilter_led_trigger, 0);
}

/* else the delay is negative, which means switch on and stay on */
@@ -76,7 +76,7 @@ static void led_timeout_callback(struct timer_list *t)
struct xt_led_info_internal *ledinternal = from_timer(ledinternal, t,
timer);

- led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF);
+ led_trigger_event(&ledinternal->netfilter_led_trigger, 0);
}

static struct xt_led_info_internal *led_trigger_lookup(const char *name)
--
2.34.1

2022-01-22 02:01:20

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 30/31] sound: core: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
sound/core/control_led.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/control_led.c b/sound/core/control_led.c
index 207828f30983..ddfac2f5f59e 100644
--- a/sound/core/control_led.c
+++ b/sound/core/control_led.c
@@ -177,7 +177,7 @@ static void snd_ctl_led_set_state(struct snd_card *card, unsigned int access,
case MODE_FOLLOW_MUTE: /* noop */ break;
}
if (route >= 0)
- ledtrig_audio_set(led->trigger_type, route ? LED_OFF : LED_ON);
+ ledtrig_audio_set(led->trigger_type, route ? 0 : 1);
}

static struct snd_ctl_led_ctl *snd_ctl_led_find(struct snd_kcontrol *kctl, unsigned int ioff)
--
2.34.1

2022-01-22 02:01:23

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 31/31] sound: soc: sof: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
sound/soc/sof/control.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
index ef61936dad59..02e40aef9995 100644
--- a/sound/soc/sof/control.c
+++ b/sound/soc/sof/control.c
@@ -39,9 +39,9 @@ static void update_mute_led(struct snd_sof_control *scontrol,

#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO)
if (!scontrol->led_ctl.direction)
- ledtrig_audio_set(LED_AUDIO_MUTE, temp ? LED_OFF : LED_ON);
+ ledtrig_audio_set(LED_AUDIO_MUTE, temp ? 0 : 1);
else
- ledtrig_audio_set(LED_AUDIO_MICMUTE, temp ? LED_OFF : LED_ON);
+ ledtrig_audio_set(LED_AUDIO_MICMUTE, temp ? 0 : 1);
#endif
}

--
2.34.1

2022-01-22 02:01:33

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 24/31] video: backlight: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/video/backlight/adp8860_bl.c | 4 ++--
drivers/video/backlight/adp8870_bl.c | 4 ++--
drivers/video/backlight/led_bl.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c
index 8ec19425671f..063be4189e7e 100644
--- a/drivers/video/backlight/adp8860_bl.c
+++ b/drivers/video/backlight/adp8860_bl.c
@@ -261,10 +261,10 @@ static int adp8860_led_probe(struct i2c_client *client)
led_dat->cdev.name = cur_led->name;
led_dat->cdev.default_trigger = cur_led->default_trigger;
led_dat->cdev.brightness_set = adp8860_led_set;
- led_dat->cdev.brightness = LED_OFF;
+ led_dat->cdev.brightness = 0;
led_dat->flags = cur_led->flags >> FLAG_OFFT_SHIFT;
led_dat->client = client;
- led_dat->new_brightness = LED_OFF;
+ led_dat->new_brightness = 0;
INIT_WORK(&led_dat->work, adp8860_led_work);

ret = led_classdev_register(&client->dev, &led_dat->cdev);
diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c
index 8b5213a39527..b04faf8d631d 100644
--- a/drivers/video/backlight/adp8870_bl.c
+++ b/drivers/video/backlight/adp8870_bl.c
@@ -287,10 +287,10 @@ static int adp8870_led_probe(struct i2c_client *client)
led_dat->cdev.name = cur_led->name;
led_dat->cdev.default_trigger = cur_led->default_trigger;
led_dat->cdev.brightness_set = adp8870_led_set;
- led_dat->cdev.brightness = LED_OFF;
+ led_dat->cdev.brightness = 0;
led_dat->flags = cur_led->flags >> FLAG_OFFT_SHIFT;
led_dat->client = client;
- led_dat->new_brightness = LED_OFF;
+ led_dat->new_brightness = 0;
INIT_WORK(&led_dat->work, adp8870_led_work);

ret = led_classdev_register(&client->dev, &led_dat->cdev);
diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c
index f54d256e2d54..1b869624b4f8 100644
--- a/drivers/video/backlight/led_bl.c
+++ b/drivers/video/backlight/led_bl.c
@@ -46,7 +46,7 @@ static void led_bl_power_off(struct led_bl_data *priv)
return;

for (i = 0; i < priv->nb_leds; i++)
- led_set_brightness(priv->leds[i], LED_OFF);
+ led_set_brightness(priv->leds[i], 0);

priv->enabled = false;
}
--
2.34.1

2022-01-22 02:01:33

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 25/31] include: linux: leds: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
include/linux/leds.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/leds.h b/include/linux/leds.h
index ba4861ec73d3..814541e41ce0 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -597,7 +597,7 @@ void ledtrig_audio_set(enum led_audio type, enum led_brightness state);
#else
static inline enum led_brightness ledtrig_audio_get(enum led_audio type)
{
- return LED_OFF;
+ return 0;
}
static inline void ledtrig_audio_set(enum led_audio type,
enum led_brightness state)
--
2.34.1

2022-01-22 02:01:41

by Daniel Thompson

[permalink] [raw]
Subject: Re: [PATCH 24/31] video: backlight: changing LED_* from enum led_brightness to actual value

On Fri, Jan 21, 2022 at 01:54:29PM -0300, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.

Reviewed-by: Daniel Thompson <[email protected]>

BTW it looks like this patch might wants to land in one tree (I can't
see since I'm only on copy of this one). If so please discuss with Lee
how you want to land it. Put more directly, please don't treat my
Reviewed-by: as an Acked-by: ;-) !


Daniel.


> ---
> drivers/video/backlight/adp8860_bl.c | 4 ++--
> drivers/video/backlight/adp8870_bl.c | 4 ++--
> drivers/video/backlight/led_bl.c | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c
> index 8ec19425671f..063be4189e7e 100644
> --- a/drivers/video/backlight/adp8860_bl.c
> +++ b/drivers/video/backlight/adp8860_bl.c
> @@ -261,10 +261,10 @@ static int adp8860_led_probe(struct i2c_client *client)
> led_dat->cdev.name = cur_led->name;
> led_dat->cdev.default_trigger = cur_led->default_trigger;
> led_dat->cdev.brightness_set = adp8860_led_set;
> - led_dat->cdev.brightness = LED_OFF;
> + led_dat->cdev.brightness = 0;
> led_dat->flags = cur_led->flags >> FLAG_OFFT_SHIFT;
> led_dat->client = client;
> - led_dat->new_brightness = LED_OFF;
> + led_dat->new_brightness = 0;
> INIT_WORK(&led_dat->work, adp8860_led_work);
>
> ret = led_classdev_register(&client->dev, &led_dat->cdev);
> diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c
> index 8b5213a39527..b04faf8d631d 100644
> --- a/drivers/video/backlight/adp8870_bl.c
> +++ b/drivers/video/backlight/adp8870_bl.c
> @@ -287,10 +287,10 @@ static int adp8870_led_probe(struct i2c_client *client)
> led_dat->cdev.name = cur_led->name;
> led_dat->cdev.default_trigger = cur_led->default_trigger;
> led_dat->cdev.brightness_set = adp8870_led_set;
> - led_dat->cdev.brightness = LED_OFF;
> + led_dat->cdev.brightness = 0;
> led_dat->flags = cur_led->flags >> FLAG_OFFT_SHIFT;
> led_dat->client = client;
> - led_dat->new_brightness = LED_OFF;
> + led_dat->new_brightness = 0;
> INIT_WORK(&led_dat->work, adp8870_led_work);
>
> ret = led_classdev_register(&client->dev, &led_dat->cdev);
> diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c
> index f54d256e2d54..1b869624b4f8 100644
> --- a/drivers/video/backlight/led_bl.c
> +++ b/drivers/video/backlight/led_bl.c
> @@ -46,7 +46,7 @@ static void led_bl_power_off(struct led_bl_data *priv)
> return;
>
> for (i = 0; i < priv->nb_leds; i++)
> - led_set_brightness(priv->leds[i], LED_OFF);
> + led_set_brightness(priv->leds[i], 0);
>
> priv->enabled = false;
> }
> --
> 2.34.1
>

2022-01-22 02:02:05

by Luiz Sampaio

[permalink] [raw]
Subject: [PATCH 22/31] tty: vt: changing LED_* from enum led_brightness to actual value

The enum led_brightness, which contains the declaration of LED_OFF,
LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
max_brightness.
---
drivers/tty/vt/keyboard.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index be8313cdbac3..33bad1973180 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -1035,7 +1035,7 @@ static int kbd_led_trigger_activate(struct led_classdev *cdev)
if (ledstate != -1U)
led_trigger_event(&trigger->trigger,
ledstate & trigger->mask ?
- LED_FULL : LED_OFF);
+ 255 : 0);
tasklet_enable(&keyboard_tasklet);

return 0;
@@ -1081,7 +1081,7 @@ static void kbd_propagate_led_state(unsigned int old_state,
if (changed & trigger->mask)
led_trigger_event(&trigger->trigger,
new_state & trigger->mask ?
- LED_FULL : LED_OFF);
+ 255 : 0);
}
}

--
2.34.1

2022-01-22 02:06:48

by Luiz Sampaio

[permalink] [raw]
Subject: Re: [PATCH 24/31] video: backlight: changing LED_* from enum led_brightness to actual value

Hello, Daniel

Thanks for your reply. This is one of my first patches, so I am still
learning. This series of patches affects others subsystems too (hid,
leds, sound etc). Should I create series for each subsystem
separately, instead of creating one series for everyone?
What do you mean by "this patch might wants to land in one tree"?

Thank you for your attention!

2022-01-22 02:07:05

by Luiz Sampaio

[permalink] [raw]
Subject: Re: [PATCH 24/31] video: backlight: changing LED_* from enum led_brightness to actual value

Hello, Daniel

Thanks for your reply. This is one of my first patches, so I am still
learning. This series of patches affects others subsystems too (hid,
leds, sound etc). Should I create series for each subsystem
separately, instead of creating one series for everyone?
What do you mean by "this patch might wants to land in one tree"?

Thank you for your attention!

2022-01-22 02:09:52

by Sean Young

[permalink] [raw]
Subject: Re: [PATCH 11/31] media: rc: changing LED_* from enum led_brightness to actual value

On Fri, Jan 21, 2022 at 01:54:16PM -0300, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.
> ---
> drivers/media/rc/rc-main.c | 4 ++--
> drivers/media/rc/redrat3.c | 4 ++--
> drivers/media/rc/ttusbir.c | 4 ++--
> drivers/media/rc/winbond-cir.c | 6 +++---
> 4 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index b90438a71c80..76580f1920e2 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -641,7 +641,7 @@ static void ir_do_keyup(struct rc_dev *dev, bool sync)
> dev_dbg(&dev->dev, "keyup key 0x%04x\n", dev->last_keycode);
> del_timer(&dev->timer_repeat);
> input_report_key(dev->input_dev, dev->last_keycode, 0);
> - led_trigger_event(led_feedback, LED_OFF);
> + led_trigger_event(led_feedback, 0);
> if (sync)
> input_sync(dev->input_dev);
> dev->keypressed = false;
> @@ -812,7 +812,7 @@ static void ir_do_keydown(struct rc_dev *dev, enum rc_proto protocol,
> dev->device_name, keycode, protocol, scancode);
> input_report_key(dev->input_dev, keycode, 1);
>
> - led_trigger_event(led_feedback, LED_FULL);
> + led_trigger_event(led_feedback, 255);
> }
>
> /*
> diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
> index cb22316b3f00..7c255f7d790c 100644
> --- a/drivers/media/rc/redrat3.c
> +++ b/drivers/media/rc/redrat3.c
> @@ -855,7 +855,7 @@ static void redrat3_brightness_set(struct led_classdev *led_dev, enum
> struct redrat3_dev *rr3 = container_of(led_dev, struct redrat3_dev,
> led);
>
> - if (brightness != LED_OFF && atomic_cmpxchg(&rr3->flash, 0, 1) == 0) {
> + if (brightness != 0 && atomic_cmpxchg(&rr3->flash, 0, 1) == 0) {
> int ret = usb_submit_urb(rr3->flash_urb, GFP_ATOMIC);
> if (ret != 0) {
> dev_dbg(rr3->dev, "%s: unexpected ret of %d\n",
> @@ -919,7 +919,7 @@ static void redrat3_led_complete(struct urb *urb)
> break;
> }
>
> - rr3->led.brightness = LED_OFF;
> + rr3->led.brightness = 0;
> atomic_dec(&rr3->flash);
> }
>
> diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
> index 629787d53ee1..a295112644c3 100644
> --- a/drivers/media/rc/ttusbir.c
> +++ b/drivers/media/rc/ttusbir.c
> @@ -44,7 +44,7 @@ static enum led_brightness ttusbir_brightness_get(struct led_classdev *led_dev)
> {
> struct ttusbir *tt = container_of(led_dev, struct ttusbir, led);
>
> - return tt->led_on ? LED_FULL : LED_OFF;
> + return tt->led_on ? 255 : 0;
> }
>
> static void ttusbir_set_led(struct ttusbir *tt)
> @@ -70,7 +70,7 @@ static void ttusbir_brightness_set(struct led_classdev *led_dev, enum
> {
> struct ttusbir *tt = container_of(led_dev, struct ttusbir, led);
>
> - tt->led_on = brightness != LED_OFF;
> + tt->led_on = brightness != 0;
>
> ttusbir_set_led(tt);
> }
> diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
> index 94efb035d21b..d14e495a8641 100644
> --- a/drivers/media/rc/winbond-cir.c
> +++ b/drivers/media/rc/winbond-cir.c
> @@ -265,7 +265,7 @@ wbcir_led_brightness_get(struct led_classdev *led_cdev)
> if (inb(data->ebase + WBCIR_REG_ECEIR_CTS) & WBCIR_LED_ENABLE)
> return LED_FULL;

You missed this one.

Thanks
Sean

> else
> - return LED_OFF;
> + return 0;
> }
>
> static void
> @@ -277,7 +277,7 @@ wbcir_led_brightness_set(struct led_classdev *led_cdev,
> led);
>
> wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CTS,
> - brightness == LED_OFF ? 0x00 : WBCIR_LED_ENABLE,
> + brightness == 0 ? 0x00 : WBCIR_LED_ENABLE,
> WBCIR_LED_ENABLE);
> }
>
> @@ -1167,7 +1167,7 @@ wbcir_remove(struct pnp_dev *device)
> led_classdev_unregister(&data->led);
>
> /* This is ok since &data->led isn't actually used */
> - wbcir_led_brightness_set(&data->led, LED_OFF);
> + wbcir_led_brightness_set(&data->led, 0);
>
> release_region(data->wbase, WAKEUP_IOMEM_LEN);
> release_region(data->ebase, EHFUNC_IOMEM_LEN);
> --
> 2.34.1

2022-01-23 14:21:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 23/31] usb: core: changing LED_* from enum led_brightness to actual value

On Fri, Jan 21, 2022 at 01:54:28PM -0300, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.
> ---
> drivers/usb/core/ledtrig-usbport.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c
> index ba371a24ff78..85fa5699bb3d 100644
> --- a/drivers/usb/core/ledtrig-usbport.c
> +++ b/drivers/usb/core/ledtrig-usbport.c
> @@ -73,7 +73,7 @@ static void usbport_trig_update_count(struct usbport_trig_data *usbport_data)
>
> usbport_data->count = 0;
> usb_for_each_dev(usbport_data, usbport_trig_usb_dev_check);
> - led_set_brightness(led_cdev, usbport_data->count ? LED_FULL : LED_OFF);
> + led_set_brightness(led_cdev, usbport_data->count ? 255 : 0);
> }
>
> /***************************************
> @@ -287,12 +287,12 @@ static int usbport_trig_notify(struct notifier_block *nb, unsigned long action,
> case USB_DEVICE_ADD:
> usbport_trig_add_usb_dev_ports(usb_dev, usbport_data);
> if (observed && usbport_data->count++ == 0)
> - led_set_brightness(led_cdev, LED_FULL);
> + led_set_brightness(led_cdev, 255);
> return NOTIFY_OK;
> case USB_DEVICE_REMOVE:
> usbport_trig_remove_usb_dev_ports(usbport_data, usb_dev);
> if (observed && --usbport_data->count == 0)
> - led_set_brightness(led_cdev, LED_OFF);
> + led_set_brightness(led_cdev, 0);
> return NOTIFY_OK;
> }
>
> --
> 2.34.1
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch does not have a Signed-off-by: line. Please read the
kernel file, Documentation/SubmittingPatches and resend it after
adding that line. Note, the line needs to be in the body of the
email, before the patch, not at the bottom of the patch or in the
email signature.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

2022-01-23 14:44:23

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 22/31] tty: vt: changing LED_* from enum led_brightness to actual value

On Fri, Jan 21, 2022 at 01:54:27PM -0300, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.
> ---
> drivers/tty/vt/keyboard.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
> index be8313cdbac3..33bad1973180 100644
> --- a/drivers/tty/vt/keyboard.c
> +++ b/drivers/tty/vt/keyboard.c
> @@ -1035,7 +1035,7 @@ static int kbd_led_trigger_activate(struct led_classdev *cdev)
> if (ledstate != -1U)
> led_trigger_event(&trigger->trigger,
> ledstate & trigger->mask ?
> - LED_FULL : LED_OFF);
> + 255 : 0);
> tasklet_enable(&keyboard_tasklet);
>
> return 0;
> @@ -1081,7 +1081,7 @@ static void kbd_propagate_led_state(unsigned int old_state,
> if (changed & trigger->mask)
> led_trigger_event(&trigger->trigger,
> new_state & trigger->mask ?
> - LED_FULL : LED_OFF);
> + 255 : 0);
> }
> }
>
> --
> 2.34.1
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch does not have a Signed-off-by: line. Please read the
kernel file, Documentation/SubmittingPatches and resend it after
adding that line. Note, the line needs to be in the body of the
email, before the patch, not at the bottom of the patch or in the
email signature.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

2022-01-23 15:11:17

by Jonathan Woithe

[permalink] [raw]
Subject: Re: [PATCH 20/31] platform: x86: changing LED_* from enum led_brightness to actual value

On Fri, Jan 21, 2022 at 01:54:25PM -0300, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.
> ---
> drivers/platform/x86/acer-wmi.c | 6 ++---
> drivers/platform/x86/asus-wireless.c | 6 ++---
> drivers/platform/x86/dell/dell-laptop.c | 2 +-
> drivers/platform/x86/dell/dell-wmi-led.c | 4 ++--
> drivers/platform/x86/fujitsu-laptop.c | 28 ++++++++++++------------
> drivers/platform/x86/lg-laptop.c | 18 +++++++--------
> drivers/platform/x86/system76_acpi.c | 4 ++--
> drivers/platform/x86/thinkpad_acpi.c | 14 ++++++------
> drivers/platform/x86/topstar-laptop.c | 4 ++--
> drivers/platform/x86/toshiba_acpi.c | 24 ++++++++++----------
> 10 files changed, 55 insertions(+), 55 deletions(-)
>
> ...
> diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> index 80929380ec7e..6ebfda771209 100644
> --- a/drivers/platform/x86/fujitsu-laptop.c
> +++ b/drivers/platform/x86/fujitsu-laptop.c
> @@ -584,10 +584,10 @@ static int logolamp_set(struct led_classdev *cdev,
> int poweron = FUNC_LED_ON, always = FUNC_LED_ON;
> int ret;
>
> - if (brightness < LED_HALF)
> + if (brightness < 127)
> poweron = FUNC_LED_OFF;
>
> - if (brightness < LED_FULL)
> + if (brightness < 255)
> always = FUNC_LED_OFF;
>
> ret = call_fext_func(device, FUNC_LEDS, 0x1, LOGOLAMP_POWERON, poweron);
> @@ -604,13 +604,13 @@ static enum led_brightness logolamp_get(struct led_classdev *cdev)
>
> ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
> if (ret == FUNC_LED_ON)
> - return LED_FULL;
> + return 255;
>
> ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
> if (ret == FUNC_LED_ON)
> - return LED_HALF;
> + return 127;
>
> - return LED_OFF;
> + return 0;
> }
>
> static int kblamps_set(struct led_classdev *cdev,
> @@ -618,7 +618,7 @@ static int kblamps_set(struct led_classdev *cdev,
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
>
> - if (brightness >= LED_FULL)
> + if (brightness >= 255)
> return call_fext_func(device, FUNC_LEDS, 0x1, KEYBOARD_LAMPS,
> FUNC_LED_ON);
> else
> @@ -629,11 +629,11 @@ static int kblamps_set(struct led_classdev *cdev,
> static enum led_brightness kblamps_get(struct led_classdev *cdev)
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
> - enum led_brightness brightness = LED_OFF;
> + unsigned int brightness = 0;
>
> if (call_fext_func(device,
> FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON)
> - brightness = LED_FULL;
> + brightness = 255;
>
> return brightness;
> }
> @@ -643,7 +643,7 @@ static int radio_led_set(struct led_classdev *cdev,
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
>
> - if (brightness >= LED_FULL)
> + if (brightness >= 255)
> return call_fext_func(device, FUNC_FLAGS, 0x5, RADIO_LED_ON,
> RADIO_LED_ON);
> else
> @@ -654,10 +654,10 @@ static int radio_led_set(struct led_classdev *cdev,
> static enum led_brightness radio_led_get(struct led_classdev *cdev)
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
> - enum led_brightness brightness = LED_OFF;
> + unsigned int brightness = 0;
>
> if (call_fext_func(device, FUNC_FLAGS, 0x4, 0x0, 0x0) & RADIO_LED_ON)
> - brightness = LED_FULL;
> + brightness = 255;
>
> return brightness;
> }
> @@ -669,7 +669,7 @@ static int eco_led_set(struct led_classdev *cdev,
> int curr;
>
> curr = call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0);
> - if (brightness >= LED_FULL)
> + if (brightness >= 255)
> return call_fext_func(device, FUNC_LEDS, 0x1, ECO_LED,
> curr | ECO_LED_ON);
> else
> @@ -680,10 +680,10 @@ static int eco_led_set(struct led_classdev *cdev,
> static enum led_brightness eco_led_get(struct led_classdev *cdev)
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
> - enum led_brightness brightness = LED_OFF;
> + unsigned int brightness = 0;
>
> if (call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
> - brightness = LED_FULL;
> + brightness = 255;
>
> return brightness;
> }

In a way it's less descriptive to revert from the identifiers to what amount
to seemingly magic numbers. However, since the value attributed to maximum
LED brightness in the LED class is now variable I can see why the global
enum no longer makes sense. We could define a suitable enum within
fujitsu-laptop.c, but there's probably little to be gained in the long run.

To make the patch description a little clearer, could I suggest you add the
word "variable" before "max_brightness", or even just use the phrase
"variable maximum brightness"?

For the fujitsu-laptop.c portion of this patch:
Acked-by: Jonathan Woithe <[email protected]>

Regards
jonathan

2022-01-23 15:14:31

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH 01/31] gpu: nouveau: nouveau_led: changing LED_FULL to actual value

Hi Luiz,

On Sat, Jan 22, 2022 at 7:44 AM Luiz Sampaio <[email protected]> wrote:
>
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.

Your Signed-off-by tag is missing.

Please run ./scripts/checkpatch.pl on your patch and it helps detect
this kind of issue.

Regards,

Fabio Estevam

2022-01-23 15:18:53

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 04/31] iio: light: cm3605: changing LED_* from enum led_brightness to actual value

On Fri, 21 Jan 2022 13:54:09 -0300
Luiz Sampaio <[email protected]> wrote:

> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.

No sign-off and please always cc everyone on the cover letter of a series
including all mailing lists. Otherwise we have no visibility of the
reasoning behind the change. We all need to see the cover letter.
Sure I can go search for this patch on lore.kernel.org, but why
make it hard :)

Thanks,

Jonathan

> ---
> drivers/iio/light/cm3605.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c
> index 50d34a98839c..f60db6cd9e6d 100644
> --- a/drivers/iio/light/cm3605.c
> +++ b/drivers/iio/light/cm3605.c
> @@ -238,7 +238,7 @@ static int cm3605_probe(struct platform_device *pdev)
>
> /* Just name the trigger the same as the driver */
> led_trigger_register_simple("cm3605", &cm3605->led);
> - led_trigger_event(cm3605->led, LED_FULL);
> + led_trigger_event(cm3605->led, 255);
>
> indio_dev->info = &cm3605_info;
> indio_dev->name = "cm3605";
> @@ -255,7 +255,7 @@ static int cm3605_probe(struct platform_device *pdev)
> return 0;
>
> out_remove_trigger:
> - led_trigger_event(cm3605->led, LED_OFF);
> + led_trigger_event(cm3605->led, 0);
> led_trigger_unregister_simple(cm3605->led);
> out_disable_aset:
> gpiod_set_value_cansleep(cm3605->aset, 0);
> @@ -269,7 +269,7 @@ static int cm3605_remove(struct platform_device *pdev)
> struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> struct cm3605 *cm3605 = iio_priv(indio_dev);
>
> - led_trigger_event(cm3605->led, LED_OFF);
> + led_trigger_event(cm3605->led, 0);
> led_trigger_unregister_simple(cm3605->led);
> gpiod_set_value_cansleep(cm3605->aset, 0);
> iio_device_unregister(indio_dev);
> @@ -283,7 +283,7 @@ static int __maybe_unused cm3605_pm_suspend(struct device *dev)
> struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct cm3605 *cm3605 = iio_priv(indio_dev);
>
> - led_trigger_event(cm3605->led, LED_OFF);
> + led_trigger_event(cm3605->led, 0);
> regulator_disable(cm3605->vdd);
>
> return 0;
> @@ -298,7 +298,7 @@ static int __maybe_unused cm3605_pm_resume(struct device *dev)
> ret = regulator_enable(cm3605->vdd);
> if (ret)
> dev_err(dev, "failed to enable regulator in resume path\n");
> - led_trigger_event(cm3605->led, LED_FULL);
> + led_trigger_event(cm3605->led, 255);
>
> return 0;
> }

2022-01-24 19:02:22

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH 20/31] platform: x86: changing LED_* from enum led_brightness to actual value

Hi,

On 1/21/22 17:54, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.

This change is fine with me. I assume that this depends on earlier
changes in this series (1), so that it is best to merge the entire
series through the LED tree, here is my ack for merging the
drivers/platform/x86 bits through the LED tree:

Acked-by: Hans de Goede <[email protected]>

Regards,

Hans

1) next time please send the entire series to
the [email protected] list and not just one patch
of a series.


> ---
> drivers/platform/x86/acer-wmi.c | 6 ++---
> drivers/platform/x86/asus-wireless.c | 6 ++---
> drivers/platform/x86/dell/dell-laptop.c | 2 +-
> drivers/platform/x86/dell/dell-wmi-led.c | 4 ++--
> drivers/platform/x86/fujitsu-laptop.c | 28 ++++++++++++------------
> drivers/platform/x86/lg-laptop.c | 18 +++++++--------
> drivers/platform/x86/system76_acpi.c | 4 ++--
> drivers/platform/x86/thinkpad_acpi.c | 14 ++++++------
> drivers/platform/x86/topstar-laptop.c | 4 ++--
> drivers/platform/x86/toshiba_acpi.c | 24 ++++++++++----------
> 10 files changed, 55 insertions(+), 55 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 9c6943e401a6..ce960164a397 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -1597,7 +1597,7 @@ static int acer_led_init(struct device *dev)
>
> static void acer_led_exit(void)
> {
> - set_u32(LED_OFF, ACER_CAP_MAILLED);
> + set_u32(0, ACER_CAP_MAILLED);
> led_classdev_unregister(&mail_led);
> }
>
> @@ -2332,7 +2332,7 @@ static int acer_suspend(struct device *dev)
>
> if (has_cap(ACER_CAP_MAILLED)) {
> get_u32(&value, ACER_CAP_MAILLED);
> - set_u32(LED_OFF, ACER_CAP_MAILLED);
> + set_u32(0, ACER_CAP_MAILLED);
> data->mailled = value;
> }
>
> @@ -2377,7 +2377,7 @@ static void acer_platform_shutdown(struct platform_device *device)
> return;
>
> if (has_cap(ACER_CAP_MAILLED))
> - set_u32(LED_OFF, ACER_CAP_MAILLED);
> + set_u32(0, ACER_CAP_MAILLED);
> }
>
> static struct platform_driver acer_platform_driver = {
> diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
> index d3e7171928e5..139257bf71ea 100644
> --- a/drivers/platform/x86/asus-wireless.c
> +++ b/drivers/platform/x86/asus-wireless.c
> @@ -84,8 +84,8 @@ static enum led_brightness led_state_get(struct led_classdev *led)
> s = asus_wireless_method(acpi_device_handle(data->adev), "HSWC",
> data->hswc_params->status, &ret);
> if (ACPI_SUCCESS(s) && ret == data->hswc_params->on)
> - return LED_FULL;
> - return LED_OFF;
> + return 255;
> + return 0;
> }
>
> static void led_state_update(struct work_struct *work)
> @@ -103,7 +103,7 @@ static void led_state_set(struct led_classdev *led, enum led_brightness value)
> struct asus_wireless_data *data;
>
> data = container_of(led, struct asus_wireless_data, led);
> - data->led_state = value == LED_OFF ? data->hswc_params->off :
> + data->led_state = value == 0 ? data->hswc_params->off :
> data->hswc_params->on;
> queue_work(data->wq, &data->led_work);
> }
> diff --git a/drivers/platform/x86/dell/dell-laptop.c b/drivers/platform/x86/dell/dell-laptop.c
> index 8230e7a68a5e..4dd530e3b47b 100644
> --- a/drivers/platform/x86/dell/dell-laptop.c
> +++ b/drivers/platform/x86/dell/dell-laptop.c
> @@ -2141,7 +2141,7 @@ static int micmute_led_set(struct led_classdev *led_cdev,
> {
> struct calling_interface_buffer buffer;
> struct calling_interface_token *token;
> - int state = brightness != LED_OFF;
> + int state = brightness != 0;
>
> if (state == 0)
> token = dell_smbios_find_token(GLOBAL_MIC_MUTE_DISABLE);
> diff --git a/drivers/platform/x86/dell/dell-wmi-led.c b/drivers/platform/x86/dell/dell-wmi-led.c
> index 5bedaf7f0633..fcfd6dd60583 100644
> --- a/drivers/platform/x86/dell/dell-wmi-led.c
> +++ b/drivers/platform/x86/dell/dell-wmi-led.c
> @@ -122,7 +122,7 @@ static int led_blink(unsigned char on_eighths, unsigned char off_eighths)
> static void dell_led_set(struct led_classdev *led_cdev,
> enum led_brightness value)
> {
> - if (value == LED_OFF)
> + if (value == 0)
> led_off();
> else
> led_on();
> @@ -154,7 +154,7 @@ static int dell_led_blink(struct led_classdev *led_cdev,
>
> static struct led_classdev dell_led = {
> .name = "dell::lid",
> - .brightness = LED_OFF,
> + .brightness = 0,
> .max_brightness = 1,
> .brightness_set = dell_led_set,
> .blink_set = dell_led_blink,
> diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> index 80929380ec7e..6ebfda771209 100644
> --- a/drivers/platform/x86/fujitsu-laptop.c
> +++ b/drivers/platform/x86/fujitsu-laptop.c
> @@ -584,10 +584,10 @@ static int logolamp_set(struct led_classdev *cdev,
> int poweron = FUNC_LED_ON, always = FUNC_LED_ON;
> int ret;
>
> - if (brightness < LED_HALF)
> + if (brightness < 127)
> poweron = FUNC_LED_OFF;
>
> - if (brightness < LED_FULL)
> + if (brightness < 255)
> always = FUNC_LED_OFF;
>
> ret = call_fext_func(device, FUNC_LEDS, 0x1, LOGOLAMP_POWERON, poweron);
> @@ -604,13 +604,13 @@ static enum led_brightness logolamp_get(struct led_classdev *cdev)
>
> ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
> if (ret == FUNC_LED_ON)
> - return LED_FULL;
> + return 255;
>
> ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
> if (ret == FUNC_LED_ON)
> - return LED_HALF;
> + return 127;
>
> - return LED_OFF;
> + return 0;
> }
>
> static int kblamps_set(struct led_classdev *cdev,
> @@ -618,7 +618,7 @@ static int kblamps_set(struct led_classdev *cdev,
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
>
> - if (brightness >= LED_FULL)
> + if (brightness >= 255)
> return call_fext_func(device, FUNC_LEDS, 0x1, KEYBOARD_LAMPS,
> FUNC_LED_ON);
> else
> @@ -629,11 +629,11 @@ static int kblamps_set(struct led_classdev *cdev,
> static enum led_brightness kblamps_get(struct led_classdev *cdev)
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
> - enum led_brightness brightness = LED_OFF;
> + unsigned int brightness = 0;
>
> if (call_fext_func(device,
> FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON)
> - brightness = LED_FULL;
> + brightness = 255;
>
> return brightness;
> }
> @@ -643,7 +643,7 @@ static int radio_led_set(struct led_classdev *cdev,
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
>
> - if (brightness >= LED_FULL)
> + if (brightness >= 255)
> return call_fext_func(device, FUNC_FLAGS, 0x5, RADIO_LED_ON,
> RADIO_LED_ON);
> else
> @@ -654,10 +654,10 @@ static int radio_led_set(struct led_classdev *cdev,
> static enum led_brightness radio_led_get(struct led_classdev *cdev)
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
> - enum led_brightness brightness = LED_OFF;
> + unsigned int brightness = 0;
>
> if (call_fext_func(device, FUNC_FLAGS, 0x4, 0x0, 0x0) & RADIO_LED_ON)
> - brightness = LED_FULL;
> + brightness = 255;
>
> return brightness;
> }
> @@ -669,7 +669,7 @@ static int eco_led_set(struct led_classdev *cdev,
> int curr;
>
> curr = call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0);
> - if (brightness >= LED_FULL)
> + if (brightness >= 255)
> return call_fext_func(device, FUNC_LEDS, 0x1, ECO_LED,
> curr | ECO_LED_ON);
> else
> @@ -680,10 +680,10 @@ static int eco_led_set(struct led_classdev *cdev,
> static enum led_brightness eco_led_get(struct led_classdev *cdev)
> {
> struct acpi_device *device = to_acpi_device(cdev->dev->parent);
> - enum led_brightness brightness = LED_OFF;
> + unsigned int brightness = 0;
>
> if (call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
> - brightness = LED_FULL;
> + brightness = 255;
>
> return brightness;
> }
> diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
> index a91847a551a7..cbcc945c2d9d 100644
> --- a/drivers/platform/x86/lg-laptop.c
> +++ b/drivers/platform/x86/lg-laptop.c
> @@ -547,13 +547,13 @@ static void tpad_led_set(struct led_classdev *cdev,
> {
> union acpi_object *r;
>
> - r = lg_wmab(WM_TLED, WM_SET, brightness > LED_OFF);
> + r = lg_wmab(WM_TLED, WM_SET, brightness > 0);
> kfree(r);
> }
>
> static enum led_brightness tpad_led_get(struct led_classdev *cdev)
> {
> - return ggov(GOV_TLED) > 0 ? LED_ON : LED_OFF;
> + return ggov(GOV_TLED) > 0 ? 1 : 0;
> }
>
> static LED_DEVICE(tpad_led, 1, 0);
> @@ -565,9 +565,9 @@ static void kbd_backlight_set(struct led_classdev *cdev,
> union acpi_object *r;
>
> val = 0x22;
> - if (brightness <= LED_OFF)
> + if (brightness <= 0)
> val = 0;
> - if (brightness >= LED_FULL)
> + if (brightness >= 255)
> val = 0x24;
> r = lg_wmab(WM_KEY_LIGHT, WM_SET, val);
> kfree(r);
> @@ -581,22 +581,22 @@ static enum led_brightness get_kbd_backlight_level(void)
> r = lg_wmab(WM_KEY_LIGHT, WM_GET, 0);
>
> if (!r)
> - return LED_OFF;
> + return 0;
>
> if (r->type != ACPI_TYPE_BUFFER || r->buffer.pointer[1] != 0x05) {
> kfree(r);
> - return LED_OFF;
> + return 0;
> }
>
> switch (r->buffer.pointer[0] & 0x27) {
> case 0x24:
> - val = LED_FULL;
> + val = 255;
> break;
> case 0x22:
> - val = LED_HALF;
> + val = 127;
> break;
> default:
> - val = LED_OFF;
> + val = 0;
> }
>
> kfree(r);
> diff --git a/drivers/platform/x86/system76_acpi.c b/drivers/platform/x86/system76_acpi.c
> index 7299ad08c838..9f2b11a0e02f 100644
> --- a/drivers/platform/x86/system76_acpi.c
> +++ b/drivers/platform/x86/system76_acpi.c
> @@ -299,7 +299,7 @@ static enum led_brightness ap_led_get(struct led_classdev *led)
> if (value > 0)
> return (enum led_brightness)value;
> else
> - return LED_OFF;
> + return 0;
> }
>
> // Set the airplane mode LED brightness
> @@ -308,7 +308,7 @@ static int ap_led_set(struct led_classdev *led, enum led_brightness value)
> struct system76_data *data;
>
> data = container_of(led, struct system76_data, ap_led);
> - return system76_set(data, "SAPL", value == LED_OFF ? 0 : 1);
> + return system76_set(data, "SAPL", value == 0 ? 0 : 1);
> }
>
> // Get the last set keyboard LED brightness
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 82fa6148216c..01fe0a2995fd 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -5421,13 +5421,13 @@ static int light_set_status(int status)
> static int light_sysfs_set(struct led_classdev *led_cdev,
> enum led_brightness brightness)
> {
> - return light_set_status((brightness != LED_OFF) ?
> + return light_set_status((brightness != 0) ?
> TPACPI_LED_ON : TPACPI_LED_OFF);
> }
>
> static enum led_brightness light_sysfs_get(struct led_classdev *led_cdev)
> {
> - return (light_get_status() == 1) ? LED_FULL : LED_OFF;
> + return (light_get_status() == 1) ? 255 : 0;
> }
>
> static struct tpacpi_led_classdev tpacpi_led_thinklight = {
> @@ -5759,7 +5759,7 @@ static int led_sysfs_set(struct led_classdev *led_cdev,
> struct tpacpi_led_classdev, led_classdev);
> enum led_status_t new_state;
>
> - if (brightness == LED_OFF)
> + if (brightness == 0)
> new_state = TPACPI_LED_OFF;
> else if (tpacpi_led_state_cache[data->led] != TPACPI_LED_BLINK)
> new_state = TPACPI_LED_ON;
> @@ -5796,9 +5796,9 @@ static enum led_brightness led_sysfs_get(struct led_classdev *led_cdev)
> rc = led_get_status(data->led);
>
> if (rc == TPACPI_LED_OFF || rc < 0)
> - rc = LED_OFF; /* no error handling in led class :( */
> + rc = 0; /* no error handling in led class :( */
> else
> - rc = LED_FULL;
> + rc = 255;
>
> return rc;
> }
> @@ -9145,13 +9145,13 @@ static int tpacpi_led_set(int whichled, bool on)
> static int tpacpi_led_mute_set(struct led_classdev *led_cdev,
> enum led_brightness brightness)
> {
> - return tpacpi_led_set(LED_AUDIO_MUTE, brightness != LED_OFF);
> + return tpacpi_led_set(LED_AUDIO_MUTE, brightness != 0);
> }
>
> static int tpacpi_led_micmute_set(struct led_classdev *led_cdev,
> enum led_brightness brightness)
> {
> - return tpacpi_led_set(LED_AUDIO_MICMUTE, brightness != LED_OFF);
> + return tpacpi_led_set(LED_AUDIO_MICMUTE, brightness != 0);
> }
>
> static struct led_classdev mute_led_cdev[TPACPI_LED_MAX] = {
> diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
> index f7761d98c0fd..1382b91c2860 100644
> --- a/drivers/platform/x86/topstar-laptop.c
> +++ b/drivers/platform/x86/topstar-laptop.c
> @@ -71,8 +71,8 @@ static int topstar_led_set(struct led_classdev *led,
> * it seems to be faulty on some models like the Topstar U931
> * Notebook).
> */
> - if ((ret == 0x30001 && state == LED_OFF)
> - || (ret == 0x30000 && state != LED_OFF)) {
> + if ((ret == 0x30001 && state == 0)
> + || (ret == 0x30000 && state != 0)) {
> status = acpi_execute_simple_method(topstar->device->handle,
> "FNCX", 0x83);
> if (ACPI_FAILURE(status))
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index 352508d30467..641c6766febe 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -501,19 +501,19 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
>
> /* First request : initialize communication. */
> if (!sci_open(dev))
> - return LED_OFF;
> + return 0;
>
> /* Check the illumination */
> result = sci_read(dev, SCI_ILLUMINATION, &state);
> sci_close(dev);
> if (result == TOS_FAILURE) {
> pr_err("ACPI call for illumination failed\n");
> - return LED_OFF;
> + return 0;
> } else if (result != TOS_SUCCESS) {
> - return LED_OFF;
> + return 0;
> }
>
> - return state ? LED_FULL : LED_OFF;
> + return state ? 255 : 0;
> }
>
> /* KBD Illumination */
> @@ -602,12 +602,12 @@ static enum led_brightness toshiba_kbd_backlight_get(struct led_classdev *cdev)
> result = hci_read(dev, HCI_KBD_ILLUMINATION, &state);
> if (result == TOS_FAILURE) {
> pr_err("ACPI call to get the keyboard backlight failed\n");
> - return LED_OFF;
> + return 0;
> } else if (result != TOS_SUCCESS) {
> - return LED_OFF;
> + return 0;
> }
>
> - return state ? LED_FULL : LED_OFF;
> + return state ? 255 : 0;
> }
>
> static void toshiba_kbd_backlight_set(struct led_classdev *cdev,
> @@ -711,13 +711,13 @@ toshiba_eco_mode_get_status(struct led_classdev *cdev)
> status = tci_raw(dev, in, out);
> if (ACPI_FAILURE(status)) {
> pr_err("ACPI call to get ECO led failed\n");
> - return LED_OFF;
> + return 0;
> }
>
> if (out[0] != TOS_SUCCESS)
> - return LED_OFF;
> + return 0;
>
> - return out[2] ? LED_FULL : LED_OFF;
> + return out[2] ? 255 : 0;
> }
>
> static void toshiba_eco_mode_set_status(struct led_classdev *cdev,
> @@ -2402,7 +2402,7 @@ static void toshiba_acpi_kbd_bl_work(struct work_struct *work)
> toshiba_acpi->kbd_mode != SCI_KBD_MODE_AUTO)
> led_classdev_notify_brightness_hw_changed(&toshiba_acpi->kbd_led,
> (toshiba_acpi->kbd_mode == SCI_KBD_MODE_ON) ?
> - LED_FULL : LED_OFF);
> + 255 : 0);
>
> /* Emulate the keyboard backlight event */
> acpi_bus_generate_netlink_event(toshiba_acpi->acpi_dev->pnp.device_class,
> @@ -3225,7 +3225,7 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event)
> if (dev->kbd_type == 2 && dev->kbd_mode != SCI_KBD_MODE_AUTO)
> led_classdev_notify_brightness_hw_changed(&dev->kbd_led,
> (dev->kbd_mode == SCI_KBD_MODE_ON) ?
> - LED_FULL : LED_OFF);
> + 255 : 0);
> break;
> case 0x85: /* Unknown */
> case 0x8d: /* Unknown */
>

2022-01-24 19:05:47

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 24/31] video: backlight: changing LED_* from enum led_brightness to actual value

On Fri, 21 Jan 2022, Luiz Sampaio wrote:

> Hello, Daniel
>
> Thanks for your reply. This is one of my first patches, so I am still
> learning. This series of patches affects others subsystems too (hid,
> leds, sound etc). Should I create series for each subsystem
> separately, instead of creating one series for everyone?
> What do you mean by "this patch might wants to land in one tree"?

Can the individual patches be applied on their own without causing
issues (warnings/errors) with the build? If so, they can be applied
separately via their associated subsystem trees. If not, someone will
have to collect them all and take them via a single tree with Acks
from the other subsystem maintainers.

It's difficult to make that decision for ourselves since you didn't
share all of the patches with all of the maintainers.

--
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

2022-01-25 08:42:52

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 03/31] hwmon: pmbus: changing LED_* from enum led_brightness to actual value

On Fri, Jan 21, 2022 at 01:54:08PM -0300, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.

There is no Signed-off-by:, so this is not not a valid/acceptable patch.

> ---
> drivers/hwmon/pmbus/ibm-cffps.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
> index e3294a1a54bb..cc20a70c723b 100644
> --- a/drivers/hwmon/pmbus/ibm-cffps.c
> +++ b/drivers/hwmon/pmbus/ibm-cffps.c
> @@ -382,10 +382,10 @@ static int ibm_cffps_led_brightness_set(struct led_classdev *led_cdev,
> u8 next_led_state;
> struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led);
>
> - if (brightness == LED_OFF) {
> + if (brightness == 0) {
> next_led_state = CFFPS_LED_OFF;
> } else {
> - brightness = LED_FULL;
> + brightness = 255;

If the LED subsystem no longer likes defines, we should have local constants
instead and not just use magic numbers. At the same time, this LED only supports
two states, off or on. There will have to be an explanation why the full range of
0..255 is still used and not just 0/1.

>
> if (psu->led_state != CFFPS_LED_BLINK)
> next_led_state = CFFPS_LED_ON;
> @@ -426,7 +426,7 @@ static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev,
> return rc;
>
> psu->led_state = CFFPS_LED_BLINK;
> - led_cdev->brightness = LED_FULL;
> + led_cdev->brightness = 255;
> *delay_on = CFFPS_BLINK_RATE_MS;
> *delay_off = CFFPS_BLINK_RATE_MS;
>
> @@ -442,7 +442,7 @@ static void ibm_cffps_create_led_class(struct ibm_cffps *psu)
> snprintf(psu->led_name, sizeof(psu->led_name), "%s-%02x", client->name,
> client->addr);
> psu->led.name = psu->led_name;
> - psu->led.max_brightness = LED_FULL;
> + psu->led.max_brightness = 255;
> psu->led.brightness_set_blocking = ibm_cffps_led_brightness_set;
> psu->led.blink_set = ibm_cffps_led_blink_set;
>

2022-02-02 13:34:42

by Sakari Ailus

[permalink] [raw]
Subject: Re: [PATCH 12/31] media: v4l2-core: changing LED_* from enum led_brightness to actual value

Hi Luiz,

On Fri, Jan 21, 2022 at 01:54:17PM -0300, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.

The set appears to be missing the Signed-off-by: line, at least in the
three patches cc'd to the linux-media list.

With this fixed, for this patch:

Acked-by: Sakari Ailus <[email protected]>

> ---
> drivers/media/v4l2-core/v4l2-flash-led-class.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c
> index e70e128ccc9c..a47ac654c9f4 100644
> --- a/drivers/media/v4l2-core/v4l2-flash-led-class.c
> +++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
> @@ -234,11 +234,11 @@ static int v4l2_flash_s_ctrl(struct v4l2_ctrl *c)
> case V4L2_CID_FLASH_LED_MODE:
> switch (c->val) {
> case V4L2_FLASH_LED_MODE_NONE:
> - led_set_brightness_sync(led_cdev, LED_OFF);
> + led_set_brightness_sync(led_cdev, 0);
> return led_set_flash_strobe(fled_cdev, false);
> case V4L2_FLASH_LED_MODE_FLASH:
> /* Turn the torch LED off */
> - led_set_brightness_sync(led_cdev, LED_OFF);
> + led_set_brightness_sync(led_cdev, 0);
> if (ctrls[STROBE_SOURCE]) {
> external_strobe = (ctrls[STROBE_SOURCE]->val ==
> V4L2_FLASH_STROBE_SOURCE_EXTERNAL);

--
Regards,

Sakari Ailus

2022-02-11 12:14:57

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 31/31] sound: soc: sof: changing LED_* from enum led_brightness to actual value

On Fri, Jan 21, 2022 at 01:54:36PM -0300, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.
> ---

You've not provided a Signed-off-by for this so I can't do anything with
it, please see Documentation/process/submitting-patches.rst for details
on what this is and why it's important.

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.


Attachments:
(No filename) (763.00 B)
signature.asc (499.00 B)
Download all attachments

2022-11-26 10:31:14

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 12/31] media: v4l2-core: changing LED_* from enum led_brightness to actual value

Hi Luiz,

On 21/01/2022 17:54, Luiz Sampaio wrote:
> The enum led_brightness, which contains the declaration of LED_OFF,
> LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports
> max_brightness.

Note that there is no Signed-off-by line, so I can't take this.

Same for patches 11/31 and 10/31.

If this is still relevant (it's an old series, after all), then please
repost.

Regards,

Hans

> ---
> drivers/media/v4l2-core/v4l2-flash-led-class.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c
> index e70e128ccc9c..a47ac654c9f4 100644
> --- a/drivers/media/v4l2-core/v4l2-flash-led-class.c
> +++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
> @@ -234,11 +234,11 @@ static int v4l2_flash_s_ctrl(struct v4l2_ctrl *c)
> case V4L2_CID_FLASH_LED_MODE:
> switch (c->val) {
> case V4L2_FLASH_LED_MODE_NONE:
> - led_set_brightness_sync(led_cdev, LED_OFF);
> + led_set_brightness_sync(led_cdev, 0);
> return led_set_flash_strobe(fled_cdev, false);
> case V4L2_FLASH_LED_MODE_FLASH:
> /* Turn the torch LED off */
> - led_set_brightness_sync(led_cdev, LED_OFF);
> + led_set_brightness_sync(led_cdev, 0);
> if (ctrls[STROBE_SOURCE]) {
> external_strobe = (ctrls[STROBE_SOURCE]->val ==
> V4L2_FLASH_STROBE_SOURCE_EXTERNAL);