linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT/RFC] rtl8187: Remove some magic numbers
@ 2009-04-13  0:40 Larry Finger
  2009-04-13  9:51 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Larry Finger @ 2009-04-13  0:40 UTC (permalink / raw)
  To: Larry Finger; +Cc: Herton Ronaldo Krzesinski, Hin-Tak Leung, linux-wireless

There are several magic numbers that refer to locations in the CSR page.
They can be replaced.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 
Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_dev.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -650,7 +650,7 @@ static int rtl8187_init_hw(struct ieee80
 
 	rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
 
-	rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF);
+	rtl818x_iowrite16(priv, &priv->map->FEMR, 0xFFFF);
 	reg = rtl818x_ioread8(priv, &priv->map->CONFIG1);
 	reg &= 0x3F;
 	reg |= 0x80;
@@ -882,7 +882,7 @@ static void rtl8187_work(struct work_str
 	u16 tmp;
 
 	mutex_lock(&priv->conf_mutex);
-	tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA);
+	tmp = rtl818x_ioread16(priv, &priv->map->TALLY_CNT);
 	while (skb_queue_len(&priv->b_tx_status.queue) > 0) {
 		struct sk_buff *old_skb;
 
Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
+++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
@@ -462,7 +462,7 @@ static void rtl8225_rf_init(struct ieee8
 
 	rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);	/* B: 0x00 */
 	msleep(1);
-	rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002);
+	rtl818x_iowrite32(priv, &priv->map->HSSI_PARA, 0x3dc00002);
 
 	/* set sensitivity */
 	rtl8225_write(dev, 0x0c, 0x50);
@@ -818,7 +818,7 @@ static void rtl8225z2_rf_init(struct iee
 	rtl8225_write_phy_cck(dev, 0x4b, 0x04);
 	rtl8225_write_phy_cck(dev, 0x4c, 0x05);
 
-	rtl818x_iowrite8(priv, (u8 *)0xFF5B, 0x0D); msleep(1);
+	rtl818x_iowrite8(priv, &priv->map->TESTR, 0x0D); msleep(1);
 
 	rtl8225z2_rf_set_tx_power(dev, 1);
 
@@ -828,7 +828,7 @@ static void rtl8225z2_rf_init(struct iee
 
 	rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);	/* B: 0x00 */
 	msleep(1);
-	rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002);
+	rtl818x_iowrite32(priv, &priv->map->HSSI_PARA, 0x3dc00002);
 }
 
 static void rtl8225z2_b_rf_init(struct ieee80211_hw *dev)

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

* Re: [RFT/RFC] rtl8187: Remove some magic numbers
@ 2009-04-13  7:43 Hin-Tak Leung
  0 siblings, 0 replies; 4+ messages in thread
From: Hin-Tak Leung @ 2009-04-13  7:43 UTC (permalink / raw)
  To: Larry Finger; +Cc: Herton Ronaldo Krzesinski, linux-wireless


--- On Mon, 13/4/09, Larry Finger <Larry.Finger@lwfinger.net> wrote:

> There are several magic numbers that
> refer to locations in the CSR page.
> They can be replaced.
> 
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

Tested-by: Hin-Tak Leung <htl10@users.sourceforge.net>

Am running the patch ATM.


      

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

* Re: [RFT/RFC] rtl8187: Remove some magic numbers
  2009-04-13  0:40 Larry Finger
@ 2009-04-13  9:51 ` Johannes Berg
  2009-04-13 15:39   ` Larry Finger
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2009-04-13  9:51 UTC (permalink / raw)
  To: Larry Finger; +Cc: Herton Ronaldo Krzesinski, Hin-Tak Leung, linux-wireless

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

On Sun, 2009-04-12 at 19:40 -0500, Larry Finger wrote:

> -	rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF);
> +	rtl818x_iowrite16(priv, &priv->map->FEMR, 0xFFFF);

That looks strange -- I can tell it works because priv->map is set to
0xFF00, but wouldn't actual constants make more sense?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [RFT/RFC] rtl8187: Remove some magic numbers
  2009-04-13  9:51 ` Johannes Berg
@ 2009-04-13 15:39   ` Larry Finger
  0 siblings, 0 replies; 4+ messages in thread
From: Larry Finger @ 2009-04-13 15:39 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Herton Ronaldo Krzesinski, Hin-Tak Leung, linux-wireless

Johannes Berg wrote:
> On Sun, 2009-04-12 at 19:40 -0500, Larry Finger wrote:
> 
>> -	rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF);
>> +	rtl818x_iowrite16(priv, &priv->map->FEMR, 0xFFFF);
> 
> That looks strange -- I can tell it works because priv->map is set to
> 0xFF00, but wouldn't actual constants make more sense?

The value 0xFFF4 is the address offset of the Function Event Mask Register, not
a data value. Using a symbol emphasizes that we are referring to a register and
not a constant.

Larry


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

end of thread, other threads:[~2009-04-13 15:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-13  7:43 [RFT/RFC] rtl8187: Remove some magic numbers Hin-Tak Leung
  -- strict thread matches above, loose matches on Subject: below --
2009-04-13  0:40 Larry Finger
2009-04-13  9:51 ` Johannes Berg
2009-04-13 15:39   ` Larry Finger

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