Commit 7f6e0e44 authored by Moritz Muehlenhoff's avatar Moritz Muehlenhoff Committed by Greg Kroah-Hartman

Staging: wlan-ng: Replace BITx with the generic BIT(x)

Signed-off-by: default avatarMoritz Muehlenhoff <jmm@debian.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ae26230b
This diff is collapsed.
......@@ -167,17 +167,17 @@
/* SET_FC_FSTYPE(WLAN_FSTYPE_RTS) ); */
/*------------------------------------------------------------*/
#define WLAN_GET_FC_PVER(n) (((u16)(n)) & (BIT0 | BIT1))
#define WLAN_GET_FC_FTYPE(n) ((((u16)(n)) & (BIT2 | BIT3)) >> 2)
#define WLAN_GET_FC_FSTYPE(n) ((((u16)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
#define WLAN_GET_FC_TODS(n) ((((u16)(n)) & (BIT8)) >> 8)
#define WLAN_GET_FC_FROMDS(n) ((((u16)(n)) & (BIT9)) >> 9)
#define WLAN_GET_FC_MOREFRAG(n) ((((u16)(n)) & (BIT10)) >> 10)
#define WLAN_GET_FC_RETRY(n) ((((u16)(n)) & (BIT11)) >> 11)
#define WLAN_GET_FC_PWRMGT(n) ((((u16)(n)) & (BIT12)) >> 12)
#define WLAN_GET_FC_MOREDATA(n) ((((u16)(n)) & (BIT13)) >> 13)
#define WLAN_GET_FC_ISWEP(n) ((((u16)(n)) & (BIT14)) >> 14)
#define WLAN_GET_FC_ORDER(n) ((((u16)(n)) & (BIT15)) >> 15)
#define WLAN_GET_FC_PVER(n) (((u16)(n)) & (BIT(0) | BIT(1)))
#define WLAN_GET_FC_FTYPE(n) ((((u16)(n)) & (BIT(2) | BIT(3))) >> 2)
#define WLAN_GET_FC_FSTYPE(n) ((((u16)(n)) & (BIT(4)|BIT(5)|BIT(6)|BIT(7))) >> 4)
#define WLAN_GET_FC_TODS(n) ((((u16)(n)) & (BIT(8))) >> 8)
#define WLAN_GET_FC_FROMDS(n) ((((u16)(n)) & (BIT(9))) >> 9)
#define WLAN_GET_FC_MOREFRAG(n) ((((u16)(n)) & (BIT(10))) >> 10)
#define WLAN_GET_FC_RETRY(n) ((((u16)(n)) & (BIT(11))) >> 11)
#define WLAN_GET_FC_PWRMGT(n) ((((u16)(n)) & (BIT(12))) >> 12)
#define WLAN_GET_FC_MOREDATA(n) ((((u16)(n)) & (BIT(13))) >> 13)
#define WLAN_GET_FC_ISWEP(n) ((((u16)(n)) & (BIT(14))) >> 14)
#define WLAN_GET_FC_ORDER(n) ((((u16)(n)) & (BIT(15))) >> 15)
#define WLAN_SET_FC_PVER(n) ((u16)(n))
#define WLAN_SET_FC_FTYPE(n) (((u16)(n)) << 2)
......@@ -202,8 +202,8 @@
/* Macros to get/set the bitfields of the Sequence Control */
/* Field. */
/*------------------------------------------------------------*/
#define WLAN_GET_SEQ_FRGNUM(n) (((u16)(n)) & (BIT0|BIT1|BIT2|BIT3))
#define WLAN_GET_SEQ_SEQNUM(n) ((((u16)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
#define WLAN_GET_SEQ_FRGNUM(n) (((u16)(n)) & (BIT(0)|BIT(1)|BIT(2)|BIT(3)))
#define WLAN_GET_SEQ_SEQNUM(n) ((((u16)(n)) & (~(BIT(0)|BIT(1)|BIT(2)|BIT(3)))) >> 4)
/*--- Data ptr macro -----------------------------------------*/
/* Creates a u8* to the data portion of a frame */
......@@ -212,7 +212,7 @@
#define WLAN_HDR_A3_DATAP(p) (((u8*)(p)) + WLAN_HDR_A3_LEN)
#define WLAN_HDR_A4_DATAP(p) (((u8*)(p)) + WLAN_HDR_A4_LEN)
#define DOT11_RATE5_ISBASIC_GET(r) (((u8)(r)) & BIT7)
#define DOT11_RATE5_ISBASIC_GET(r) (((u8)(r)) & BIT(7))
/*================================================================*/
/* Types */
......
......@@ -86,9 +86,9 @@
/*----------------------------------------------------------------*/
/* Netlink multicast bits for different types of messages */
#define P80211_NL_MCAST_GRP_MLME BIT0 /* Local station messages */
#define P80211_NL_MCAST_GRP_SNIFF BIT1 /* Sniffer messages */
#define P80211_NL_MCAST_GRP_DIST BIT2 /* Distribution system messages */
#define P80211_NL_MCAST_GRP_MLME BIT(0) /* Local station messages */
#define P80211_NL_MCAST_GRP_SNIFF BIT(1) /* Sniffer messages */
#define P80211_NL_MCAST_GRP_DIST BIT(2) /* Distribution system messages */
/*================================================================*/
/* Types */
......
......@@ -213,15 +213,15 @@
/* Macros */
/*-- Capability Field ---------------------------*/
#define WLAN_GET_MGMT_CAP_INFO_ESS(n) ((n) & BIT0)
#define WLAN_GET_MGMT_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1)
#define WLAN_GET_MGMT_CAP_INFO_CFPOLLABLE(n) (((n) & BIT2) >> 2)
#define WLAN_GET_MGMT_CAP_INFO_CFPOLLREQ(n) (((n) & BIT3) >> 3)
#define WLAN_GET_MGMT_CAP_INFO_PRIVACY(n) (((n) & BIT4) >> 4)
#define WLAN_GET_MGMT_CAP_INFO_ESS(n) ((n) & BIT(0))
#define WLAN_GET_MGMT_CAP_INFO_IBSS(n) (((n) & BIT(1)) >> 1)
#define WLAN_GET_MGMT_CAP_INFO_CFPOLLABLE(n) (((n) & BIT(2)) >> 2)
#define WLAN_GET_MGMT_CAP_INFO_CFPOLLREQ(n) (((n) & BIT(3)) >> 3)
#define WLAN_GET_MGMT_CAP_INFO_PRIVACY(n) (((n) & BIT(4)) >> 4)
/* p80211b additions */
#define WLAN_GET_MGMT_CAP_INFO_SHORT(n) (((n) & BIT5) >> 5)
#define WLAN_GET_MGMT_CAP_INFO_PBCC(n) (((n) & BIT6) >> 6)
#define WLAN_GET_MGMT_CAP_INFO_AGILITY(n) (((n) & BIT7) >> 7)
#define WLAN_GET_MGMT_CAP_INFO_SHORT(n) (((n) & BIT(5)) >> 5)
#define WLAN_GET_MGMT_CAP_INFO_PBCC(n) (((n) & BIT(6)) >> 6)
#define WLAN_GET_MGMT_CAP_INFO_AGILITY(n) (((n) & BIT(7)) >> 7)
#define WLAN_SET_MGMT_CAP_INFO_ESS(n) (n)
#define WLAN_SET_MGMT_CAP_INFO_IBSS(n) ((n) << 1)
......
......@@ -158,11 +158,11 @@ int p80211wext_event_associated(struct wlandevice *wlandev, int assoc);
#define NUM_WEPKEYS 4
#define MAX_KEYLEN 32
#define HOSTWEP_DEFAULTKEY_MASK (BIT1|BIT0)
#define HOSTWEP_DECRYPT BIT4
#define HOSTWEP_ENCRYPT BIT5
#define HOSTWEP_PRIVACYINVOKED BIT6
#define HOSTWEP_EXCLUDEUNENCRYPTED BIT7
#define HOSTWEP_DEFAULTKEY_MASK (BIT(1)|BIT(0))
#define HOSTWEP_DECRYPT BIT(4)
#define HOSTWEP_ENCRYPT BIT(5)
#define HOSTWEP_PRIVACYINVOKED BIT(6)
#define HOSTWEP_EXCLUDEUNENCRYPTED BIT(7)
extern int wlan_watchdog;
extern int wlan_wext_write;
......
......@@ -52,6 +52,7 @@
#include <asm/uaccess.h>
#include <asm/byteorder.h>
#include <linux/if_ether.h>
#include <linux/bitops.h>
/*================================================================*/
/* Project Includes */
......@@ -126,7 +127,7 @@ static const long p80211wext_channel_freq[] = {
#define NUM_CHANNELS ARRAY_SIZE(p80211wext_channel_freq)
/* steal a spare bit to store the shared/opensystems state. should default to open if not set */
#define HOSTWEP_SHAREDKEY BIT3
#define HOSTWEP_SHAREDKEY BIT(3)
/** function declarations =============== */
......
......@@ -76,6 +76,7 @@
#include <asm/byteorder.h>
#include <linux/random.h>
#include <linux/usb.h>
#include <linux/bitops.h>
#include "wlan_compat.h"
......@@ -94,10 +95,10 @@
#include "prism2mgmt.h"
/* Converts 802.11 format rate specifications to prism2 */
#define p80211rate_to_p2bit(n) ((((n)&~BIT7) == 2) ? BIT0 : \
(((n)&~BIT7) == 4) ? BIT1 : \
(((n)&~BIT7) == 11) ? BIT2 : \
(((n)&~BIT7) == 22) ? BIT3 : 0)
#define p80211rate_to_p2bit(n) ((((n)&~BIT(7)) == 2) ? BIT(0) : \
(((n)&~BIT(7)) == 4) ? BIT(1) : \
(((n)&~BIT(7)) == 11) ? BIT(2) : \
(((n)&~BIT(7)) == 22) ? BIT(3) : 0)
/*----------------------------------------------------------------
* prism2mgmt_scan
......@@ -196,7 +197,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp)
for (i = 0; i < msg->channellist.data.len; i++) {
u8 channel = msg->channellist.data.data[i];
if (channel > 14) continue;
/* channel 1 is BIT0 ... channel 14 is BIT13 */
/* channel 1 is BIT 0 ... channel 14 is BIT 13 */
word |= (1 << (channel-1));
}
scanreq.channelList = host2hfa384x_16(word);
......
......@@ -67,6 +67,7 @@
#include <linux/delay.h>
#include <asm/byteorder.h>
#include <linux/usb.h>
#include <linux/bitops.h>
/*================================================================*/
/* Project Includes */
......@@ -996,28 +997,28 @@ void prism2mgmt_get_oprateset(u16 *rate, p80211pstrd_t *pstr)
datarate = pstr->data;
/* 1 Mbps */
if ( BIT0 & (*rate) ) {
if ( BIT(0) & (*rate) ) {
len += (u8)1;
*datarate = (u8)2;
datarate++;
}
/* 2 Mbps */
if ( BIT1 & (*rate) ) {
if ( BIT(1) & (*rate) ) {
len += (u8)1;
*datarate = (u8)4;
datarate++;
}
/* 5.5 Mbps */
if ( BIT2 & (*rate) ) {
if ( BIT(2) & (*rate) ) {
len += (u8)1;
*datarate = (u8)11;
datarate++;
}
/* 11 Mbps */
if ( BIT3 & (*rate) ) {
if ( BIT(3) & (*rate) ) {
len += (u8)1;
*datarate = (u8)22;
datarate++;
......@@ -1055,16 +1056,16 @@ void prism2mgmt_set_oprateset(u16 *rate, p80211pstrd_t *pstr)
for ( i=0; i < pstr->len; i++, datarate++ ) {
switch (*datarate) {
case 2: /* 1 Mbps */
*rate |= BIT0;
*rate |= BIT(0);
break;
case 4: /* 2 Mbps */
*rate |= BIT1;
*rate |= BIT(1);
break;
case 11: /* 5.5 Mbps */
*rate |= BIT2;
*rate |= BIT(2);
break;
case 22: /* 11 Mbps */
*rate |= BIT3;
*rate |= BIT(3);
break;
default:
WLAN_LOG_DEBUG(1, "Unrecoginzed Rate of %d\n",
......
......@@ -72,6 +72,7 @@
#include <asm/byteorder.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/bitops.h>
#include "wlan_compat.h"
......@@ -713,8 +714,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
hw->ident_sta_fw.minor = hfa384x2host_16(hw->ident_sta_fw.minor);
/* strip out the 'special' variant bits */
hw->mm_mods = hw->ident_sta_fw.variant & (BIT14 | BIT15);
hw->ident_sta_fw.variant &= ~((u16)(BIT14 | BIT15));
hw->mm_mods = hw->ident_sta_fw.variant & (BIT(14) | BIT(15));
hw->ident_sta_fw.variant &= ~((u16)(BIT(14) | BIT(15)));
if ( hw->ident_sta_fw.id == 0x1f ) {
WLAN_LOG_INFO(
......
......@@ -48,43 +48,6 @@
#ifndef _WLAN_COMPAT_H
#define _WLAN_COMPAT_H
/*=============================================================*/
/*------ Bit settings -----------------------------------------*/
/*=============================================================*/
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
#define BIT3 0x00000008
#define BIT4 0x00000010
#define BIT5 0x00000020
#define BIT6 0x00000040
#define BIT7 0x00000080
#define BIT8 0x00000100
#define BIT9 0x00000200
#define BIT10 0x00000400
#define BIT11 0x00000800
#define BIT12 0x00001000
#define BIT13 0x00002000
#define BIT14 0x00004000
#define BIT15 0x00008000
#define BIT16 0x00010000
#define BIT17 0x00020000
#define BIT18 0x00040000
#define BIT19 0x00080000
#define BIT20 0x00100000
#define BIT21 0x00200000
#define BIT22 0x00400000
#define BIT23 0x00800000
#define BIT24 0x01000000
#define BIT25 0x02000000
#define BIT26 0x04000000
#define BIT27 0x08000000
#define BIT28 0x10000000
#define BIT29 0x20000000
#define BIT30 0x40000000
#define BIT31 0x80000000
/*=============================================================*/
/*------ OS Portability Macros --------------------------------*/
/*=============================================================*/
......@@ -165,4 +128,3 @@ extern int wlan_debug;
#endif
#endif /* _WLAN_COMPAT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment