public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless-dev] d80211: Make MACSTR/MAC2STR macro available to drivers
@ 2006-07-23  8:43 Michael Wu
  2006-07-23  9:10 ` Michael Buesch
  2006-07-24 13:54 ` Jiri Benc
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Wu @ 2006-07-23  8:43 UTC (permalink / raw)
  To: linville; +Cc: Jiri Benc, Michael Buesch, netdev

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

d80211: Make MACSTR/MAC2STR macro available to drivers

This patch moves the MACSTR/MAC2STR macros to d80211.h
so that they are available to drivers. It also converts the adm8211
and bcm43xx drivers to use this macro.

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

 drivers/net/wireless/d80211/adm8211/adm8211.c      |    7 ++-----
 drivers/net/wireless/d80211/bcm43xx/bcm43xx.h      |    6 ------
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c |    8 ++++----
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c |    4 ++--
 include/net/d80211.h                               |    4 ++++
 net/d80211/ieee80211_i.h                           |    5 -----
 6 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/d80211/adm8211/adm8211.c b/drivers/net/wireless/d80211/adm8211/adm8211.c
index be4a058..0a762d7 100644
--- a/drivers/net/wireless/d80211/adm8211/adm8211.c
+++ b/drivers/net/wireless/d80211/adm8211/adm8211.c
@@ -74,9 +74,6 @@ #define PLCP_SIGNAL_2M		0x14
 #define PLCP_SIGNAL_5M5		0x37
 #define PLCP_SIGNAL_11M		0x6e
 
-#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
-#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
-
 struct adm8211_tx_hdr {
 	u8 da[6];
 	u8 signal; /* PLCP signal / TX rate in 100 Kbps */
@@ -2085,8 +2082,8 @@ #endif
 		goto err_free_desc;
 	}
 
-	printk("%s: hwaddr " MAC_FMT ", Rev 0x%02x\n",
-	       dev->name, MAC_ARG(dev->dev_addr), priv->revid);
+	printk("%s: hwaddr " MACSTR ", Rev 0x%02x\n",
+	       dev->name, MAC2STR(dev->dev_addr), priv->revid);
 
 	return 0;
 
diff --git a/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h b/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
index af4bb46..91a98a9 100644
--- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
@@ -991,10 +991,4 @@ #define limit_value(value, min, max)  \
 	 	__value;				\
 	})
 
-/** Helpers to print MAC addresses. */
-#define BCM43xx_MACFMT		"%02x:%02x:%02x:%02x:%02x:%02x"
-#define BCM43xx_MACARG(x)	((u8*)(x))[0], ((u8*)(x))[1], \
-				((u8*)(x))[2], ((u8*)(x))[3], \
-				((u8*)(x))[4], ((u8*)(x))[5]
-
 #endif /* BCM43xx_H_ */
diff --git a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
index b6425e3..82985f2 100644
--- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
@@ -4561,9 +4561,9 @@ static int bcm43xx_add_interface(struct 
 
 	dprintk(KERN_INFO PFX "Virtual interface added "
 			      "(type: 0x%08X, ID: %d, MAC: "
-			      BCM43xx_MACFMT ")\n",
+			      MACSTR ")\n",
 		conf->type, conf->if_id,
-		BCM43xx_MACARG(conf->mac_addr));
+		MAC2STR(conf->mac_addr));
 
 out_unlock:
 	bcm43xx_unlock_irqsafe(bcm, flags);
@@ -4589,9 +4589,9 @@ static void bcm43xx_remove_interface(str
 
 	dprintk(KERN_INFO PFX "Virtual interface removed "
 			      "(type: 0x%08X, ID: %d, MAC: "
-			      BCM43xx_MACFMT ")\n",
+			      MACSTR ")\n",
 		conf->type, conf->if_id,
-		BCM43xx_MACARG(conf->mac_addr));
+		MAC2STR(conf->mac_addr));
 }
 
 static int bcm43xx_config_interface(struct net_device *net_dev,
diff --git a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
index 562c6a1..6ebe9fa 100644
--- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
+++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
@@ -259,8 +259,8 @@ assert(dur);
 
 	txhdr->rts_cts_frame_control = cpu_to_le16(fctl);
 	txhdr->rts_cts_dur = cpu_to_le16(dur);
-//printk(BCM43xx_MACFMT "  " BCM43xx_MACFMT "  " BCM43xx_MACFMT "\n", BCM43xx_MACARG(wlhdr->addr1), BCM43xx_MACARG(wlhdr->addr2), BCM43xx_MACARG(wlhdr->addr3));
-//printk(BCM43xx_MACFMT "  " BCM43xx_MACFMT "\n", BCM43xx_MACARG(sa), BCM43xx_MACARG(da));
+//printk(MACSTR "  " MACSTR "  " MACSTR "\n", MAC2STR(wlhdr->addr1), MAC2STR(wlhdr->addr2), MAC2STR(wlhdr->addr3));
+//printk(MACSTR "  " MACSTR "\n", MAC2STR(sa), MAC2STR(da));
 	memcpy(txhdr->rts_cts_mac1, wlhdr->addr1, ETH_ALEN);//FIXME!
 	memcpy(txhdr->rts_cts_mac2, sa, ETH_ALEN);
 
diff --git a/include/net/d80211.h b/include/net/d80211.h
index e6dcb0e..b9d4b24 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -999,4 +999,8 @@ static inline int ieee80211_get_morefrag
 	return (le16_to_cpu(hdr->frame_control) & WLAN_FC_MOREFRAG) != 0;
 }
 
+#define MAC2STR(a) ((a)[0] & 0xff), ((a)[1] & 0xff), ((a)[2] & 0xff), \
+		   ((a)[3] & 0xff), ((a)[4] & 0xff), ((a)[5] & 0xff)
+#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
+
 #endif /* D80211_H */
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index 691edd0..df8a43e 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -46,11 +46,6 @@ #define AP_MAX_BC_BUFFER 128
 #define TOTAL_MAX_TX_BUFFER 512
 
 
-#define MAC2STR(a) ((a)[0] & 0xff), ((a)[1] & 0xff), ((a)[2] & 0xff), \
-		   ((a)[3] & 0xff), ((a)[4] & 0xff), ((a)[5] & 0xff)
-#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
-
-
 /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
  * reception of at least three fragmented frames. This limit can be increased
  * by changing this define, at the cost of slower frame reassembly and

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

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

* Re: [PATCH wireless-dev] d80211: Make MACSTR/MAC2STR macro available to drivers
  2006-07-23  8:43 [PATCH wireless-dev] d80211: Make MACSTR/MAC2STR macro available to drivers Michael Wu
@ 2006-07-23  9:10 ` Michael Buesch
  2006-07-23  9:31   ` Michael Wu
  2006-07-24 13:54 ` Jiri Benc
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Buesch @ 2006-07-23  9:10 UTC (permalink / raw)
  To: Michael Wu; +Cc: Jiri Benc, netdev, linville

On Sunday 23 July 2006 10:43, Michael Wu wrote:
> d80211: Make MACSTR/MAC2STR macro available to drivers
> 
> This patch moves the MACSTR/MAC2STR macros to d80211.h
> so that they are available to drivers. It also converts the adm8211
> and bcm43xx drivers to use this macro.

I'd say d80211.h is still the wrong place for this.
What about etherdevice.h?

-- 
Greetings Michael.

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

* Re: [PATCH wireless-dev] d80211: Make MACSTR/MAC2STR macro available to drivers
  2006-07-23  9:10 ` Michael Buesch
@ 2006-07-23  9:31   ` Michael Wu
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Wu @ 2006-07-23  9:31 UTC (permalink / raw)
  To: Michael Buesch; +Cc: Jiri Benc, netdev, linville

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

On Sunday 23 July 2006 02:10, Michael Buesch wrote:
> On Sunday 23 July 2006 10:43, Michael Wu wrote:
> > d80211: Make MACSTR/MAC2STR macro available to drivers
> >
> > This patch moves the MACSTR/MAC2STR macros to d80211.h
> > so that they are available to drivers. It also converts the adm8211
> > and bcm43xx drivers to use this macro.
>
> I'd say d80211.h is still the wrong place for this.
But it's less wrong than before. :)

> What about etherdevice.h?
Sure, but I'll have to update many more drivers to make that happen. Using 
macros to print mac addrs seems to be mostly confined to wireless drivers
at this point.

-Michael Wu

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

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

* Re: [PATCH wireless-dev] d80211: Make MACSTR/MAC2STR macro available to drivers
  2006-07-23  8:43 [PATCH wireless-dev] d80211: Make MACSTR/MAC2STR macro available to drivers Michael Wu
  2006-07-23  9:10 ` Michael Buesch
@ 2006-07-24 13:54 ` Jiri Benc
  2006-07-24 16:40   ` Michael Wu
  1 sibling, 1 reply; 5+ messages in thread
From: Jiri Benc @ 2006-07-24 13:54 UTC (permalink / raw)
  To: Michael Wu; +Cc: linville, Michael Buesch, netdev

On Sun, 23 Jul 2006 01:43:25 -0700, Michael Wu wrote:
> This patch moves the MACSTR/MAC2STR macros to d80211.h
> so that they are available to drivers. It also converts the adm8211
> and bcm43xx drivers to use this macro.

I really dislike those MACSTR/MAC2STR names. I always fail to remember
which one is which. What about renaming them when we are touching them?

And why not to use MAC_FMT/MAC_ARG names as used in net/ieee80211.h? ;-)

Thanks,

 Jiri

-- 
Jiri Benc
SUSE Labs

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

* Re: [PATCH wireless-dev] d80211: Make MACSTR/MAC2STR macro available to drivers
  2006-07-24 13:54 ` Jiri Benc
@ 2006-07-24 16:40   ` Michael Wu
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Wu @ 2006-07-24 16:40 UTC (permalink / raw)
  To: Jiri Benc; +Cc: linville, Michael Buesch, netdev

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

On Monday 24 July 2006 06:54, Jiri Benc wrote:
> I really dislike those MACSTR/MAC2STR names. I always fail to remember
> which one is which. What about renaming them when we are touching them?
>
> And why not to use MAC_FMT/MAC_ARG names as used in net/ieee80211.h? ;-)
>
I dislike MACSTR/MAC2STR too, but I was trying to minimize changes to the 
d80211 code. I'll switch to MAC_FMT/MAC_ARG.

-Michael Wu

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

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

end of thread, other threads:[~2006-07-24 16:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-23  8:43 [PATCH wireless-dev] d80211: Make MACSTR/MAC2STR macro available to drivers Michael Wu
2006-07-23  9:10 ` Michael Buesch
2006-07-23  9:31   ` Michael Wu
2006-07-24 13:54 ` Jiri Benc
2006-07-24 16:40   ` Michael Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox