Skip to contentSkip to conversation

b43: rfkill: use HI enabled bit for all devices

PATCH New Rafał Miłecki 3 participants 5 messages Nov 17, 2010 – Nov 19, 2010 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 b43: rfkill: use HI enabled bit for all devices

Devices which use LO enabled bit are covered by b43legacy

---
V2: Dropped some not needed stuff as pointed by Michael, thanks!

John: it's .38 ofc.

---
 drivers/net/wireless/b43/rfkill.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)
drivers/net/wireless/b43/rfkill.c +2 -17
index 78016ae..86bc0a0 100644
@@ -28,23 +28,8 @@
 /* Returns TRUE, if the radio is enabled in hardware. */
 bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
 {
-	if (dev->phy.rev >= 3 || dev->phy.type == B43_PHYTYPE_LP) {
-		if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
-		      & B43_MMIO_RADIO_HWENABLED_HI_MASK))
-			return 1;
-	} else {
-		/* To prevent CPU fault on PPC, do not read a register
-		 * unless the interface is started; however, on resume
-		 * for hibernation, this routine is entered early. When
-		 * that happens, unconditionally return TRUE.
-		 */
-		if (b43_status(dev) < B43_STAT_STARTED)
-			return 1;
-		if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
-		    & B43_MMIO_RADIO_HWENABLED_LO_MASK)
-			return 1;
-	}
-	return 0;
+	return !(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
+		& B43_MMIO_RADIO_HWENABLED_HI_MASK);
 }
 
 /* The poll callback for the hardware button. */
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH v2 1/1 b43: rfkill: use HI enabled bit for all devices

2010/11/17 Rafa? Mi?ecki <[email protected]>:

Quoted 28 lines

Devices which use LO enabled bit are covered by b43legacy

---
V2: Dropped some not needed stuff as pointed by Michael, thanks!

John: it's .38 ofc.
---
?drivers/net/wireless/b43/rfkill.c | ? 19 ++----------------- ?1 files changed, 2 insertions(+), 17 deletions(-)

drivers/net/wireless/b43/rfkill.c +0 -0
index 78016ae..86bc0a0 100644
@@ -28,23 +28,8 @@

?/* Returns TRUE, if the radio is enabled in hardware. */ ?bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
?{
- ? ? ? if (dev->phy.rev >= 3 || dev->phy.type == B43_PHYTYPE_LP) {
- ? ? ? ? ? ? ? if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
- ? ? ? ? ? ? ? ? ? ? & B43_MMIO_RADIO_HWENABLED_HI_MASK))
- ? ? ? ? ? ? ? ? ? ? ? return 1;
- ? ? ? } else {
- ? ? ? ? ? ? ? /* To prevent CPU fault on PPC, do not read a register
- ? ? ? ? ? ? ? ?* unless the interface is started; however, on resume
- ? ? ? ? ? ? ? ?* for hibernation, this routine is entered early. When
- ? ? ? ? ? ? ? ?* that happens, unconditionally return TRUE.

Quoted 8 lines

- ? ? ? ? ? ? ? ?*/
- ? ? ? ? ? ? ? if (b43_status(dev) < B43_STAT_STARTED)
- ? ? ? ? ? ? ? ? ? ? ? return 1;
- ? ? ? ? ? ? ? if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
- ? ? ? ? ? ? ? ? ? & B43_MMIO_RADIO_HWENABLED_LO_MASK)
- ? ? ? ? ? ? ? ? ? ? ? return 1;
- ? ? ? }
- ? ? ? return 0;

Is there any reason why this bool originally returned 1 or 0 instead of true or false?

Quoted 13 lines

+ ? ? ? return !(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
+ ? ? ? ? ? ? ? & B43_MMIO_RADIO_HWENABLED_HI_MASK); ?}

?/* The poll callback for the hardware button. */
--
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
#2 lore raw

PATCH v2 1/1 b43: rfkill: use HI enabled bit for all devices

Quoted 32 lines · G?bor Stefanik

2010/11/17 Rafa? Mi?ecki <[email protected]>:

Quoted 31 lines

Devices which use LO enabled bit are covered by b43legacy

---
V2: Dropped some not needed stuff as pointed by Michael, thanks!

John: it's .38 ofc.

---
 drivers/net/wireless/b43/rfkill.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)
drivers/net/wireless/b43/rfkill.c +0 -12
index 78016ae..86bc0a0 100644
@@ -28,23 +28,8 @@
 /* Returns TRUE, if the radio is enabled in hardware. */
 bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
 {
-       if (dev->phy.rev >= 3 || dev->phy.type == B43_PHYTYPE_LP) {
-               if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
-                     & B43_MMIO_RADIO_HWENABLED_HI_MASK))
-                       return 1;
-       } else {
-               /* To prevent CPU fault on PPC, do not read a register
-                * unless the interface is started; however, on resume
-                * for hibernation, this routine is entered early. When
-                * that happens, unconditionally return TRUE.
-                */
-               if (b43_status(dev) < B43_STAT_STARTED)
-                       return 1;
Quoted 8 lines

drivers/net/wireless/b43/rfkill.c line 47

Quoted 5 lines
drivers/net/wireless/b43/rfkill.c +0 -5
-               if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
-                   & B43_MMIO_RADIO_HWENABLED_LO_MASK)
-                       return 1;
-       }
-       return 0;

Is there any reason why this bool originally returned 1 or 0 instead of true or false?

There's no difference.
(int)0 implicitly casts to false and anything else to true.

Signature · 1 line
Greetings Michael.
#3 lore raw

PATCH v2 1/1 b43: rfkill: use HI enabled bit for all devices

Quoted 42 lines · Michael B?sch
Quoted 32 lines · G?bor Stefanik

2010/11/17 Rafa? Mi?ecki <[email protected]>:

Quoted 31 lines

Devices which use LO enabled bit are covered by b43legacy

---
V2: Dropped some not needed stuff as pointed by Michael, thanks!

John: it's .38 ofc.
---
?drivers/net/wireless/b43/rfkill.c | ? 19 ++----------------- ?1 files changed, 2 insertions(+), 17 deletions(-)

drivers/net/wireless/b43/rfkill.c +0 -0
index 78016ae..86bc0a0 100644
@@ -28,23 +28,8 @@

?/* Returns TRUE, if the radio is enabled in hardware. */ ?bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
?{
- ? ? ? if (dev->phy.rev >= 3 || dev->phy.type == B43_PHYTYPE_LP) {
- ? ? ? ? ? ? ? if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
- ? ? ? ? ? ? ? ? ? ? & B43_MMIO_RADIO_HWENABLED_HI_MASK))
- ? ? ? ? ? ? ? ? ? ? ? return 1;
- ? ? ? } else {
- ? ? ? ? ? ? ? /* To prevent CPU fault on PPC, do not read a register
- ? ? ? ? ? ? ? ?* unless the interface is started; however, on resume
- ? ? ? ? ? ? ? ?* for hibernation, this routine is entered early. When
- ? ? ? ? ? ? ? ?* that happens, unconditionally return TRUE.
- ? ? ? ? ? ? ? ?*/
- ? ? ? ? ? ? ? if (b43_status(dev) < B43_STAT_STARTED)
- ? ? ? ? ? ? ? ? ? ? ? return 1;

Quoted 8 lines
Quoted 5 lines

- ? ? ? ? ? ? ? if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
- ? ? ? ? ? ? ? ? ? & B43_MMIO_RADIO_HWENABLED_LO_MASK)
- ? ? ? ? ? ? ? ? ? ? ? return 1;
- ? ? ? }
- ? ? ? return 0;

Is there any reason why this bool originally returned 1 or 0 instead of true or false?

Quoted 2 lines

There's no difference.
(int)0 implicitly casts to false and anything else to true.

I know, just for the sake of coding style. Same as initializing pointers to NULL, not 0 (though AFAIK there are platforms where 0x0 is a valid memory address, so using NULL is more than just coding style).

Quoted 5 lines

--
Greetings Michael.

Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
#4 lore raw

PATCH v2 1/1 b43: rfkill: use HI enabled bit for all devices

Quoted 4 lines · G?bor Stefanik
Quoted 2 lines

There's no difference.
(int)0 implicitly casts to false and anything else to true.

I know, just for the sake of coding style.

All of my code in b43 uses 0/1. That's just less characters to write and is as readable as true/false (to me).
And most b43 G code existed before bool was added to the kernel. ;)

Quoted 3 lines

Same as initializing
pointers to NULL, not 0 (though AFAIK there are platforms where 0x0 is a valid memory address, so using NULL is more than just coding style).

No it is not. C handles the case for NULL not being zero and generates correct code even if 0 is used. But Linux doesn't support those platforms due to other reasons (memset(..., 0, ...) on struct with pointers, for example).

Signature · 1 line
Greetings Michael.