From patchwork Sat May 12 08:17:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8560 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A36A323EB5 for ; Sat, 12 May 2012 08:17:48 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 73620A186B1 for ; Sat, 12 May 2012 08:17:48 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so4190337yen.11 for ; Sat, 12 May 2012 01:17:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=vfP4bNRuSjKcMRNcAh44dtxmX8G/pe8BZX8JnsJw8L4=; b=g8/Umu15FLyFPNDvES0uKF+k/7rIdqTU4aIeX9dXZXtQr7mqt0xFZNvtwE3wV+5/9+ moBQB3vQ8GLhvtZhLaQiv3PXkgej+GdMk6tAaii6PWtfvKUCNO69I/Ub+qbgrh76R41v rg7fcbpG3q3nGxUdKO9VROKRAPBQCsa5ZEoyx6hgBhT3JbT1E6Fqw8zZKr2mGjFdqNqM YckU/K2wSbaFgz3ozO9t4yCX2PHDvUcYpPru+Mgg5vAg4q70v1I36IA/huBAma7Wpfj6 UMzvpE5YeDJMVfm0OxNlZBPyMrpYqC8k5J7kVLO3vIuAs3CgRQgrehGsFw3lojNKeDbP N4pg== Received: by 10.50.47.131 with SMTP id d3mr500322ign.33.1336810668081; Sat, 12 May 2012 01:17:48 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.73.147 with SMTP id q19csp226568ibj; Sat, 12 May 2012 01:17:47 -0700 (PDT) Received: by 10.112.29.129 with SMTP id k1mr439897lbh.36.1336810666638; Sat, 12 May 2012 01:17:46 -0700 (PDT) Received: from mail.df.lth.se (mail.df.lth.se. [194.47.250.12]) by mx.google.com with ESMTPS id ef10si5594739lbb.24.2012.05.12.01.17.46 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 May 2012 01:17:46 -0700 (PDT) Received-SPF: neutral (google.com: 194.47.250.12 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=194.47.250.12; Authentication-Results: mx.google.com; spf=neutral (google.com: 194.47.250.12 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) smtp.mail=linus.walleij@linaro.org Received: from fecusia (c83-249-216-219.bredband.comhem.se [83.249.216.219]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.df.lth.se (Postfix) with ESMTPSA id 69E4E65D87; Sat, 12 May 2012 10:17:44 +0200 (CEST) Received: by fecusia (sSMTP sendmail emulation); Sat, 12 May 2012 10:17:44 +0200 From: "Linus Walleij" To: netdev@vger.kernel.org, linux-usb@vger.kernel.org, "David S. Miller" , Greg Kroah-Hartman , Felipe Balbi Cc: Jussi Kivilinna , Haiyang Zhang , Wei Yongjun , Ben Hutchings , Linus Walleij Subject: [PATCH 15/17 v5] rndis_wlan: cleanup: byteswap data from device instead of RNDIS_* defines Date: Sat, 12 May 2012 10:17:42 +0200 Message-Id: <1336810662-6147-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.7.7.6 X-Gm-Message-State: ALoCoQk3VUfQGGY4UkA9vUNvVHp/qYfg9KBpFmISS2EML22CwGDUFlfiVvtP0CfRMfLOKFfKEedZ From: Jussi Kivilinna All other values from device provided buffer are byteswapped, so it seems more logical to do same for these. Signed-off-by: Jussi Kivilinna Signed-off-by: Linus Walleij --- drivers/net/wireless/rndis_wlan.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 9bbef3f..c7f22cd 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c @@ -623,8 +623,8 @@ static int rndis_akm_suite_to_key_mgmt(u32 akm_suite) #ifdef DEBUG static const char *oid_to_string(__le32 oid) { - switch (oid) { -#define OID_STR(oid) case cpu_to_le32(oid): return(#oid) + switch (le32_to_cpu(oid)) { +#define OID_STR(oid) case oid: return(#oid) /* from rndis_host.h */ OID_STR(RNDIS_OID_802_3_PERMANENT_ADDRESS); OID_STR(RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE); @@ -687,19 +687,19 @@ static const char *oid_to_string(__le32 oid) static int rndis_error_status(__le32 rndis_status) { int ret = -EINVAL; - switch (rndis_status) { - case cpu_to_le32(RNDIS_STATUS_SUCCESS): + switch (le32_to_cpu(rndis_status)) { + case RNDIS_STATUS_SUCCESS: ret = 0; break; - case cpu_to_le32(RNDIS_STATUS_FAILURE): - case cpu_to_le32(RNDIS_STATUS_INVALID_DATA): + case RNDIS_STATUS_FAILURE: + case RNDIS_STATUS_INVALID_DATA: ret = -EINVAL; break; - case cpu_to_le32(RNDIS_STATUS_NOT_SUPPORTED): + case RNDIS_STATUS_NOT_SUPPORTED: ret = -EOPNOTSUPP; break; - case cpu_to_le32(RNDIS_STATUS_ADAPTER_NOT_READY): - case cpu_to_le32(RNDIS_STATUS_ADAPTER_NOT_OPEN): + case RNDIS_STATUS_ADAPTER_NOT_READY: + case RNDIS_STATUS_ADAPTER_NOT_OPEN: ret = -EBUSY; break; } @@ -3075,8 +3075,8 @@ static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); struct rndis_indicate *msg = ind; - switch (msg->status) { - case cpu_to_le32(RNDIS_STATUS_MEDIA_CONNECT): + switch (le32_to_cpu(msg->status)) { + case RNDIS_STATUS_MEDIA_CONNECT: if (priv->current_command_oid == cpu_to_le32(RNDIS_OID_802_11_ADD_KEY)) { /* OID_802_11_ADD_KEY causes sometimes extra * "media connect" indications which confuses driver @@ -3096,7 +3096,7 @@ static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) queue_work(priv->workqueue, &priv->work); break; - case cpu_to_le32(RNDIS_STATUS_MEDIA_DISCONNECT): + case RNDIS_STATUS_MEDIA_DISCONNECT: netdev_info(usbdev->net, "media disconnect\n"); /* queue work to avoid recursive calls into rndis_command */ @@ -3104,7 +3104,7 @@ static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) queue_work(priv->workqueue, &priv->work); break; - case cpu_to_le32(RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION): + case RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION: rndis_wlan_media_specific_indication(usbdev, msg, buflen); break;