b43-dev.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] b43: rfkill: use HI enabled bit for all devices
@ 2010-11-17 21:14 Rafał Miłecki
  2010-11-19 16:12 ` Gábor Stefanik
  0 siblings, 1 reply; 5+ messages in thread
From: Rafał Miłecki @ 2010-11-17 21:14 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

Devices which use LO enabled bit are covered by b43legacy

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
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(-)

diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 78016ae..86bc0a0 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -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. */
-- 
1.6.0.4

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

* [PATCH V2] b43: rfkill: use HI enabled bit for all devices
  2010-11-17 21:14 [PATCH V2] b43: rfkill: use HI enabled bit for all devices Rafał Miłecki
@ 2010-11-19 16:12 ` Gábor Stefanik
  2010-11-19 16:41   ` Michael Büsch
  0 siblings, 1 reply; 5+ messages in thread
From: Gábor Stefanik @ 2010-11-19 16:12 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

2010/11/17 Rafa? Mi?ecki <zajec5@gmail.com>:
> Devices which use LO enabled bit are covered by b43legacy
>
> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
> index 78016ae..86bc0a0 100644
> --- a/drivers/net/wireless/b43/rfkill.c
> +++ b/drivers/net/wireless/b43/rfkill.c
> @@ -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;

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

> + ? ? ? 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
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

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

* [PATCH V2] b43: rfkill: use HI enabled bit for all devices
  2010-11-19 16:12 ` Gábor Stefanik
@ 2010-11-19 16:41   ` Michael Büsch
  2010-11-19 16:59     ` Gábor Stefanik
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Büsch @ 2010-11-19 16:41 UTC (permalink / raw)
  To: Gábor Stefanik; +Cc: Rafał Miłecki, linux-wireless, b43-dev

On Fri, 2010-11-19 at 17:12 +0100, G?bor Stefanik wrote: 
> 2010/11/17 Rafa? Mi?ecki <zajec5@gmail.com>:
> > Devices which use LO enabled bit are covered by b43legacy
> >
> > Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
> > ---
> > 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(-)
> >
> > diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
> > index 78016ae..86bc0a0 100644
> > --- a/drivers/net/wireless/b43/rfkill.c
> > +++ b/drivers/net/wireless/b43/rfkill.c
> > @@ -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;
> 
> 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.

-- 
Greetings Michael.

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

* [PATCH V2] b43: rfkill: use HI enabled bit for all devices
  2010-11-19 16:41   ` Michael Büsch
@ 2010-11-19 16:59     ` Gábor Stefanik
  2010-11-19 17:15       ` Michael Büsch
  0 siblings, 1 reply; 5+ messages in thread
From: Gábor Stefanik @ 2010-11-19 16:59 UTC (permalink / raw)
  To: Michael Büsch; +Cc: Rafał Miłecki, linux-wireless, b43-dev

On Fri, Nov 19, 2010 at 5:41 PM, Michael B?sch <mb@bu3sch.de> wrote:
> On Fri, 2010-11-19 at 17:12 +0100, G?bor Stefanik wrote:
>> 2010/11/17 Rafa? Mi?ecki <zajec5@gmail.com>:
>> > Devices which use LO enabled bit are covered by b43legacy
>> >
>> > Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
>> > ---
>> > 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(-)
>> >
>> > diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
>> > index 78016ae..86bc0a0 100644
>> > --- a/drivers/net/wireless/b43/rfkill.c
>> > +++ b/drivers/net/wireless/b43/rfkill.c
>> > @@ -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;
>>
>> 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.

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

>
> --
> Greetings Michael.
>
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

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

* [PATCH V2] b43: rfkill: use HI enabled bit for all devices
  2010-11-19 16:59     ` Gábor Stefanik
@ 2010-11-19 17:15       ` Michael Büsch
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Büsch @ 2010-11-19 17:15 UTC (permalink / raw)
  To: Gábor Stefanik; +Cc: Rafał Miłecki, linux-wireless, b43-dev

On Fri, 2010-11-19 at 17:59 +0100, G?bor Stefanik wrote: 
> > 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. ;)

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

-- 
Greetings Michael.

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

end of thread, other threads:[~2010-11-19 17:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-17 21:14 [PATCH V2] b43: rfkill: use HI enabled bit for all devices Rafał Miłecki
2010-11-19 16:12 ` Gábor Stefanik
2010-11-19 16:41   ` Michael Büsch
2010-11-19 16:59     ` Gábor Stefanik
2010-11-19 17:15       ` Michael Büsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).