public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH 36/49] Staging: at76_usb: fix up all remaining checkpatch.pl warnings
Date: Wed, 29 Oct 2008 15:40:03 -0700	[thread overview]
Message-ID: <1225320016-21803-36-git-send-email-greg@kroah.com> (raw)
In-Reply-To: <20081029223832.GC21657@kroah.com>

From: Greg Kroah-Hartman <gregkh@suse.de>

It's now a "clean" driver.

Cc: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/at76_usb/at76_usb.c |  176 +++++++++++++++++++----------------
 1 files changed, 94 insertions(+), 82 deletions(-)

diff --git a/drivers/staging/at76_usb/at76_usb.c b/drivers/staging/at76_usb/at76_usb.c
index b8a056d..5591b17 100644
--- a/drivers/staging/at76_usb/at76_usb.c
+++ b/drivers/staging/at76_usb/at76_usb.c
@@ -91,18 +91,18 @@
 
 /* Use our own dbg macro */
 #define at76_dbg(bits, format, arg...) \
-	do { \
-		if (at76_debug & (bits)) \
+do {	\
+	if (at76_debug & (bits))	\
 		printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \
-	} while (0)
+} while (0)
 
 #define at76_dbg_dump(bits, buf, len, format, arg...)	\
-	do { \
-		if (at76_debug & (bits)) { \
+do {	\
+	if (at76_debug & (bits)) {	\
 		printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \
-		print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len); \
+		print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);	\
 		}							\
-	} while (0)
+} while (0)
 
 static int at76_debug = DBG_DEFAULTS;
 
@@ -300,22 +300,30 @@ struct dfu_status {
 
 static inline int at76_is_intersil(enum board_type board)
 {
-	return (board == BOARD_503_ISL3861 || board == BOARD_503_ISL3863);
+	if (board == BOARD_503_ISL3861 || board == BOARD_503_ISL3863)
+		return 1;
+	return 0;
 }
 
 static inline int at76_is_503rfmd(enum board_type board)
 {
-	return (board == BOARD_503 || board == BOARD_503_ACC);
+	if (board == BOARD_503 || board == BOARD_503_ACC)
+		return 1;
+	return 0;
 }
 
 static inline int at76_is_505(enum board_type board)
 {
-	return (board == BOARD_505 || BOARD_505_2958);
+	if (board == BOARD_505 || board == BOARD_505_2958)
+		return 1;
+	return 0;
 }
 
 static inline int at76_is_505a(enum board_type board)
 {
-	return (board == BOARD_505A || board == BOARD_505AMX);
+	if (board == BOARD_505A || board == BOARD_505AMX)
+		return 1;
+	return 0;
 }
 
 /* Load a block of the first (internal) part of the firmware */
@@ -1054,20 +1062,23 @@ static void at76_dump_mib_mac_encryption(struct at76_priv *priv)
 	int i;
 	int ret;
 	/*int key_len;*/
-	struct mib_mac_encryption *m = kmalloc(sizeof(struct mib_mac_encryption), GFP_KERNEL);
+	struct mib_mac_encryption *m;
 
+	m = kmalloc(sizeof(struct mib_mac_encryption), GFP_KERNEL);
 	if (!m)
 		return;
 
 	ret = at76_get_mib(priv->udev, MIB_MAC_ENCRYPTION, m,
 			   sizeof(struct mib_mac_encryption));
 	if (ret < 0) {
-		printk(KERN_ERR "%s: at76_get_mib (MAC_ENCRYPTION) failed: %d\n",
-		       wiphy_name(priv->hw->wiphy), ret);
+		dev_err(&priv->udev->dev,
+			"%s: at76_get_mib (MAC_ENCRYPTION) failed: %d\n",
+			wiphy_name(priv->hw->wiphy), ret);
 		goto exit;
 	}
 
-	at76_dbg(DBG_MIB, "%s: MIB MAC_ENCRYPTION: tkip_bssid %s priv_invoked %u "
+	at76_dbg(DBG_MIB,
+		 "%s: MIB MAC_ENCRYPTION: tkip_bssid %s priv_invoked %u "
 		 "ciph_key_id %u grp_key_id %u excl_unencr %u "
 		 "ckip_key_perm %u wep_icv_err %u wep_excluded %u",
 		 wiphy_name(priv->hw->wiphy), mac2str(m->tkip_bssid),
@@ -1083,7 +1094,8 @@ static void at76_dump_mib_mac_encryption(struct at76_priv *priv)
 	for (i = 0; i < CIPHER_KEYS; i++)
 		at76_dbg(DBG_MIB, "%s: MIB MAC_ENCRYPTION: key %d: %s",
 			 wiphy_name(priv->hw->wiphy), i,
-			 hex2str(m->cipher_default_keyvalue[i], CIPHER_KEY_LEN));
+			 hex2str(m->cipher_default_keyvalue[i],
+				 CIPHER_KEY_LEN));
 exit:
 	kfree(m);
 }
@@ -1622,10 +1634,12 @@ static void at76_rx_tasklet(unsigned long param)
 
 	skb_trim(priv->rx_skb, le16_to_cpu(buf->wlength) + AT76_RX_HDRLEN);
 	at76_dbg_dump(DBG_RX_DATA, &priv->rx_skb->data[AT76_RX_HDRLEN],
-		      priv->rx_skb->len, "RX: len=%d", (int)(priv->rx_skb->len - AT76_RX_HDRLEN));
+		      priv->rx_skb->len, "RX: len=%d",
+		      (int)(priv->rx_skb->len - AT76_RX_HDRLEN));
 
 	rx_status.signal = buf->rssi;
-	rx_status.rate_idx = buf->rx_rate;	/* FIXME: is rate_idx still present in structure? */
+	/* FIXME: is rate_idx still present in structure? */
+	rx_status.rate_idx = buf->rx_rate;
 	rx_status.flag |= RX_FLAG_DECRYPTED;
 	rx_status.flag |= RX_FLAG_IV_STRIPPED;
 
@@ -1726,7 +1740,9 @@ static void at76_mac80211_tx_callback(struct urb *urb)
 	switch (urb->status) {
 	case 0:
 		/* success */
-		info->flags |= IEEE80211_TX_STAT_ACK;	/* FIXME: is the frame really ACKed when tx_callback is called ? */
+		/* FIXME:
+		 * is the frame really ACKed when tx_callback is called ? */
+		info->flags |= IEEE80211_TX_STAT_ACK;
 		break;
 	case -ENOENT:
 	case -ECONNRESET:
@@ -1780,8 +1796,10 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 	tx_buffer->tx_rate = ieee80211_get_tx_rate(hw, info)->hw_value;
 	if (FIRMWARE_IS_WPA(priv->fw_version) && info->control.hw_key) {
 		tx_buffer->key_id = (info->control.hw_key->keyidx);
-		tx_buffer->cipher_type = priv->keys[info->control.hw_key->keyidx].cipher;
-		tx_buffer->cipher_length = priv->keys[info->control.hw_key->keyidx].keylen;
+		tx_buffer->cipher_type =
+			priv->keys[info->control.hw_key->keyidx].cipher;
+		tx_buffer->cipher_length =
+			priv->keys[info->control.hw_key->keyidx].keylen;
 		tx_buffer->reserved = 0;
 	} else {
 		tx_buffer->key_id = 0;
@@ -2184,41 +2202,40 @@ static int at76_set_key_newfw(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		memcpy(priv->mib_buf.data.data, key->key, key->keylen);
 
 		switch (key->alg) {
-			case ALG_WEP:
-				if (key->keylen == 5) {
-					priv->keys[key->keyidx].cipher =
-						CIPHER_WEP64;
-					priv->keys[key->keyidx].keylen = 8;
-				} else if (key->keylen == 13) {
-					priv->keys[key->keyidx].cipher =
-						CIPHER_WEP128;
-					/* Firmware needs this */
-					priv->keys[key->keyidx].keylen = 8;
-				} else {
-					ret = -EOPNOTSUPP;
-					goto exit;
-				};
-				break;
-			case ALG_TKIP:
-				key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-				priv->keys[key->keyidx].cipher = CIPHER_TKIP;
-				priv->keys[key->keyidx].keylen = 12;
-				break;
-
-			case ALG_CCMP:
-				if (!at76_is_505a(priv->board_type)) {
-					ret = -EOPNOTSUPP;
-					goto exit;
-				};
-				key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-				priv->keys[key->keyidx].cipher = CIPHER_CCMP;
-				priv->keys[key->keyidx].keylen = 16;
-				break;
+		case ALG_WEP:
+			if (key->keylen == 5) {
+				priv->keys[key->keyidx].cipher =
+					CIPHER_WEP64;
+				priv->keys[key->keyidx].keylen = 8;
+			} else if (key->keylen == 13) {
+				priv->keys[key->keyidx].cipher =
+					CIPHER_WEP128;
+				/* Firmware needs this */
+				priv->keys[key->keyidx].keylen = 8;
+			} else {
+				ret = -EOPNOTSUPP;
+				goto exit;
+			};
+			break;
+		case ALG_TKIP:
+			key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+			priv->keys[key->keyidx].cipher = CIPHER_TKIP;
+			priv->keys[key->keyidx].keylen = 12;
+			break;
 
-			default:
+		case ALG_CCMP:
+			if (!at76_is_505a(priv->board_type)) {
 				ret = -EOPNOTSUPP;
 				goto exit;
+			};
+			key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+			priv->keys[key->keyidx].cipher = CIPHER_CCMP;
+			priv->keys[key->keyidx].keylen = 16;
+			break;
 
+		default:
+			ret = -EOPNOTSUPP;
+			goto exit;
 		};
 
 		priv->mib_buf.data.data[38] = priv->keys[key->keyidx].cipher;
@@ -2261,8 +2278,8 @@ static int at76_set_key_newfw(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		priv->mib_buf.data.data[1] = priv->default_pairwise_key;
 		priv->mib_buf.data.data[2] = priv->default_group_key;
 
-		if ((ret = at76_set_mib(priv, &priv->mib_buf)) !=
-				CMD_STATUS_COMPLETE)
+		ret = at76_set_mib(priv, &priv->mib_buf);
+		if (ret != CMD_STATUS_COMPLETE)
 			goto exit;
 
 		/* second block of settings */
@@ -2273,8 +2290,8 @@ static int at76_set_key_newfw(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		priv->mib_buf.data.data[1] = 0;	/* wep_encryption_type */
 		priv->mib_buf.data.data[2] = 0;	/* ckip_key_permutation */
 
-		if ((ret = at76_set_mib(priv, &priv->mib_buf)) !=
-				CMD_STATUS_COMPLETE)
+		ret = at76_set_mib(priv, &priv->mib_buf);
+		if (ret != CMD_STATUS_COMPLETE)
 			goto exit;
 		ret = 0;
 	};
@@ -2290,8 +2307,6 @@ static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 {
 	struct at76_priv *priv = hw->priv;
 
-	// int i;
-
 	at76_dbg(DBG_MAC80211, "%s(): cmd %d key->alg %d key->keyidx %d "
 		 "key->keylen %d",
 		 __func__, cmd, key->alg, key->keyidx, key->keylen);
@@ -2445,6 +2460,7 @@ static struct ieee80211_supported_band at76_supported_band = {
 static int at76_init_new_device(struct at76_priv *priv,
 				struct usb_interface *interface)
 {
+	struct device *dev = &interface->dev;
 	int ret;
 
 	/* set up the endpoint information */
@@ -2460,8 +2476,7 @@ static int at76_init_new_device(struct at76_priv *priv,
 	/* MAC address */
 	ret = at76_get_hw_config(priv);
 	if (ret < 0) {
-		dev_printk(KERN_ERR, &interface->dev,
-			   "cannot get MAC address\n");
+		dev_err(dev, "cannot get MAC address\n");
 		goto exit;
 	}
 
@@ -2500,22 +2515,21 @@ static int at76_init_new_device(struct at76_priv *priv,
 
 	ret = ieee80211_register_hw(priv->hw);
 	if (ret) {
-		printk(KERN_ERR "cannot register mac80211 hw (status %d)!\n",
-		       ret);
+		dev_err(dev, "cannot register mac80211 hw (status %d)!\n", ret);
 		goto exit;
 	}
 
 	priv->mac80211_registered = 1;
 
-	printk(KERN_INFO "%s: USB %s, MAC %s, firmware %d.%d.%d-%d\n",
-	       wiphy_name(priv->hw->wiphy),
-	       interface->dev.bus_id, mac2str(priv->mac_addr),
-	       priv->fw_version.major, priv->fw_version.minor,
-	       priv->fw_version.patch, priv->fw_version.build);
-	printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n",
-	       wiphy_name(priv->hw->wiphy),
-	       priv->regulatory_domain, priv->domain->name);
-	printk(KERN_INFO "%s: WPA support: ", wiphy_name(priv->hw->wiphy));
+	dev_info(dev, "%s: USB %s, MAC %s, firmware %d.%d.%d-%d\n",
+		 wiphy_name(priv->hw->wiphy),
+		 interface->dev.bus_id, mac2str(priv->mac_addr),
+		 priv->fw_version.major, priv->fw_version.minor,
+		 priv->fw_version.patch, priv->fw_version.build);
+	dev_info(dev, "%s: regulatory domain 0x%02x: %s\n",
+		 wiphy_name(priv->hw->wiphy),
+		 priv->regulatory_domain, priv->domain->name);
+	dev_info(dev, "%s: WPA support: ", wiphy_name(priv->hw->wiphy));
 	if (!FIRMWARE_IS_WPA(priv->fw_version))
 		printk("none\n");
 	else {
@@ -2596,8 +2610,8 @@ static int at76_probe(struct usb_interface *interface,
 	   we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */
 
 	if (op_mode == OPMODE_HW_CONFIG_MODE) {
-		dev_printk(KERN_ERR, &interface->dev,
-			   "cannot handle a device in HW_CONFIG_MODE\n");
+		dev_err(&interface->dev,
+			"cannot handle a device in HW_CONFIG_MODE\n");
 		ret = -EBUSY;
 		goto error;
 	}
@@ -2605,13 +2619,12 @@ static int at76_probe(struct usb_interface *interface,
 	if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH
 	    && op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
 		/* download internal firmware part */
-		dev_printk(KERN_DEBUG, &interface->dev,
-			   "downloading internal firmware\n");
+		dev_dbg(&interface->dev, "downloading internal firmware\n");
 		ret = at76_load_internal_fw(udev, fwe);
 		if (ret < 0) {
-			dev_printk(KERN_ERR, &interface->dev,
-				   "error %d downloading internal firmware\n",
-				   ret);
+			dev_err(&interface->dev,
+				"error %d downloading internal firmware\n",
+				ret);
 			goto error;
 		}
 		usb_put_dev(udev);
@@ -2636,8 +2649,7 @@ static int at76_probe(struct usb_interface *interface,
 		need_ext_fw = 1;
 
 	if (need_ext_fw) {
-		dev_printk(KERN_DEBUG, &interface->dev,
-			   "downloading external firmware\n");
+		dev_dbg(&interface->dev, "downloading external firmware\n");
 
 		ret = at76_load_external_fw(udev, fwe);
 		if (ret)
@@ -2646,8 +2658,8 @@ static int at76_probe(struct usb_interface *interface,
 		/* Re-check firmware version */
 		ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv));
 		if (ret < 0) {
-			dev_printk(KERN_ERR, &interface->dev,
-				   "error %d getting firmware version\n", ret);
+			dev_err(&interface->dev,
+				"error %d getting firmware version\n", ret);
 			goto error;
 		}
 	}
-- 
1.6.0.2


  parent reply	other threads:[~2008-10-29 22:57 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 22:38 [GIT PATCH] STAGING patches for 2.6-git Greg KH
2008-10-29 22:39 ` [PATCH 01/49] staging: correct dubious use of !x & y Greg KH
2008-10-29 22:39 ` [PATCH 02/49] Staging: make usbip depend on CONFIG_NET Greg KH
2008-10-29 22:39 ` [PATCH 03/49] Staging: w35und: make wb35_probe() and wb35_disconnect() funtions static Greg KH
2008-10-29 22:39 ` [PATCH 04/49] Staging: w35und: remove unused wb35_open() and wb35_close() functions Greg KH
2008-10-29 22:39 ` [PATCH 05/49] Staging: w35und: use msleep() and udelay() Greg KH
2008-10-29 22:39 ` [PATCH 06/49] Staging: w35und: remove the no-op pa_stall_execution macro Greg KH
2008-10-29 22:39 ` [PATCH 07/49] Staging: w35und: purb typedef removal Greg KH
2008-10-29 22:39 ` [PATCH 08/49] Staging: w35und: reg queue struct " Greg KH
2008-10-29 22:39 ` [PATCH 09/49] Staging: w35und: wb35reg " Greg KH
2008-10-29 22:39 ` [PATCH 10/49] Staging: w35und: padapter " Greg KH
2008-10-29 22:39 ` [PATCH 11/49] Staging: w35und: merge wblinux struct to adapter Greg KH
2008-10-29 22:39 ` [PATCH 12/49] Staging: w35und: wb35_probe() cleanup Greg KH
2008-10-29 22:39 ` [PATCH 13/49] Staging: w35und: remove usb_submit_urb wrapper function Greg KH
2008-10-29 23:09   ` Pavel Machek
2008-10-29 22:39 ` [PATCH 14/49] Staging: w35und: remove usb_alloc_urb " Greg KH
2008-10-29 23:10   ` Pavel Machek
2008-10-29 22:39 ` [PATCH 15/49] w35und: remove dead code from wbusb_f.h Greg KH
2008-10-29 22:39 ` [PATCH 16/49] Staging: w35und: remove true/false boolean macros Greg KH
2008-10-29 22:39 ` [PATCH 17/49] Staging: w35und: OS_MEMORY_ALLOC wrapper removal Greg KH
2008-10-29 22:39 ` [PATCH 18/49] Staging: w35und: usb_put_dev() is missing from wb35_disconnect() Greg KH
2008-10-29 22:39 ` [PATCH 19/49] Staging: w35und: remove macro magic from MLME_GetNextPacket() Greg KH
2008-10-29 22:39 ` [PATCH 20/49] Staging: w35und: plug memory leak in wbsoft_tx() Greg KH
2008-10-29 22:39 ` [PATCH 21/49] Staging: w35und: move supported band initialization out of wb35_probe() Greg KH
2008-10-29 22:39 ` [PATCH 22/49] Staging: wlan-ng: Remove PCI/PLX/PCMCIA files Greg KH
2008-10-29 22:39 ` [PATCH 23/49] Staging: wlan-ng: Update Help text to mention prism3 devices Greg KH
2008-10-29 22:39 ` [PATCH 24/49] Staging: wlan-ng: Delete PCI/PLX/PCMCIA-specific code Greg KH
2008-10-29 22:39 ` [PATCH 25/49] Staging: wlan-ng: Make wlan-ng use WEXT mode by default Greg KH
2008-10-29 22:39 ` [PATCH 26/49] Staging: wlan-ng: Eliminate more <2.6 kernel support Greg KH
2008-10-29 22:39 ` [PATCH 27/49] Staging: wlan-ng: Eliminate all backwards-compatibility for <2.6.13 kernels Greg KH
2008-10-29 22:39 ` [PATCH 28/49] Staging: wlan-ng: Eliminate a boatload of tertiaryAP-only code Greg KH
2008-10-29 22:39 ` [PATCH 29/49] Staging: wlan-ng: Remove AP-only code from MLME functions Greg KH
2008-10-29 22:39 ` [PATCH 30/49] Staging: wlan-ng: Get rid of the MTU tests in the rx conversion path Greg KH
2008-10-29 22:39 ` [PATCH 31/49] Staging: wlan-ng: Eliminate one more rx mtu test Greg KH
2008-10-29 22:39 ` [PATCH 32/49] Staging: wlan-ng: Eliminate local 'version.h' Greg KH
2008-10-29 22:40 ` [PATCH 33/49] Staging: wlan-ng: Eliminate usage of procfs Greg KH
2008-10-29 22:40 ` [PATCH 34/49] Staging: at76_usb: update drivers/staging/at76_usb w/ mac80211 port Greg KH
2008-10-29 22:40 ` [PATCH 35/49] Staging: at76_usb: remove compiler warnings Greg KH
2008-10-29 22:40 ` Greg KH [this message]
2008-10-29 22:40 ` [PATCH 37/49] Staging: poch: Block size bug fix Greg KH
2008-10-29 22:40 ` [PATCH 38/49] Staging: poch: Update TODO list Greg KH
2008-10-29 22:40 ` [PATCH 39/49] Staging: poch: Correct pages from bytes Greg KH
2008-10-29 22:40 ` [PATCH 40/49] Staging: poch: minor fixes Greg KH
2008-10-29 22:40 ` [PATCH 41/49] Staging: poch: Fix build warnings Greg KH
2008-10-29 22:40 ` [PATCH 42/49] Staging: poch: Rx control register init Greg KH
2008-10-29 22:40 ` [PATCH 43/49] Staging: poch: Fix user space protocol syncing Greg KH
2008-10-29 22:40 ` [PATCH 44/49] Staging: poch: Fine grained locking Greg KH
2008-10-29 22:40 ` [PATCH 45/49] Staging: sxg: remove typedefs Greg KH
2008-10-29 22:40 ` [PATCH 46/49] Staging: sxg: break the build in a cleaner way when !x86 Greg KH
2008-10-29 22:40 ` [PATCH 47/49] Staging: add agnx wireless driver Greg KH

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=1225320016-21803-36-git-send-email-greg@kroah.com \
    --to=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox