forked from luck/tmp_suning_uos_patched
wireless: use get/put_unaligned_* helpers
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Cc: John W. Linville <linville@tuxdriver.com> Cc: Michael Buesch <mb@bu3sch.de> Cc: Daniel Drake <dsd@gentoo.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6caf52a453
commit
533dd1b0be
@ -3657,7 +3657,7 @@ void mpi_receive_802_11 (struct airo_info *ai)
|
|||||||
ptr += hdrlen;
|
ptr += hdrlen;
|
||||||
if (hdrlen == 24)
|
if (hdrlen == 24)
|
||||||
ptr += 6;
|
ptr += 6;
|
||||||
gap = le16_to_cpu(get_unaligned((__le16 *)ptr));
|
gap = get_unaligned_le16(ptr);
|
||||||
ptr += sizeof(__le16);
|
ptr += sizeof(__le16);
|
||||||
if (gap) {
|
if (gap) {
|
||||||
if (gap <= 8)
|
if (gap <= 8)
|
||||||
|
@ -58,10 +58,6 @@
|
|||||||
#include "reg.h"
|
#include "reg.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
/* unaligned little endian access */
|
|
||||||
#define LE_READ_2(_p) (le16_to_cpu(get_unaligned((__le16 *)(_p))))
|
|
||||||
#define LE_READ_4(_p) (le32_to_cpu(get_unaligned((__le32 *)(_p))))
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ATH_LED_TX,
|
ATH_LED_TX,
|
||||||
ATH_LED_RX,
|
ATH_LED_RX,
|
||||||
@ -2909,9 +2905,9 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
|
|||||||
if (!mclist)
|
if (!mclist)
|
||||||
break;
|
break;
|
||||||
/* calculate XOR of eight 6-bit values */
|
/* calculate XOR of eight 6-bit values */
|
||||||
val = LE_READ_4(mclist->dmi_addr + 0);
|
val = get_unaligned_le32(mclist->dmi_addr + 0);
|
||||||
pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
|
pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
|
||||||
val = LE_READ_4(mclist->dmi_addr + 3);
|
val = get_unaligned_le32(mclist->dmi_addr + 3);
|
||||||
pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
|
pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
|
||||||
pos &= 0x3f;
|
pos &= 0x3f;
|
||||||
mfilt[pos / 32] |= (1 << (pos % 32));
|
mfilt[pos / 32] |= (1 << (pos % 32));
|
||||||
|
@ -2171,7 +2171,7 @@ static int b43_write_initvals(struct b43_wldev *dev,
|
|||||||
goto err_format;
|
goto err_format;
|
||||||
array_size -= sizeof(iv->data.d32);
|
array_size -= sizeof(iv->data.d32);
|
||||||
|
|
||||||
value = be32_to_cpu(get_unaligned(&iv->data.d32));
|
value = get_unaligned_be32(&iv->data.d32);
|
||||||
b43_write32(dev, offset, value);
|
b43_write32(dev, offset, value);
|
||||||
|
|
||||||
iv = (const struct b43_iv *)((const uint8_t *)iv +
|
iv = (const struct b43_iv *)((const uint8_t *)iv +
|
||||||
|
@ -1720,7 +1720,7 @@ static int b43legacy_write_initvals(struct b43legacy_wldev *dev,
|
|||||||
goto err_format;
|
goto err_format;
|
||||||
array_size -= sizeof(iv->data.d32);
|
array_size -= sizeof(iv->data.d32);
|
||||||
|
|
||||||
value = be32_to_cpu(get_unaligned(&iv->data.d32));
|
value = get_unaligned_be32(&iv->data.d32);
|
||||||
b43legacy_write32(dev, offset, value);
|
b43legacy_write32(dev, offset, value);
|
||||||
|
|
||||||
iv = (const struct b43legacy_iv *)((const uint8_t *)iv +
|
iv = (const struct b43legacy_iv *)((const uint8_t *)iv +
|
||||||
|
@ -554,40 +554,36 @@ static void iwl3945_add_radiotap(struct iwl3945_priv *priv,
|
|||||||
iwl3945_rt->rt_hdr.it_pad = 0;
|
iwl3945_rt->rt_hdr.it_pad = 0;
|
||||||
|
|
||||||
/* total header + data */
|
/* total header + data */
|
||||||
put_unaligned(cpu_to_le16(sizeof(*iwl3945_rt)),
|
put_unaligned_le16(sizeof(*iwl3945_rt), &iwl3945_rt->rt_hdr.it_len);
|
||||||
&iwl3945_rt->rt_hdr.it_len);
|
|
||||||
|
|
||||||
/* Indicate all the fields we add to the radiotap header */
|
/* Indicate all the fields we add to the radiotap header */
|
||||||
put_unaligned(cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) |
|
put_unaligned_le32((1 << IEEE80211_RADIOTAP_TSFT) |
|
||||||
(1 << IEEE80211_RADIOTAP_FLAGS) |
|
(1 << IEEE80211_RADIOTAP_FLAGS) |
|
||||||
(1 << IEEE80211_RADIOTAP_RATE) |
|
(1 << IEEE80211_RADIOTAP_RATE) |
|
||||||
(1 << IEEE80211_RADIOTAP_CHANNEL) |
|
(1 << IEEE80211_RADIOTAP_CHANNEL) |
|
||||||
(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
|
(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
|
||||||
(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |
|
(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |
|
||||||
(1 << IEEE80211_RADIOTAP_ANTENNA)),
|
(1 << IEEE80211_RADIOTAP_ANTENNA),
|
||||||
&iwl3945_rt->rt_hdr.it_present);
|
&iwl3945_rt->rt_hdr.it_present);
|
||||||
|
|
||||||
/* Zero the flags, we'll add to them as we go */
|
/* Zero the flags, we'll add to them as we go */
|
||||||
iwl3945_rt->rt_flags = 0;
|
iwl3945_rt->rt_flags = 0;
|
||||||
|
|
||||||
put_unaligned(cpu_to_le64(tsf), &iwl3945_rt->rt_tsf);
|
put_unaligned_le64(tsf, &iwl3945_rt->rt_tsf);
|
||||||
|
|
||||||
iwl3945_rt->rt_dbmsignal = signal;
|
iwl3945_rt->rt_dbmsignal = signal;
|
||||||
iwl3945_rt->rt_dbmnoise = noise;
|
iwl3945_rt->rt_dbmnoise = noise;
|
||||||
|
|
||||||
/* Convert the channel frequency and set the flags */
|
/* Convert the channel frequency and set the flags */
|
||||||
put_unaligned(cpu_to_le16(stats->freq), &iwl3945_rt->rt_channelMHz);
|
put_unaligned_le16(stats->freq, &iwl3945_rt->rt_channelMHz);
|
||||||
if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK))
|
if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK))
|
||||||
put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM |
|
put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ,
|
||||||
IEEE80211_CHAN_5GHZ),
|
|
||||||
&iwl3945_rt->rt_chbitmask);
|
&iwl3945_rt->rt_chbitmask);
|
||||||
else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK)
|
else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK)
|
||||||
put_unaligned(cpu_to_le16(IEEE80211_CHAN_CCK |
|
put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ,
|
||||||
IEEE80211_CHAN_2GHZ),
|
|
||||||
&iwl3945_rt->rt_chbitmask);
|
&iwl3945_rt->rt_chbitmask);
|
||||||
else /* 802.11g */
|
else /* 802.11g */
|
||||||
put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM |
|
put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ,
|
||||||
IEEE80211_CHAN_2GHZ),
|
|
||||||
&iwl3945_rt->rt_chbitmask);
|
&iwl3945_rt->rt_chbitmask);
|
||||||
|
|
||||||
if (rate == -1)
|
if (rate == -1)
|
||||||
|
@ -522,7 +522,7 @@ static int lbs_process_bss(struct bss_descriptor *bss,
|
|||||||
|
|
||||||
if (*bytesleft >= sizeof(beaconsize)) {
|
if (*bytesleft >= sizeof(beaconsize)) {
|
||||||
/* Extract & convert beacon size from the command buffer */
|
/* Extract & convert beacon size from the command buffer */
|
||||||
beaconsize = le16_to_cpu(get_unaligned((__le16 *)*pbeaconinfo));
|
beaconsize = get_unaligned_le16(*pbeaconinfo);
|
||||||
*bytesleft -= sizeof(beaconsize);
|
*bytesleft -= sizeof(beaconsize);
|
||||||
*pbeaconinfo += sizeof(beaconsize);
|
*pbeaconinfo += sizeof(beaconsize);
|
||||||
}
|
}
|
||||||
|
@ -545,11 +545,11 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
|
|||||||
* be padded. Unaligned access might also happen if the length_info
|
* be padded. Unaligned access might also happen if the length_info
|
||||||
* structure is not present.
|
* structure is not present.
|
||||||
*/
|
*/
|
||||||
if (get_unaligned(&length_info->tag) == cpu_to_le16(RX_LENGTH_INFO_TAG))
|
if (get_unaligned_le16(&length_info->tag) == RX_LENGTH_INFO_TAG)
|
||||||
{
|
{
|
||||||
unsigned int l, k, n;
|
unsigned int l, k, n;
|
||||||
for (i = 0, l = 0;; i++) {
|
for (i = 0, l = 0;; i++) {
|
||||||
k = le16_to_cpu(get_unaligned(&length_info->length[i]));
|
k = get_unaligned_le16(&length_info->length[i]);
|
||||||
if (k == 0)
|
if (k == 0)
|
||||||
return;
|
return;
|
||||||
n = l+k;
|
n = l+k;
|
||||||
|
Loading…
Reference in New Issue
Block a user