diff mbox series

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

Message ID 20220121165436.30956-17-sampaio.ime@gmail.com
State New
Headers show
Series None | expand

Commit Message

Luiz Sampaio Jan. 21, 2022, 4:54 p.m. UTC
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(-)

Comments

Arend van Spriel Jan. 22, 2022, 8:21 a.m. UTC | #1
On 1/21/2022 5:54 PM, 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 commit message sounds a bit obscure to me. You say the 
led_brightness enumeration is or rather will become obsolete. I don't 
understand the reason given "led class now supports max_brightness". 
What does that mean?

Also I do not understand the approach here. If the enum is obsolete why 
not start with the APIs using it like the led callbacks 
brightness_{get,set{,_blocking}}. I suspect that is your next step, but 
it seems like unnecessary churn to me.

Anyway, what triggered me to look at this is the fact that we do have a 
led.c under drivers/net/wireless/broadcom/brcm80211/brcmsmac 
implementing the brightness_set() callback.

Regards,
Arend
diff mbox series

Patch

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);