diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2007-10-06 08:11:46 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:08 -0400 |
commit | 4abee4bbd771ce42b9a0a19be11264721aa0e3ed (patch) | |
tree | 238f6f7a411c69062aa5d1287409769068b0783d /drivers/net/wireless/rt2x00/rt73usb.c | |
parent | c109810318ef4d37e495f740e624b1a15b7a0818 (diff) |
[PATCH] rt2x00: Remove duplicate code in MAC & BSSID handling
The various drivers contained duplicate code to handle the
MAC and BSSID initialization correctly. This moves the
address copy to little endian variables to rt2x00config.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index ffed3ec5fb99..5fa697bfaa14 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -255,42 +255,28 @@ static const struct rt2x00debug rt73usb_rt2x00debug = { | |||
255 | /* | 255 | /* |
256 | * Configuration handlers. | 256 | * Configuration handlers. |
257 | */ | 257 | */ |
258 | static void rt73usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr) | 258 | static void rt73usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, __le32 *mac) |
259 | { | 259 | { |
260 | __le32 reg[2]; | ||
261 | u32 tmp; | 260 | u32 tmp; |
262 | 261 | ||
263 | memset(®, 0, sizeof(reg)); | 262 | tmp = le32_to_cpu(mac[1]); |
264 | memcpy(®, addr, ETH_ALEN); | ||
265 | |||
266 | tmp = le32_to_cpu(reg[1]); | ||
267 | rt2x00_set_field32(&tmp, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff); | 263 | rt2x00_set_field32(&tmp, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff); |
268 | reg[1] = cpu_to_le32(tmp); | 264 | mac[1] = cpu_to_le32(tmp); |
269 | 265 | ||
270 | /* | 266 | rt73usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac, |
271 | * The MAC address is passed to us as an array of bytes, | 267 | (2 * sizeof(__le32))); |
272 | * that array is little endian, so no need for byte ordering. | ||
273 | */ | ||
274 | rt73usb_register_multiwrite(rt2x00dev, MAC_CSR2, ®, sizeof(reg)); | ||
275 | } | 268 | } |
276 | 269 | ||
277 | static void rt73usb_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid) | 270 | static void rt73usb_config_bssid(struct rt2x00_dev *rt2x00dev, __le32 *bssid) |
278 | { | 271 | { |
279 | __le32 reg[2]; | ||
280 | u32 tmp; | 272 | u32 tmp; |
281 | 273 | ||
282 | memset(®, 0, sizeof(reg)); | 274 | tmp = le32_to_cpu(bssid[1]); |
283 | memcpy(®, bssid, ETH_ALEN); | ||
284 | |||
285 | tmp = le32_to_cpu(reg[1]); | ||
286 | rt2x00_set_field32(&tmp, MAC_CSR5_BSS_ID_MASK, 3); | 275 | rt2x00_set_field32(&tmp, MAC_CSR5_BSS_ID_MASK, 3); |
287 | reg[1] = cpu_to_le32(tmp); | 276 | bssid[1] = cpu_to_le32(tmp); |
288 | 277 | ||
289 | /* | 278 | rt73usb_register_multiwrite(rt2x00dev, MAC_CSR4, bssid, |
290 | * The BSSID is passed to us as an array of bytes, | 279 | (2 * sizeof(__le32))); |
291 | * that array is little endian, so no need for byte ordering. | ||
292 | */ | ||
293 | rt73usb_register_multiwrite(rt2x00dev, MAC_CSR4, ®, sizeof(reg)); | ||
294 | } | 280 | } |
295 | 281 | ||
296 | static void rt73usb_config_type(struct rt2x00_dev *rt2x00dev, const int type) | 282 | static void rt73usb_config_type(struct rt2x00_dev *rt2x00dev, const int type) |