All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] b43: only hardcode LED behavior if SPROM doesn't encode any
@ 2016-06-03 21:04 Lucas Stach
  2016-06-03 21:09   ` Michael Büsch
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lucas Stach @ 2016-06-03 21:04 UTC (permalink / raw)
  To: Kalle Valo, Michael Buesch; +Cc: linux-wireless, b43-dev

Only hardcode the LED behavior if the SROM doesn't provide any for all
LEDs of the card. This avoids instantiating LED triggers for unconnected
LEDs, while (hopefully) keeping things working for old cards with a
blank SROM.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 drivers/net/wireless/broadcom/b43/leds.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43/leds.c b/drivers/net/wireless/broadcom/b43/leds.c
index d79ab2a..cb987c2 100644
--- a/drivers/net/wireless/broadcom/b43/leds.c
+++ b/drivers/net/wireless/broadcom/b43/leds.c
@@ -222,7 +222,7 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
 	sprom[2] = dev->dev->bus_sprom->gpio2;
 	sprom[3] = dev->dev->bus_sprom->gpio3;
 
-	if (sprom[led_index] == 0xFF) {
+	if ((sprom[0] & sprom[1] & sprom[2] & sprom[3]) == 0xff) {
 		/* There is no LED information in the SPROM
 		 * for this LED. Hardcode it here. */
 		*activelow = false;
@@ -250,7 +250,11 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
 			return;
 		}
 	} else {
-		*behaviour = sprom[led_index] & B43_LED_BEHAVIOUR;
+		/* keep LED disabled if no mapping is defined */
+		if (sprom[led_index] == 0xff)
+			*behaviour = B43_LED_OFF;
+		else
+			*behaviour = sprom[led_index] & B43_LED_BEHAVIOUR;
 		*activelow = !!(sprom[led_index] & B43_LED_ACTIVELOW);
 	}
 }
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] b43: only hardcode LED behavior if SPROM doesn't encode any
  2016-06-03 21:04 [PATCH] b43: only hardcode LED behavior if SPROM doesn't encode any Lucas Stach
@ 2016-06-03 21:09   ` Michael Büsch
  2016-06-16 15:15 ` Kalle Valo
  2016-06-16 15:15 ` Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Büsch @ 2016-06-03 21:09 UTC (permalink / raw)
  To: Lucas Stach; +Cc: Kalle Valo, linux-wireless, b43-dev

[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]

On Fri,  3 Jun 2016 23:04:03 +0200
Lucas Stach <dev@lynxeye.de> wrote:

> Only hardcode the LED behavior if the SROM doesn't provide any for all
> LEDs of the card. This avoids instantiating LED triggers for unconnected
> LEDs, while (hopefully) keeping things working for old cards with a
> blank SROM.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>

Acked-by: Michael Buesch <m@bues.ch>


> ---
>  drivers/net/wireless/broadcom/b43/leds.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/b43/leds.c b/drivers/net/wireless/broadcom/b43/leds.c
> index d79ab2a..cb987c2 100644
> --- a/drivers/net/wireless/broadcom/b43/leds.c
> +++ b/drivers/net/wireless/broadcom/b43/leds.c
> @@ -222,7 +222,7 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
>  	sprom[2] = dev->dev->bus_sprom->gpio2;
>  	sprom[3] = dev->dev->bus_sprom->gpio3;
>  
> -	if (sprom[led_index] == 0xFF) {
> +	if ((sprom[0] & sprom[1] & sprom[2] & sprom[3]) == 0xff) {
>  		/* There is no LED information in the SPROM
>  		 * for this LED. Hardcode it here. */
>  		*activelow = false;
> @@ -250,7 +250,11 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
>  			return;
>  		}
>  	} else {
> -		*behaviour = sprom[led_index] & B43_LED_BEHAVIOUR;
> +		/* keep LED disabled if no mapping is defined */
> +		if (sprom[led_index] == 0xff)
> +			*behaviour = B43_LED_OFF;
> +		else
> +			*behaviour = sprom[led_index] & B43_LED_BEHAVIOUR;
>  		*activelow = !!(sprom[led_index] & B43_LED_ACTIVELOW);
>  	}
>  }




-- 
Michael

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] b43: only hardcode LED behavior if SPROM doesn't encode any
@ 2016-06-03 21:09   ` Michael Büsch
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Büsch @ 2016-06-03 21:09 UTC (permalink / raw)
  To: Lucas Stach; +Cc: Kalle Valo, linux-wireless, b43-dev

On Fri,  3 Jun 2016 23:04:03 +0200
Lucas Stach <dev@lynxeye.de> wrote:

> Only hardcode the LED behavior if the SROM doesn't provide any for all
> LEDs of the card. This avoids instantiating LED triggers for unconnected
> LEDs, while (hopefully) keeping things working for old cards with a
> blank SROM.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>

Acked-by: Michael Buesch <m@bues.ch>


> ---
>  drivers/net/wireless/broadcom/b43/leds.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/b43/leds.c b/drivers/net/wireless/broadcom/b43/leds.c
> index d79ab2a..cb987c2 100644
> --- a/drivers/net/wireless/broadcom/b43/leds.c
> +++ b/drivers/net/wireless/broadcom/b43/leds.c
> @@ -222,7 +222,7 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
>  	sprom[2] = dev->dev->bus_sprom->gpio2;
>  	sprom[3] = dev->dev->bus_sprom->gpio3;
>  
> -	if (sprom[led_index] == 0xFF) {
> +	if ((sprom[0] & sprom[1] & sprom[2] & sprom[3]) == 0xff) {
>  		/* There is no LED information in the SPROM
>  		 * for this LED. Hardcode it here. */
>  		*activelow = false;
> @@ -250,7 +250,11 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
>  			return;
>  		}
>  	} else {
> -		*behaviour = sprom[led_index] & B43_LED_BEHAVIOUR;
> +		/* keep LED disabled if no mapping is defined */
> +		if (sprom[led_index] == 0xff)
> +			*behaviour = B43_LED_OFF;
> +		else
> +			*behaviour = sprom[led_index] & B43_LED_BEHAVIOUR;
>  		*activelow = !!(sprom[led_index] & B43_LED_ACTIVELOW);
>  	}
>  }




-- 
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20160603/d9d8821e/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: b43: only hardcode LED behavior if SPROM doesn't encode any
  2016-06-03 21:04 [PATCH] b43: only hardcode LED behavior if SPROM doesn't encode any Lucas Stach
  2016-06-03 21:09   ` Michael Büsch
  2016-06-16 15:15 ` Kalle Valo
@ 2016-06-16 15:15 ` Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2016-06-16 15:15 UTC (permalink / raw)
  To: Lucas Stach; +Cc: Michael Buesch, linux-wireless, b43-dev

Lucas Stach <dev@lynxeye.de> wrote:
> Only hardcode the LED behavior if the SROM doesn't provide any for all
> LEDs of the card. This avoids instantiating LED triggers for unconnected
> LEDs, while (hopefully) keeping things working for old cards with a
> blank SROM.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>

Thanks, 1 patch applied to wireless-drivers-next.git:

508f1222ba4e b43: only hardcode LED behavior if SPROM doesn't encode any

-- 
Sent by pwcli
https://patchwork.kernel.org/patch/9154077/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* b43: only hardcode LED behavior if SPROM doesn't encode any
  2016-06-03 21:04 [PATCH] b43: only hardcode LED behavior if SPROM doesn't encode any Lucas Stach
  2016-06-03 21:09   ` Michael Büsch
@ 2016-06-16 15:15 ` Kalle Valo
  2016-06-16 15:15 ` Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2016-06-16 15:15 UTC (permalink / raw)
  To: b43-dev

Lucas Stach <dev@lynxeye.de> wrote:
> Only hardcode the LED behavior if the SROM doesn't provide any for all
> LEDs of the card. This avoids instantiating LED triggers for unconnected
> LEDs, while (hopefully) keeping things working for old cards with a
> blank SROM.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>

Thanks, 1 patch applied to wireless-drivers-next.git:

508f1222ba4e b43: only hardcode LED behavior if SPROM doesn't encode any

-- 
Sent by pwcli
https://patchwork.kernel.org/patch/9154077/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-16 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-03 21:04 [PATCH] b43: only hardcode LED behavior if SPROM doesn't encode any Lucas Stach
2016-06-03 21:09 ` Michael Büsch
2016-06-03 21:09   ` Michael Büsch
2016-06-16 15:15 ` Kalle Valo
2016-06-16 15:15 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.