From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John Linville" <linville@tuxdriver.com>
Cc: wireless <linux-wireless@vger.kernel.org>
Subject: [PATCH 1/4] rt2x00: multiread/multiwrite should accept void*
Date: Thu, 8 Mar 2007 22:14:46 +0100 [thread overview]
Message-ID: <200703082214.46398.IvDoorn@gmail.com> (raw)
This patch will make rt2x00_register_multiread/multiwrite
accept void* pointers. This could prevent possible byte
ordering issues during unneeded casts. Since we are
at it anyway also cleanup those casts. ;)
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
index 93da031..ff5d67a 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
@@ -68,7 +68,7 @@ static inline void rt2x00_register_read(
static inline void rt2x00_register_multiread(
const struct rt2x00_dev *rt2x00dev,
- const unsigned long offset, u32 *value, const u16 length)
+ const unsigned long offset, void *value, const u16 length)
{
memcpy_fromio(value, rt2x00dev->csr_addr + offset, length);
}
@@ -82,7 +82,7 @@ static inline void rt2x00_register_write(
static inline void rt2x00_register_multiwrite(
const struct rt2x00_dev *rt2x00dev,
- const unsigned long offset, u32 *value, const u16 length)
+ const unsigned long offset, void *value, const u16 length)
{
memcpy_toio(rt2x00dev->csr_addr + offset, value, length);
}
@@ -206,19 +206,19 @@ static void rt2400pci_write_csr(struct rt2x00_dev *rt2x00dev,
static void rt2400pci_read_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_read(rt2x00dev, word, (u16*)data);
+ rt2x00_eeprom_read(rt2x00dev, word, data);
}
static void rt2400pci_write_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_write(rt2x00dev, word, *(u16*)data);
+ rt2x00_eeprom_write(rt2x00dev, word, *((u16*)data));
}
static void rt2400pci_read_bbp(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_bbp_read(rt2x00dev, word, ((u8*)data));
+ rt2x00_bbp_read(rt2x00dev, word, data);
}
static void rt2400pci_write_bbp(struct rt2x00_dev *rt2x00dev,
@@ -276,7 +276,7 @@ static void rt2400pci_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
* The BSSID is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, CSR5, (u32*)bssid, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, CSR5, bssid, ETH_ALEN);
}
static void rt2400pci_config_promisc(struct rt2x00_dev *rt2x00dev, int promisc)
@@ -631,7 +631,7 @@ static void rt2400pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
* The MAC address is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, CSR3, (u32*)addr, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, CSR3, addr, ETH_ALEN);
}
/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
index 1e659aa..7a1d924 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
@@ -68,7 +68,7 @@ static inline void rt2x00_register_read(
static inline void rt2x00_register_multiread(
const struct rt2x00_dev *rt2x00dev,
- const unsigned long offset, u32 *value, const u16 length)
+ const unsigned long offset, void *value, const u16 length)
{
memcpy_fromio(value, rt2x00dev->csr_addr + offset, length);
}
@@ -82,7 +82,7 @@ static inline void rt2x00_register_write(
static inline void rt2x00_register_multiwrite(
const struct rt2x00_dev *rt2x00dev,
- const unsigned long offset, u32 *value, const u16 length)
+ const unsigned long offset, void *value, const u16 length)
{
memcpy_toio(rt2x00dev->csr_addr + offset, value, length);
}
@@ -206,19 +206,19 @@ static void rt2500pci_write_csr(struct rt2x00_dev *rt2x00dev,
static void rt2500pci_read_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_read(rt2x00dev, word, (u16*)data);
+ rt2x00_eeprom_read(rt2x00dev, word, data);
}
static void rt2500pci_write_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_write(rt2x00dev, word, *(u16*)data);
+ rt2x00_eeprom_write(rt2x00dev, word, *((u16*)data));
}
static void rt2500pci_read_bbp(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_bbp_read(rt2x00dev, word, ((u8*)data));
+ rt2x00_bbp_read(rt2x00dev, word, data);
}
static void rt2500pci_write_bbp(struct rt2x00_dev *rt2x00dev,
@@ -276,7 +276,7 @@ static void rt2500pci_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
* The BSSID is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, CSR5, (u32*)bssid, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, CSR5, bssid, ETH_ALEN);
}
static void rt2500pci_config_promisc(struct rt2x00_dev *rt2x00dev, int promisc)
@@ -706,7 +706,7 @@ static void rt2500pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
* The MAC address is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, CSR3, (u32*)addr, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, CSR3, addr, ETH_ALEN);
}
/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
index b9eda8d..82d5d1b 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
@@ -95,7 +95,7 @@ static inline void rt2x00_register_read(
static inline void rt2x00_register_multiread(
const struct rt2x00_dev *rt2x00dev,
- const u16 offset, u16 *value, const u16 length)
+ const u16 offset, void *value, const u16 length)
{
rt2x00_vendor_request(
rt2x00dev, USB_MULTI_READ, USB_VENDOR_REQUEST_IN,
@@ -115,7 +115,7 @@ static inline void rt2x00_register_write(
static inline void rt2x00_register_multiwrite(
const struct rt2x00_dev *rt2x00dev,
- const u16 offset, u16 *value, const u16 length)
+ const u16 offset, void *value, const u16 length)
{
rt2x00_vendor_request(
rt2x00dev, USB_MULTI_WRITE, USB_VENDOR_REQUEST_OUT,
@@ -248,19 +248,19 @@ static void rt2500usb_write_csr(struct rt2x00_dev *rt2x00dev,
static void rt2500usb_read_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_read(rt2x00dev, word, (u16*)data);
+ rt2x00_eeprom_read(rt2x00dev, word, data);
}
static void rt2500usb_write_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_write(rt2x00dev, word, *(u16*)data);
+ rt2x00_eeprom_write(rt2x00dev, word, *((u16*)data));
}
static void rt2500usb_read_bbp(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_bbp_read(rt2x00dev, word, ((u8*)data));
+ rt2x00_bbp_read(rt2x00dev, word, data);
}
static void rt2500usb_write_bbp(struct rt2x00_dev *rt2x00dev,
@@ -318,7 +318,7 @@ static void rt2500usb_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
* The BSSID is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR5, (u16*)bssid, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR5, bssid, ETH_ALEN);
}
static void rt2500usb_config_promisc(struct rt2x00_dev *rt2x00dev, int promisc)
@@ -714,7 +714,7 @@ static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
* The MAC address is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, (u16*)addr, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, addr, ETH_ALEN);
}
/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt61pci.c b/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
index 21278c6..2de9201 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
@@ -71,7 +71,7 @@ static inline void rt2x00_register_read(
static inline void rt2x00_register_multiread(
const struct rt2x00_dev *rt2x00dev,
- const unsigned long offset, u32 *value, const u16 length)
+ const unsigned long offset, void *value, const u16 length)
{
readl(rt2x00dev->csr_addr + MAC_CSR0);
memcpy_fromio(value, rt2x00dev->csr_addr + offset, length);
@@ -87,7 +87,7 @@ static inline void rt2x00_register_write(
static inline void rt2x00_register_multiwrite(
const struct rt2x00_dev *rt2x00dev,
- const unsigned long offset, u32 *value, const u16 length)
+ const unsigned long offset, void *value, const u16 length)
{
readl(rt2x00dev->csr_addr + MAC_CSR0);
memcpy_toio(rt2x00dev->csr_addr + offset, value, length);
@@ -237,19 +237,19 @@ static void rt61pci_write_csr(struct rt2x00_dev *rt2x00dev,
static void rt61pci_read_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_read(rt2x00dev, word, (u16*)data);
+ rt2x00_eeprom_read(rt2x00dev, word, data);
}
static void rt61pci_write_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_write(rt2x00dev, word, *(u16*)data);
+ rt2x00_eeprom_write(rt2x00dev, word, *((u16*)data));
}
static void rt61pci_read_bbp(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_bbp_read(rt2x00dev, word, ((u8*)data));
+ rt2x00_bbp_read(rt2x00dev, word, data);
}
static void rt61pci_write_bbp(struct rt2x00_dev *rt2x00dev,
@@ -310,7 +310,7 @@ static void rt61pci_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
* that array is little endian, so no need for byte ordering.
* We only need to set the BSS ID MASK at the correct offset.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR4, (u32*)bssid, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR4, bssid, ETH_ALEN);
rt2x00_register_read(rt2x00dev, MAC_CSR5, ®);
rt2x00_set_field32(®, MAC_CSR5_BSS_ID_MASK, 3);
@@ -927,7 +927,7 @@ static void rt61pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
* We only need to set the MAC_CSR3_UNICAST_TO_ME_MASK
* at the correct offset.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, (u32*)addr, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, addr, ETH_ALEN);
rt2x00_register_read(rt2x00dev, MAC_CSR3, ®);
rt2x00_set_field32(®, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff);
@@ -2960,7 +2960,7 @@ static void rt61pci_load_firmware(const struct firmware *fw, void *context)
rt2x00_register_write(rt2x00dev, MCU_CNTL_CSR, reg);
rt2x00_register_multiwrite(
- rt2x00dev, FIRMWARE_IMAGE_BASE, (u32*)fw->data, fw->size);
+ rt2x00dev, FIRMWARE_IMAGE_BASE, fw->data, fw->size);
rt2x00_set_field32(®, MCU_CNTL_CSR_SELECT_BANK, 0);
rt2x00_register_write(rt2x00dev, MCU_CNTL_CSR, reg);
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt73usb.c b/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
index 9ede5fa..5a187e6 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
@@ -97,7 +97,7 @@ static inline void rt2x00_register_read(
static inline void rt2x00_register_multiread(
const struct rt2x00_dev *rt2x00dev,
- const u16 offset, u32 *value, const u32 length)
+ const u16 offset, void *value, const u32 length)
{
rt2x00_vendor_request(
rt2x00dev, USB_MULTI_READ, USB_VENDOR_REQUEST_IN,
@@ -117,7 +117,7 @@ static inline void rt2x00_register_write(
static inline void rt2x00_register_multiwrite(
const struct rt2x00_dev *rt2x00dev,
- const u16 offset, u32 *value, const u32 length)
+ const u16 offset, void *value, const u32 length)
{
rt2x00_vendor_request(
rt2x00dev, USB_MULTI_WRITE, USB_VENDOR_REQUEST_OUT,
@@ -244,19 +244,19 @@ static void rt73usb_write_csr(struct rt2x00_dev *rt2x00dev,
static void rt73usb_read_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_read(rt2x00dev, word, (u16*)data);
+ rt2x00_eeprom_read(rt2x00dev, word, data);
}
static void rt73usb_write_eeprom(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_eeprom_write(rt2x00dev, word, *(u16*)data);
+ rt2x00_eeprom_write(rt2x00dev, word, *((u16*)data));
}
static void rt73usb_read_bbp(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data)
{
- rt2x00_bbp_read(rt2x00dev, word, ((u8*)data));
+ rt2x00_bbp_read(rt2x00dev, word, data);
}
static void rt73usb_write_bbp(struct rt2x00_dev *rt2x00dev,
@@ -317,7 +317,7 @@ static void rt73usb_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
* that array is little endian, so no need for byte ordering.
* We only need to set the BSS ID MASK at the correct offset.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR4, (u32*)bssid, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR4, bssid, ETH_ALEN);
rt2x00_register_read(rt2x00dev, MAC_CSR5, ®);
rt2x00_set_field32(®, MAC_CSR5_BSS_ID_MASK, 3);
@@ -822,7 +822,7 @@ static void rt73usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
* We only need to set the MAC_CSR3_UNICAST_TO_ME_MASK
* at the correct offset.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, (u32*)addr, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, addr, ETH_ALEN);
rt2x00_register_read(rt2x00dev, MAC_CSR3, ®);
rt2x00_set_field32(®, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff);
reply other threads:[~2007-03-08 21:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200703082214.46398.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.