Search Linux Wireless

Re: [PATCH 20/20] staging: brcm80211: reduced checkpatch warnings to zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2011-09-19 at 17:04 -0700, Joe Perches wrote:
> It'd be better if you could find some way
> to reduce the 6 tab indentation rather than
> split 20 char format strings into pieces.

Perhaps something like this:

 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |  112 ++++++++++-----------
 1 files changed, 54 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index a15765b..ccba1ce 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -240,6 +240,53 @@ brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint func,
 	return 0;
 }
 
+static void
+brcmf_sdioh_request_byte_func0(struct brcmf_sdio_dev *sdiodev, uint rw,
+			       uint func, uint regaddr, u8 *byte, int *err_ret)
+{
+	/* Can only directly write to some F0 registers.
+	 * Handle F2 enable as a special case.
+	 */
+	if (regaddr == SDIO_CCCR_IOEx) {
+		if (sdiodev->func[2]) {
+			sdio_claim_host(sdiodev->func[2]);
+			if (*byte & SDIO_FUNC_ENABLE_2) {
+				/* Enable Function 2 */
+				*err_ret = sdio_enable_func(sdiodev->func[2]);
+				if (*err_ret)
+					brcmf_dbg(ERROR,
+						  "enable F2 failed:%d\n",
+						  *err_ret);
+			} else {
+				/* Disable Function 2 */
+				*err_ret = sdio_disable_func(sdiodev->func[2]);
+				if (*err_ret)
+					brcmf_dbg(ERROR,
+						  "Disable F2 failed:%d\n",
+						  *err_ret);
+			}
+			sdio_release_host(sdiodev->func[2]);
+		}
+	} else if (regaddr == SDIO_CCCR_ABORT) {
+		/* to allow abort command through F1 */
+		sdio_claim_host(sdiodev->func[func]);
+		/*
+		 * this sdio_f0_writeb() can be replaced with another api
+		 * depending upon MMC driver change.
+		 * As of this time, this is temporary one
+		 */
+		sdio_writeb(sdiodev->func[func], *byte, regaddr, err_ret);
+		sdio_release_host(sdiodev->func[func]);
+	} else if (regaddr < 0xF0) {
+		brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr);
+	} else {
+		/* Claim host controller, perform F0 write, and release */
+		sdio_claim_host(sdiodev->func[func]);
+		sdio_f0_writeb(sdiodev->func[func], *byte, regaddr, err_ret);
+		sdio_release_host(sdiodev->func[func]);
+	}
+}
+
 extern int
 brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
 			 uint regaddr, u8 *byte)
@@ -252,58 +299,9 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
 	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, sdiodev);
 	if (rw) {		/* CMD52 Write */
 		if (func == 0) {
-			/* Can only directly write to some F0 registers.
-			 * Handle F2 enable
-			 * as a special case.
-			 */
-			if (regaddr == SDIO_CCCR_IOEx) {
-				if (sdiodev->func[2]) {
-					sdio_claim_host(sdiodev->func[2]);
-					if (*byte & SDIO_FUNC_ENABLE_2) {
-						/* Enable Function 2 */
-						err_ret =
-						    sdio_enable_func
-						    (sdiodev->func[2]);
-						if (err_ret)
-							brcmf_dbg(ERROR,
-								  "enable F2 failed:%d\n",
-								  err_ret);
-					} else {
-						/* Disable Function 2 */
-						err_ret =
-						    sdio_disable_func
-						    (sdiodev->func[2]);
-						if (err_ret)
-							brcmf_dbg(ERROR,
-								  "Disable F2 failed:%d\n",
-								  err_ret);
-					}
-					sdio_release_host(sdiodev->func[2]);
-				}
-			}
-			/* to allow abort command through F1 */
-			else if (regaddr == SDIO_CCCR_ABORT) {
-				sdio_claim_host(sdiodev->func[func]);
-				/*
-				 * this sdio_f0_writeb() can be replaced
-				 * with another api
-				 * depending upon MMC driver change.
-				 * As of this time, this is temporaray one
-				 */
-				sdio_writeb(sdiodev->func[func], *byte,
-					    regaddr, &err_ret);
-				sdio_release_host(sdiodev->func[func]);
-			} else if (regaddr < 0xF0) {
-				brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n",
-					  regaddr);
-			} else {
-				/* Claim host controller, perform F0 write,
-				 and release */
-				sdio_claim_host(sdiodev->func[func]);
-				sdio_f0_writeb(sdiodev->func[func], *byte,
-					       regaddr, &err_ret);
-				sdio_release_host(sdiodev->func[func]);
-			}
+			brcmf_sdioh_request_byte_func0(sdiodev, rw, func,
+						       regaddr, byte,
+						       &err_ret);
 		} else {
 			/* Claim host controller, perform Fn write,
 			 and release */
@@ -317,13 +315,11 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
 		sdio_claim_host(sdiodev->func[func]);
 
 		if (func == 0) {
-			*byte =
-			    sdio_f0_readb(sdiodev->func[func], regaddr,
-					  &err_ret);
+			*byte = sdio_f0_readb(sdiodev->func[func], regaddr,
+					      &err_ret);
 		} else {
-			*byte =
-			    sdio_readb(sdiodev->func[func], regaddr,
-				       &err_ret);
+			*byte = sdio_readb(sdiodev->func[func], regaddr,
+					   &err_ret);
 		}
 
 		sdio_release_host(sdiodev->func[func]);


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux