Skip to content

Commit

Permalink
rndis: remove private wrapper of __constant_cpu_to_le32
Browse files Browse the repository at this point in the history
Use cpu_to_le32 directly as it handles constant folding now, replace direct
uses of __constant_cpu_to_{endian} as well.

Signed-off-by: Harvey Harrison <[email protected]>
Acked-by: David Brownell <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
hharrison authored and davem330 committed Feb 15, 2009
1 parent ab46d77 commit 35c26c2
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 149 deletions.
25 changes: 11 additions & 14 deletions drivers/net/usb/rndis_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
struct rndis_keepalive_c *msg = (void *)buf;

msg->msg_type = RNDIS_MSG_KEEPALIVE_C;
msg->msg_len = ccpu2(sizeof *msg);
msg->msg_len = cpu_to_le32(sizeof *msg);
msg->status = RNDIS_STATUS_SUCCESS;
retval = usb_control_msg(dev->udev,
usb_sndctrlpipe(dev->udev, 0),
Expand Down Expand Up @@ -237,7 +237,7 @@ static int rndis_query(struct usbnet *dev, struct usb_interface *intf,
u.get->msg_len = cpu_to_le32(sizeof *u.get + in_len);
u.get->oid = oid;
u.get->len = cpu_to_le32(in_len);
u.get->offset = ccpu2(20);
u.get->offset = cpu_to_le32(20);

retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
if (unlikely(retval < 0)) {
Expand Down Expand Up @@ -297,9 +297,9 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
goto fail;

u.init->msg_type = RNDIS_MSG_INIT;
u.init->msg_len = ccpu2(sizeof *u.init);
u.init->major_version = ccpu2(1);
u.init->minor_version = ccpu2(0);
u.init->msg_len = cpu_to_le32(sizeof *u.init);
u.init->major_version = cpu_to_le32(1);
u.init->minor_version = cpu_to_le32(0);

/* max transfer (in spec) is 0x4000 at full speed, but for
* TX we'll stick to one Ethernet packet plus RNDIS framing.
Expand Down Expand Up @@ -403,10 +403,10 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
/* set a nonzero filter to enable data transfers */
memset(u.set, 0, sizeof *u.set);
u.set->msg_type = RNDIS_MSG_SET;
u.set->msg_len = ccpu2(4 + sizeof *u.set);
u.set->msg_len = cpu_to_le32(4 + sizeof *u.set);
u.set->oid = OID_GEN_CURRENT_PACKET_FILTER;
u.set->len = ccpu2(4);
u.set->offset = ccpu2((sizeof *u.set) - 8);
u.set->len = cpu_to_le32(4);
u.set->offset = cpu_to_le32((sizeof *u.set) - 8);
*(__le32 *)(u.buf + sizeof *u.set) = RNDIS_DEFAULT_FILTER;

retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
Expand All @@ -423,7 +423,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
halt_fail_and_release:
memset(u.halt, 0, sizeof *u.halt);
u.halt->msg_type = RNDIS_MSG_HALT;
u.halt->msg_len = ccpu2(sizeof *u.halt);
u.halt->msg_len = cpu_to_le32(sizeof *u.halt);
(void) rndis_command(dev, (void *)u.halt, CONTROL_BUFFER_SIZE);
fail_and_release:
usb_set_intfdata(info->data, NULL);
Expand All @@ -448,7 +448,7 @@ void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
halt = kzalloc(CONTROL_BUFFER_SIZE, GFP_KERNEL);
if (halt) {
halt->msg_type = RNDIS_MSG_HALT;
halt->msg_len = ccpu2(sizeof *halt);
halt->msg_len = cpu_to_le32(sizeof *halt);
(void) rndis_command(dev, (void *)halt, CONTROL_BUFFER_SIZE);
kfree(halt);
}
Expand Down Expand Up @@ -543,7 +543,7 @@ rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
memset(hdr, 0, sizeof *hdr);
hdr->msg_type = RNDIS_MSG_PACKET;
hdr->msg_len = cpu_to_le32(skb->len);
hdr->data_offset = ccpu2(sizeof(*hdr) - 8);
hdr->data_offset = cpu_to_le32(sizeof(*hdr) - 8);
hdr->data_len = cpu_to_le32(len);

/* FIXME make the last packet always be short ... */
Expand All @@ -562,9 +562,6 @@ static const struct driver_info rndis_info = {
.tx_fixup = rndis_tx_fixup,
};

#undef ccpu2


/*-------------------------------------------------------------------------*/

static const struct usb_device_id products [] = {
Expand Down
90 changes: 45 additions & 45 deletions drivers/net/wireless/rndis_wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,44 +90,44 @@ MODULE_PARM_DESC(workaround_interval,


/* various RNDIS OID defs */
#define OID_GEN_LINK_SPEED ccpu2(0x00010107)
#define OID_GEN_RNDIS_CONFIG_PARAMETER ccpu2(0x0001021b)

#define OID_GEN_XMIT_OK ccpu2(0x00020101)
#define OID_GEN_RCV_OK ccpu2(0x00020102)
#define OID_GEN_XMIT_ERROR ccpu2(0x00020103)
#define OID_GEN_RCV_ERROR ccpu2(0x00020104)
#define OID_GEN_RCV_NO_BUFFER ccpu2(0x00020105)

#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101)
#define OID_802_3_CURRENT_ADDRESS ccpu2(0x01010102)
#define OID_802_3_MULTICAST_LIST ccpu2(0x01010103)
#define OID_802_3_MAXIMUM_LIST_SIZE ccpu2(0x01010104)

#define OID_802_11_BSSID ccpu2(0x0d010101)
#define OID_802_11_SSID ccpu2(0x0d010102)
#define OID_802_11_INFRASTRUCTURE_MODE ccpu2(0x0d010108)
#define OID_802_11_ADD_WEP ccpu2(0x0d010113)
#define OID_802_11_REMOVE_WEP ccpu2(0x0d010114)
#define OID_802_11_DISASSOCIATE ccpu2(0x0d010115)
#define OID_802_11_AUTHENTICATION_MODE ccpu2(0x0d010118)
#define OID_802_11_PRIVACY_FILTER ccpu2(0x0d010119)
#define OID_802_11_BSSID_LIST_SCAN ccpu2(0x0d01011a)
#define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b)
#define OID_802_11_ADD_KEY ccpu2(0x0d01011d)
#define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e)
#define OID_802_11_ASSOCIATION_INFORMATION ccpu2(0x0d01011f)
#define OID_802_11_PMKID ccpu2(0x0d010123)
#define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203)
#define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204)
#define OID_802_11_TX_POWER_LEVEL ccpu2(0x0d010205)
#define OID_802_11_RSSI ccpu2(0x0d010206)
#define OID_802_11_RSSI_TRIGGER ccpu2(0x0d010207)
#define OID_802_11_FRAGMENTATION_THRESHOLD ccpu2(0x0d010209)
#define OID_802_11_RTS_THRESHOLD ccpu2(0x0d01020a)
#define OID_802_11_SUPPORTED_RATES ccpu2(0x0d01020e)
#define OID_802_11_CONFIGURATION ccpu2(0x0d010211)
#define OID_802_11_BSSID_LIST ccpu2(0x0d010217)
#define OID_GEN_LINK_SPEED cpu_to_le32(0x00010107)
#define OID_GEN_RNDIS_CONFIG_PARAMETER cpu_to_le32(0x0001021b)

#define OID_GEN_XMIT_OK cpu_to_le32(0x00020101)
#define OID_GEN_RCV_OK cpu_to_le32(0x00020102)
#define OID_GEN_XMIT_ERROR cpu_to_le32(0x00020103)
#define OID_GEN_RCV_ERROR cpu_to_le32(0x00020104)
#define OID_GEN_RCV_NO_BUFFER cpu_to_le32(0x00020105)

#define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101)
#define OID_802_3_CURRENT_ADDRESS cpu_to_le32(0x01010102)
#define OID_802_3_MULTICAST_LIST cpu_to_le32(0x01010103)
#define OID_802_3_MAXIMUM_LIST_SIZE cpu_to_le32(0x01010104)

#define OID_802_11_BSSID cpu_to_le32(0x0d010101)
#define OID_802_11_SSID cpu_to_le32(0x0d010102)
#define OID_802_11_INFRASTRUCTURE_MODE cpu_to_le32(0x0d010108)
#define OID_802_11_ADD_WEP cpu_to_le32(0x0d010113)
#define OID_802_11_REMOVE_WEP cpu_to_le32(0x0d010114)
#define OID_802_11_DISASSOCIATE cpu_to_le32(0x0d010115)
#define OID_802_11_AUTHENTICATION_MODE cpu_to_le32(0x0d010118)
#define OID_802_11_PRIVACY_FILTER cpu_to_le32(0x0d010119)
#define OID_802_11_BSSID_LIST_SCAN cpu_to_le32(0x0d01011a)
#define OID_802_11_ENCRYPTION_STATUS cpu_to_le32(0x0d01011b)
#define OID_802_11_ADD_KEY cpu_to_le32(0x0d01011d)
#define OID_802_11_REMOVE_KEY cpu_to_le32(0x0d01011e)
#define OID_802_11_ASSOCIATION_INFORMATION cpu_to_le32(0x0d01011f)
#define OID_802_11_PMKID cpu_to_le32(0x0d010123)
#define OID_802_11_NETWORK_TYPES_SUPPORTED cpu_to_le32(0x0d010203)
#define OID_802_11_NETWORK_TYPE_IN_USE cpu_to_le32(0x0d010204)
#define OID_802_11_TX_POWER_LEVEL cpu_to_le32(0x0d010205)
#define OID_802_11_RSSI cpu_to_le32(0x0d010206)
#define OID_802_11_RSSI_TRIGGER cpu_to_le32(0x0d010207)
#define OID_802_11_FRAGMENTATION_THRESHOLD cpu_to_le32(0x0d010209)
#define OID_802_11_RTS_THRESHOLD cpu_to_le32(0x0d01020a)
#define OID_802_11_SUPPORTED_RATES cpu_to_le32(0x0d01020e)
#define OID_802_11_CONFIGURATION cpu_to_le32(0x0d010211)
#define OID_802_11_BSSID_LIST cpu_to_le32(0x0d010217)


/* Typical noise/maximum signal level values taken from ndiswrapper iw_ndis.h */
Expand All @@ -144,8 +144,8 @@ MODULE_PARM_DESC(workaround_interval,


/* codes for "status" field of completion messages */
#define RNDIS_STATUS_ADAPTER_NOT_READY ccpu2(0xc0010011)
#define RNDIS_STATUS_ADAPTER_NOT_OPEN ccpu2(0xc0010012)
#define RNDIS_STATUS_ADAPTER_NOT_READY cpu_to_le32(0xc0010011)
#define RNDIS_STATUS_ADAPTER_NOT_OPEN cpu_to_le32(0xc0010012)


/* NDIS data structures. Taken from wpa_supplicant driver_ndis.c
Expand Down Expand Up @@ -442,7 +442,7 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len)

memset(u.get, 0, sizeof *u.get);
u.get->msg_type = RNDIS_MSG_QUERY;
u.get->msg_len = ccpu2(sizeof *u.get);
u.get->msg_len = cpu_to_le32(sizeof *u.get);
u.get->oid = oid;

ret = rndis_command(dev, u.header, buflen);
Expand Down Expand Up @@ -491,8 +491,8 @@ static int rndis_set_oid(struct usbnet *dev, __le32 oid, void *data, int len)
u.set->msg_len = cpu_to_le32(sizeof(*u.set) + len);
u.set->oid = oid;
u.set->len = cpu_to_le32(len);
u.set->offset = ccpu2(sizeof(*u.set) - 8);
u.set->handle = ccpu2(0);
u.set->offset = cpu_to_le32(sizeof(*u.set) - 8);
u.set->handle = cpu_to_le32(0);
memcpy(u.buf + sizeof(*u.set), data, len);

ret = rndis_command(dev, u.header, buflen);
Expand Down Expand Up @@ -1630,7 +1630,7 @@ static int rndis_iw_set_scan(struct net_device *dev,
devdbg(usbdev, "SIOCSIWSCAN");

if (wrqu->data.flags == 0) {
tmp = ccpu2(1);
tmp = cpu_to_le32(1);
ret = rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp,
sizeof(tmp));
evt.data.flags = 0;
Expand Down Expand Up @@ -2428,7 +2428,7 @@ static void rndis_update_wireless_stats(struct work_struct *work)
/* Send scan OID. Use of both OIDs is required to get device
* working.
*/
tmp = ccpu2(1);
tmp = cpu_to_le32(1);
rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp,
sizeof(tmp));

Expand Down
Loading

0 comments on commit 35c26c2

Please sign in to comment.