summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00config.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2007-10-06 14:11:46 +0200
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 16:55:08 -0700
commit4abee4bbd771ce42b9a0a19be11264721aa0e3ed (patch)
tree238f6f7a411c69062aa5d1287409769068b0783d /drivers/net/wireless/rt2x00/rt2x00config.c
parentc109810318ef4d37e495f740e624b1a15b7a0818 (diff)
downloadop-kernel-dev-4abee4bbd771ce42b9a0a19be11264721aa0e3ed.zip
op-kernel-dev-4abee4bbd771ce42b9a0a19be11264721aa0e3ed.tar.gz
[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/rt2x00config.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 13b5106..aeeaa0c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -34,16 +34,44 @@
#include "rt2x00.h"
#include "rt2x00lib.h"
+
+/*
+ * The MAC and BSSID addressess are simple array of bytes,
+ * these arrays are little endian, so when sending the addressess
+ * to the drivers, copy the it into a endian-signed variable.
+ *
+ * Note that all devices (except rt2500usb) have 32 bits
+ * register word sizes. This means that whatever variable we
+ * pass _must_ be a multiple of 32 bits. Otherwise the device
+ * might not accept what we are sending to it.
+ * This will also make it easier for the driver to write
+ * the data to the device.
+ *
+ * Also note that when NULL is passed as address the
+ * we will send 00:00:00:00:00 to the device to clear the address.
+ * This will prevent the device being confused when it wants
+ * to ACK frames or consideres itself associated.
+ */
void rt2x00lib_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *mac)
{
+ __le32 reg[2];
+
+ memset(&reg, 0, sizeof(reg));
if (mac)
- rt2x00dev->ops->lib->config_mac_addr(rt2x00dev, mac);
+ memcpy(&reg, mac, ETH_ALEN);
+
+ rt2x00dev->ops->lib->config_mac_addr(rt2x00dev, &reg[0]);
}
void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
{
+ __le32 reg[2];
+
+ memset(&reg, 0, sizeof(reg));
if (bssid)
- rt2x00dev->ops->lib->config_bssid(rt2x00dev, bssid);
+ memcpy(&reg, bssid, ETH_ALEN);
+
+ rt2x00dev->ops->lib->config_bssid(rt2x00dev, &reg[0]);
}
void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type)
OpenPOWER on IntegriCloud