linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix for endian bug in rtl8187
@ 2007-06-13 22:59 Kasper F. Brandt
  2007-06-14  7:33 ` Michael Wu
  0 siblings, 1 reply; 2+ messages in thread
From: Kasper F. Brandt @ 2007-06-13 22:59 UTC (permalink / raw)
  To: linux-wireless

Hello

The following patch fixes a bug in the mac80211 rtl8187 driver that
would prevent it from initializing the hardware correctly on
big-endian machines.

--- a/drivers/net/wireless/mac80211/rtl818x/rtl8187_rtl8225.c	2007-06-14
00:24:52.000000000 +0200
+++ b/drivers/net/wireless/mac80211/rtl818x/rtl8187_rtl8225.c	2007-06-14
00:27:17.000000000 +0200
@@ -70,6 +70,7 @@
 {
 	struct rtl8187_priv *priv = dev->priv;
 	u16 reg80, reg82, reg84;
+	__le16 buf;

 	reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput);
 	reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
@@ -88,9 +89,11 @@
 	rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
 	udelay(10);

+	buf = cpu_to_le16(data);
+
 	usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
 			RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-			addr, 0x8225, &data, sizeof(data), HZ / 2);
+			addr, 0x8225, &buf, sizeof(buf), HZ / 2);

 	rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
 	udelay(10);

------------------------------
- Kasper F. Brandt

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

* Re: [PATCH] fix for endian bug in rtl8187
  2007-06-13 22:59 [PATCH] fix for endian bug in rtl8187 Kasper F. Brandt
@ 2007-06-14  7:33 ` Michael Wu
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Wu @ 2007-06-14  7:33 UTC (permalink / raw)
  To: Kasper F. Brandt; +Cc: linux-wireless, Andrea Merello, John Linville


[-- Attachment #1.1: Type: text/plain, Size: 470 bytes --]

On Wednesday 13 June 2007 15:59, Kasper F. Brandt wrote:
> Hello
>
> The following patch fixes a bug in the mac80211 rtl8187 driver that
> would prevent it from initializing the hardware correctly on
> big-endian machines.
>
Thanks for finding this!

I used a slightly different approach to fixing this in the attached patch, but 
it's the same idea.

This applies to wireless-dev, but should be applied to the driver in 
wireless-2.6 also.

-Michael Wu

[-- Attachment #1.2: 05-fix-rtl8187-endianness.diff --]
[-- Type: text/x-diff, Size: 1357 bytes --]

rtl8187: fix endianness issue in rtl8225 register writing

From: Michael Wu <flamingice@sourmilk.net>

I failed to notice that a u16 was being passed to the hardware.
This fixes it.

Thanks to Kasper F. Brandt for finding this!

Signed-off-by: Michael Wu <flamingice@sourmilk.net>
---

 .../wireless/mac80211/rtl818x/rtl8187_rtl8225.c    |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mac80211/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/mac80211/rtl818x/rtl8187_rtl8225.c
index c3f5bf5..97fdff7 100644
--- a/drivers/net/wireless/mac80211/rtl818x/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/mac80211/rtl818x/rtl8187_rtl8225.c
@@ -66,7 +66,7 @@ static void rtl8225_write_bitbang(struct ieee80211_hw *dev, u8 addr, u16 data)
 	msleep(2);
 }
 
-static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, u16 data)
+static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data)
 {
 	struct rtl8187_priv *priv = dev->priv;
 	u16 reg80, reg82, reg84;
@@ -105,7 +105,7 @@ void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data)
 	struct rtl8187_priv *priv = dev->priv;
 
 	if (priv->asic_rev)
-		rtl8225_write_8051(dev, addr, data);
+		rtl8225_write_8051(dev, addr, cpu_to_le16(data));
 	else
 		rtl8225_write_bitbang(dev, addr, data);
 }

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2007-06-14  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-13 22:59 [PATCH] fix for endian bug in rtl8187 Kasper F. Brandt
2007-06-14  7:33 ` Michael Wu

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