[PATCH 18/31] net: wireless: ralink: changing LED_* from enum led_brightness to actual value
From: Luiz Sampaio
Date: Fri Jan 21 2022 - 11:58:17 EST
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/ralink/rt2x00/rt2400pci.c | 2 +-
drivers/net/wireless/ralink/rt2x00/rt2500pci.c | 2 +-
drivers/net/wireless/ralink/rt2x00/rt2500usb.c | 2 +-
drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++--
drivers/net/wireless/ralink/rt2x00/rt2x00leds.c | 16 ++++++++--------
drivers/net/wireless/ralink/rt2x00/rt61pci.c | 4 ++--
drivers/net/wireless/ralink/rt2x00/rt73usb.c | 4 ++--
7 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
index dec6ffdf07c4..d8b7f1a73267 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
@@ -204,7 +204,7 @@ static void rt2400pci_brightness_set(struct led_classdev *led_cdev,
{
struct rt2x00_led *led =
container_of(led_cdev, struct rt2x00_led, led_dev);
- unsigned int enabled = brightness != LED_OFF;
+ unsigned int enabled = brightness != 0;
u32 reg;
reg = rt2x00mmio_register_read(led->rt2x00dev, LEDCSR);
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
index 8faa0a80e73a..fe490a6382fe 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
@@ -204,7 +204,7 @@ static void rt2500pci_brightness_set(struct led_classdev *led_cdev,
{
struct rt2x00_led *led =
container_of(led_cdev, struct rt2x00_led, led_dev);
- unsigned int enabled = brightness != LED_OFF;
+ unsigned int enabled = brightness != 0;
u32 reg;
reg = rt2x00mmio_register_read(led->rt2x00dev, LEDCSR);
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
index bb5ed6630645..b25c32a03d99 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
@@ -267,7 +267,7 @@ static void rt2500usb_brightness_set(struct led_classdev *led_cdev,
{
struct rt2x00_led *led =
container_of(led_cdev, struct rt2x00_led, led_dev);
- unsigned int enabled = brightness != LED_OFF;
+ unsigned int enabled = brightness != 0;
u16 reg;
reg = rt2500usb_register_read(led->rt2x00dev, MAC_CSR20);
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index deddb0afd312..8441e6e5320a 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -1521,7 +1521,7 @@ static void rt2800_brightness_set(struct led_classdev *led_cdev,
{
struct rt2x00_led *led =
container_of(led_cdev, struct rt2x00_led, led_dev);
- unsigned int enabled = brightness != LED_OFF;
+ unsigned int enabled = brightness != 0;
unsigned int bg_mode =
(enabled && led->rt2x00dev->curr_band == NL80211_BAND_2GHZ);
unsigned int polarity =
@@ -1570,7 +1570,7 @@ static void rt2800_brightness_set(struct led_classdev *led_cdev,
* (1 << level) - 1
*/
rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff,
- (1 << brightness / (LED_FULL / 6)) - 1,
+ (1 << brightness / (255 / 6)) - 1,
polarity);
}
}
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c b/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
index f5361d582d4e..3ef2a81aed7d 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
@@ -52,7 +52,7 @@ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
* is going to calculate the value and might use it in a
* division.
*/
- brightness = ((LED_FULL / 6) * rssi) + 1;
+ brightness = ((255 / 6) * rssi) + 1;
if (brightness != led->led_dev.brightness) {
led->led_dev.brightness_set(&led->led_dev, brightness);
led->led_dev.brightness = brightness;
@@ -61,7 +61,7 @@ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
static void rt2x00led_led_simple(struct rt2x00_led *led, bool enabled)
{
- unsigned int brightness = enabled ? LED_FULL : LED_OFF;
+ unsigned int brightness = enabled ? 255 : 0;
if (!(led->flags & LED_REGISTERED))
return;
@@ -96,7 +96,7 @@ static int rt2x00leds_register_led(struct rt2x00_dev *rt2x00dev,
int retval;
led->led_dev.name = name;
- led->led_dev.brightness = LED_OFF;
+ led->led_dev.brightness = 0;
retval = led_classdev_register(device, &led->led_dev);
if (retval) {
@@ -179,7 +179,7 @@ static void rt2x00leds_unregister_led(struct rt2x00_led *led)
* possible yet.
*/
if (!(led->led_dev.flags & LED_SUSPENDED))
- led->led_dev.brightness_set(&led->led_dev, LED_OFF);
+ led->led_dev.brightness_set(&led->led_dev, 0);
led->flags &= ~LED_REGISTERED;
}
@@ -199,8 +199,8 @@ static inline void rt2x00leds_suspend_led(struct rt2x00_led *led)
led_classdev_suspend(&led->led_dev);
/* This shouldn't be needed, but just to be safe */
- led->led_dev.brightness_set(&led->led_dev, LED_OFF);
- led->led_dev.brightness = LED_OFF;
+ led->led_dev.brightness_set(&led->led_dev, 0);
+ led->led_dev.brightness = 0;
}
void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev)
@@ -218,8 +218,8 @@ static inline void rt2x00leds_resume_led(struct rt2x00_led *led)
led_classdev_resume(&led->led_dev);
/* Device might have enabled the LEDS during resume */
- led->led_dev.brightness_set(&led->led_dev, LED_OFF);
- led->led_dev.brightness = LED_OFF;
+ led->led_dev.brightness_set(&led->led_dev, 0);
+ led->led_dev.brightness = 0;
}
void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt61pci.c b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
index 82cfc2aadc2b..d48a7d06013c 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
@@ -242,7 +242,7 @@ static void rt61pci_brightness_set(struct led_classdev *led_cdev,
{
struct rt2x00_led *led =
container_of(led_cdev, struct rt2x00_led, led_dev);
- unsigned int enabled = brightness != LED_OFF;
+ unsigned int enabled = brightness != 0;
unsigned int a_mode =
(enabled && led->rt2x00dev->curr_band == NL80211_BAND_5GHZ);
unsigned int bg_mode =
@@ -271,7 +271,7 @@ static void rt61pci_brightness_set(struct led_classdev *led_cdev,
* argument into the matching level within that range.
*/
rt61pci_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff,
- brightness / (LED_FULL / 6), 0);
+ brightness / (255 / 6), 0);
}
}
diff --git a/drivers/net/wireless/ralink/rt2x00/rt73usb.c b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
index 5ff2c740c3ea..45b98395cf9e 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
@@ -187,7 +187,7 @@ static void rt73usb_brightness_set(struct led_classdev *led_cdev,
{
struct rt2x00_led *led =
container_of(led_cdev, struct rt2x00_led, led_dev);
- unsigned int enabled = brightness != LED_OFF;
+ unsigned int enabled = brightness != 0;
unsigned int a_mode =
(enabled && led->rt2x00dev->curr_band == NL80211_BAND_5GHZ);
unsigned int bg_mode =
@@ -216,7 +216,7 @@ static void rt73usb_brightness_set(struct led_classdev *led_cdev,
* argument into the matching level within that range.
*/
rt2x00usb_vendor_request_sw(led->rt2x00dev, USB_LED_CONTROL,
- brightness / (LED_FULL / 6),
+ brightness / (255 / 6),
led->rt2x00dev->led_mcu_reg,
REGISTER_TIMEOUT);
}
--
2.34.1