Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1329814 > unrolled thread

[PATCH v2 0/9] Staging: rts5208: Coding style and dma mapping fixes

Started byShaun Ren <shaun.ren@linux.com>
First post2016-02-09 02:40 +0100
Last post2016-02-15 20:10 +0100
Articles 20 on this page of 47 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 0/9] Staging: rts5208: Coding style and dma mapping fixes Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
    [PATCH v2 2/9] Staging: rts5208: rtsx_transport.c: Align to open parenthesis Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
      Re: [PATCH v2 2/9] Staging: rts5208: rtsx_transport.c: Align to open  parenthesis Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-10 06:30 +0100
    [PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
      Re: [PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove  unnecessary parentheses Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-10 06:30 +0100
        Re: [PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses Shaun Ren <shaun.ren@linux.com> - 2016-02-10 19:40 +0100
    [PATCH v2 3/9] Staging: rts5208: rtsx_transport.c: Remove spaces after casts Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
    [PATCH v2 5/9] Staging: rts5208: rtsx_transport.c: Remove extra newlines Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
    [PATCH v2 9/9] Staging: rts5208: Add missing dma_mapping_error Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
    [PATCH v2 6/9] Staging: rts5208: rtsx_transport.c: Fix label naming convention Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
    [PATCH v2 1/9] Staging: rts5208: rtsx_transport.c: Fix comment style warnings Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
      Re: [PATCH v2 1/9] Staging: rts5208: rtsx_transport.c: Fix comment style warnings Joshua Clayton <stillcompiling@gmail.com> - 2016-02-09 04:10 +0100
    [PATCH v2 8/9] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
    [PATCH v2 4/9] Staging: rts5208: rtsx_transport.c: Add spaces around - Shaun Ren <shaun.ren@linux.com> - 2016-02-09 02:40 +0100
    [PATCH v3 3/9] Staging: rts5208: rtsx_transport.c: Remove spaces after casts Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
    [PATCH v3 6/9] Staging: rts5208: rtsx_transport.c: Fix label naming convention Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
    [PATCH v3 0/9] Staging: rts5208: Coding style and dma mapping fixes Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
      [PATCH v3 8/9] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
      [PATCH v3 5/9] Staging: rts5208: rtsx_transport.c: Remove extra newlines Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
      [PATCH v3 2/9] Staging: rts5208: rtsx_transport.c: Align to open parenthesis Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
        Re: [PATCH v3 2/9] Staging: rts5208: rtsx_transport.c: Align to  open parenthesis Joe Perches <joe@perches.com> - 2016-02-10 04:00 +0100
      [PATCH v3 1/9] Staging: rts5208: rtsx_transport.c: Cleanup comments Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
        Re: [PATCH v3 1/9] Staging: rts5208: rtsx_transport.c: Cleanup comments Joshua Clayton <stillcompiling@gmail.com> - 2016-02-10 04:30 +0100
      [PATCH v3 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
      [PATCH v3 4/9] Staging: rts5208: rtsx_transport.c: Add spaces around - Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
      [PATCH v3 9/9] Staging: rts5208: Add missing dma_mapping_error Shaun Ren <shaun.ren@linux.com> - 2016-02-10 03:50 +0100
      [PATCH v4 7/8] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
      [PATCH v4 4/8] Staging: rts5208: rtsx_transport.c: Add spaces around - Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
      [PATCH v4 6/8] Staging: rts5208: rtsx_transport.c: Fix label naming convention Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
      [PATCH v4 0/8] Staging: rts5208: Fix coding style Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
        [PATCH v4 1/8] Staging: rts5208: rtsx_transport.c: Cleanup comments Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
        [PATCH v4 8/8] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
        [PATCH v4 2/8] Staging: rts5208: rtsx_transport.c: Align to open parenthesis Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
          Re: [PATCH v4 2/8] Staging: rts5208: rtsx_transport.c: Align to  open parenthesis Joe Perches <joe@perches.com> - 2016-02-12 05:40 +0100
            [PATCH v5 2/8] Staging: rts5208: rtsx_transport.c: Align to open parenthesis Shaun Ren <shaun.ren@linux.com> - 2016-02-12 08:00 +0100
              Re: [PATCH v5 2/8] Staging: rts5208: rtsx_transport.c: Align to open  parenthesis Greg KH <gregkh@linuxfoundation.org> - 2016-02-15 01:50 +0100
        [PATCH v4 3/8] Staging: rts5208: rtsx_transport.c: Remove spaces after casts Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
        [PATCH v4 5/8] Staging: rts5208: rtsx_transport.c: Remove extra newlines Shaun Ren <shaun.ren@linux.com> - 2016-02-12 05:20 +0100
        [PATCH v5 RESEND 3/8] Staging: rts5208: rtsx_transport.c: Remove spaces after casts Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:00 +0100
        [PATCH v5 RESEND 7/8] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:00 +0100
        [PATCH v5 RESEND 6/8] Staging: rts5208: rtsx_transport.c: Fix label naming convention Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:00 +0100
        [PATCH v5 RESEND 8/8] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:00 +0100
        [PATCH v5 RESEND 0/8] Staging: rts5208: Fix coding style Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:00 +0100
          [PATCH v5 RESEND 1/8] Staging: rts5208: rtsx_transport.c: Cleanup comments Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:00 +0100
          [PATCH v5 RESEND 4/8] Staging: rts5208: rtsx_transport.c: Add spaces around - Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:10 +0100
          [PATCH v5 RESEND 5/8] Staging: rts5208: rtsx_transport.c: Remove extra newlines Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:10 +0100
          [PATCH v5 RESEND 2/8] Staging: rts5208: rtsx_transport.c: Align to open parenthesis Shaun Ren <shaun.ren@linux.com> - 2016-02-15 20:10 +0100

Page 1 of 3  [1] 2 3  Next page →


#1329814 — [PATCH v2 0/9] Staging: rts5208: Coding style and dma mapping fixes

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 0/9] Staging: rts5208: Coding style and dma mapping fixes
Message-ID<r05rA-5cr-5@gated-at.bofh.it>
This set of patches fixes the coding style issues in rtsx_transport.c, and
dds a missing call dma_mapping_error() after dma_map_single().

[toc] | [next] | [standalone]


#1329815 — [PATCH v2 2/9] Staging: rts5208: rtsx_transport.c: Align to open parenthesis

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 2/9] Staging: rts5208: rtsx_transport.c: Align to open parenthesis
Message-ID<r05rA-5cr-7@gated-at.bofh.it>
In reply to#1329814
This patch fixes the alignment issue reported by checkpatch.pl:

CHECK: Alignment should match open parenthesis

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 61 ++++++++++++++++++--------------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 3e3f6fb..67162f6 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -40,8 +40,11 @@
  */
 
 unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
-	unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index,
-	unsigned int *offset, enum xfer_buf_dir dir)
+				       unsigned int buflen,
+				       struct scsi_cmnd *srb,
+				       unsigned int *index,
+				       unsigned int *offset,
+				     enum xfer_buf_dir dir)
 {
 	unsigned int cnt;
 
@@ -54,10 +57,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 		cnt = min(buflen, scsi_bufflen(srb) - *offset);
 		if (dir == TO_XFER_BUF)
 			memcpy((unsigned char *) scsi_sglist(srb) + *offset,
-					buffer, cnt);
+			       buffer, cnt);
 		else
 			memcpy(buffer, (unsigned char *) scsi_sglist(srb) +
-					*offset, cnt);
+			       *offset, cnt);
 		*offset += cnt;
 
 	/* Using scatter-gather.  We have to go through the list one entry
@@ -131,7 +134,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
  * SCSI residue.
  */
 void rtsx_stor_set_xfer_buf(unsigned char *buffer,
-	unsigned int buflen, struct scsi_cmnd *srb)
+			    unsigned int buflen, struct scsi_cmnd *srb)
 {
 	unsigned int index = 0, offset = 0;
 
@@ -142,7 +145,7 @@ void rtsx_stor_set_xfer_buf(unsigned char *buffer,
 }
 
 void rtsx_stor_get_xfer_buf(unsigned char *buffer,
-	unsigned int buflen, struct scsi_cmnd *srb)
+			    unsigned int buflen, struct scsi_cmnd *srb)
 {
 	unsigned int index = 0, offset = 0;
 
@@ -194,8 +197,8 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 		/* set the result so the higher layers expect this data */
 		srb->result = SAM_STAT_CHECK_CONDITION;
 		memcpy(srb->sense_buffer,
-			(unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]),
-			sizeof(struct sense_data_t));
+		       (unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]),
+		       sizeof(struct sense_data_t));
 	}
 
 	return;
@@ -209,7 +212,7 @@ Handle_Errors:
 }
 
 void rtsx_add_cmd(struct rtsx_chip *chip,
-		u8 cmd_type, u16 reg_addr, u8 mask, u8 data)
+		  u8 cmd_type, u16 reg_addr, u8 mask, u8 data)
 {
 	u32 *cb = (u32 *)(chip->host_cmds_ptr);
 	u32 val = 0;
@@ -328,9 +331,11 @@ static inline void rtsx_add_sg_tbl(
 }
 
 static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
-		struct scatterlist *sg, int num_sg, unsigned int *index,
-		unsigned int *offset, int size,
-		enum dma_data_direction dma_dir, int timeout)
+					     struct scatterlist *sg, int num_sg,
+					     unsigned int *index,
+					     unsigned int *offset, int size,
+					     enum dma_data_direction dma_dir,
+					     int timeout)
 {
 	struct rtsx_dev *rtsx = chip->rtsx;
 	struct completion trans_done;
@@ -492,8 +497,9 @@ out:
 }
 
 static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
-		struct scatterlist *sg, int num_sg,
-		enum dma_data_direction dma_dir, int timeout)
+				     struct scatterlist *sg, int num_sg,
+				     enum dma_data_direction dma_dir,
+				     int timeout)
 {
 	struct rtsx_dev *rtsx = chip->rtsx;
 	struct completion trans_done;
@@ -639,7 +645,8 @@ out:
 }
 
 static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
-		size_t len, enum dma_data_direction dma_dir, int timeout)
+			     size_t len, enum dma_data_direction dma_dir,
+			     int timeout)
 {
 	struct rtsx_dev *rtsx = chip->rtsx;
 	struct completion trans_done;
@@ -722,9 +729,9 @@ out:
 }
 
 int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card,
-		void *buf, size_t len, int use_sg, unsigned int *index,
-		unsigned int *offset, enum dma_data_direction dma_dir,
-		int timeout)
+			       void *buf, size_t len, int use_sg,
+			       unsigned int *index, unsigned int *offset,
+			       enum dma_data_direction dma_dir, int timeout)
 {
 	int err = 0;
 
@@ -732,11 +739,13 @@ int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card,
 	if (rtsx_chk_stat(chip, RTSX_STAT_ABORT))
 		return -EIO;
 
-	if (use_sg)
-		err = rtsx_transfer_sglist_adma_partial(chip, card,
-				(struct scatterlist *)buf, use_sg,
-				index, offset, (int)len, dma_dir, timeout);
-	else
+	if (use_sg) {
+		struct scatterlist *sg = (struct scatterlist *)buf;
+
+		err = rtsx_transfer_sglist_adma_partial(chip, card, sg, use_sg,
+							index, offset, (int)len,
+							dma_dir, timeout);
+	} else
 		err = rtsx_transfer_buf(chip, card,
 					buf, len, dma_dir, timeout);
 	if (err < 0) {
@@ -751,7 +760,7 @@ int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card,
 }
 
 int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,
-		int use_sg, enum dma_data_direction dma_dir, int timeout)
+		       int use_sg, enum dma_data_direction dma_dir, int timeout)
 {
 	int err = 0;
 
@@ -763,8 +772,8 @@ int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,
 
 	if (use_sg) {
 		err = rtsx_transfer_sglist_adma(chip, card,
-				(struct scatterlist *)buf,
-				use_sg, dma_dir, timeout);
+						(struct scatterlist *)buf,
+						use_sg, dma_dir, timeout);
 	} else {
 		err = rtsx_transfer_buf(chip, card, buf, len, dma_dir, timeout);
 	}
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1330903 — Re: [PATCH v2 2/9] Staging: rts5208: rtsx_transport.c: Align to open parenthesis

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2016-02-10 06:30 +0100
SubjectRe: [PATCH v2 2/9] Staging: rts5208: rtsx_transport.c: Align to open parenthesis
Message-ID<r0vvI-6mr-13@gated-at.bofh.it>
In reply to#1329815
On Mon, Feb 08, 2016 at 05:31:18PM -0800, Shaun Ren wrote:
> This patch fixes the alignment issue reported by checkpatch.pl:
> 
> CHECK: Alignment should match open parenthesis
> 
> Signed-off-by: Shaun Ren <shaun.ren@linux.com>
> ---
>  drivers/staging/rts5208/rtsx_transport.c | 61 ++++++++++++++++++--------------
>  1 file changed, 35 insertions(+), 26 deletions(-)
> 
<snip>
>  
> @@ -732,11 +739,13 @@ int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card,
>  	if (rtsx_chk_stat(chip, RTSX_STAT_ABORT))
>  		return -EIO;
>  
> -	if (use_sg)
> -		err = rtsx_transfer_sglist_adma_partial(chip, card,
> -				(struct scatterlist *)buf, use_sg,
> -				index, offset, (int)len, dma_dir, timeout);
> -	else
> +	if (use_sg) {
> +		struct scatterlist *sg = (struct scatterlist *)buf;

this change is not documented in commit message.	
> +
> +		err = rtsx_transfer_sglist_adma_partial(chip, card, sg, use_sg,
> +							index, offset, (int)len,
> +							dma_dir, timeout);
> +	} else

This will introduce new checkpatch warning. If you are giving braces in
the if block then you need to have braces in the else part also.

regards
sudip

[toc] | [prev] | [next] | [standalone]


#1329817 — [PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses
Message-ID<r05rB-5cr-13@gated-at.bofh.it>
In reply to#1329814
This patch removes all unnecessary parentheses found by checkpatch.pl.

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index ca209c6..fa062f6 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -194,7 +194,7 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 		/* set the result so the higher layers expect this data */
 		srb->result = SAM_STAT_CHECK_CONDITION;
 		memcpy(srb->sense_buffer,
-		       (unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]),
+		       (unsigned char *)&chip->sense_buffer[SCSI_LUN(srb)],
 		       sizeof(struct sense_data_t));
 	}
 
@@ -372,7 +372,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
 
 	spin_unlock_irq(&rtsx->reg_lock);
 
-	sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir);
+	sg_cnt = dma_map_sg(&rtsx->pci->dev, sg, num_sg, dma_dir);
 
 	resid = size;
 	sg_ptr = sg;
@@ -485,7 +485,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
 out:
 	rtsx->done = NULL;
 	rtsx->trans_state = STATE_TRANS_NONE;
-	dma_unmap_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir);
+	dma_unmap_sg(&rtsx->pci->dev, sg, num_sg, dma_dir);
 
 	if (err < 0)
 		rtsx_stop_cmd(chip, card);
@@ -535,7 +535,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
 
 	spin_unlock_irq(&rtsx->reg_lock);
 
-	buf_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir);
+	buf_cnt = dma_map_sg(&rtsx->pci->dev, sg, num_sg, dma_dir);
 
 	sg_ptr = sg;
 
@@ -633,7 +633,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
 out:
 	rtsx->done = NULL;
 	rtsx->trans_state = STATE_TRANS_NONE;
-	dma_unmap_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir);
+	dma_unmap_sg(&rtsx->pci->dev, sg, num_sg, dma_dir);
 
 	if (err < 0)
 		rtsx_stop_cmd(chip, card);
@@ -663,7 +663,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
 	else
 		return -ENXIO;
 
-	addr = dma_map_single(&(rtsx->pci->dev), buf, len, dma_dir);
+	addr = dma_map_single(&rtsx->pci->dev, buf, len, dma_dir);
 	if (!addr)
 		return -ENOMEM;
 
@@ -717,7 +717,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
 out:
 	rtsx->done = NULL;
 	rtsx->trans_state = STATE_TRANS_NONE;
-	dma_unmap_single(&(rtsx->pci->dev), addr, len, dma_dir);
+	dma_unmap_single(&rtsx->pci->dev, addr, len, dma_dir);
 
 	if (err < 0)
 		rtsx_stop_cmd(chip, card);
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1330902 — Re: [PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2016-02-10 06:30 +0100
SubjectRe: [PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses
Message-ID<r0vvI-6mr-11@gated-at.bofh.it>
In reply to#1329817
On Mon, Feb 08, 2016 at 05:31:23PM -0800, Shaun Ren wrote:
> This patch removes all unnecessary parentheses found by checkpatch.pl.
> 
> Signed-off-by: Shaun Ren <shaun.ren@linux.com>

This will not apply anymore because of some other changes done by:
9a66d05d82db ("Staging: rts5208: fix check for dma mapping error")

regards
sudip

[toc] | [prev] | [next] | [standalone]


#1331429 — Re: [PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-10 19:40 +0100
SubjectRe: [PATCH v2 7/9] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses
Message-ID<r0HQe-5YR-19@gated-at.bofh.it>
In reply to#1330902
On Tue 2016-02-09 at 21:26 (-0800), Sudip Mukherjee wrote:
> On Mon, Feb 08, 2016 at 05:31:23PM -0800, Shaun Ren wrote:
>> This patch removes all unnecessary parentheses found by checkpatch.pl.
>> 
>> Signed-off-by: Shaun Ren <shaun.ren@linux.com>
>
> This will not apply anymore because of some other changes done by:
> 9a66d05d82db ("Staging: rts5208: fix check for dma mapping error")

I don't see that commit anywhere. Is it in linux-next?

Regards,
--
Shaun Ren

[toc] | [prev] | [next] | [standalone]


#1329818 — [PATCH v2 3/9] Staging: rts5208: rtsx_transport.c: Remove spaces after casts

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 3/9] Staging: rts5208: rtsx_transport.c: Remove spaces after casts
Message-ID<r05rB-5cr-15@gated-at.bofh.it>
In reply to#1329814
This patch removes all spaces after casts in rtsx_transport.c, as reported
by checkpatch.pl:

CHECK: No space is necessary after a cast

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 67162f6..8a68f64 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -56,10 +56,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 			return 0;
 		cnt = min(buflen, scsi_bufflen(srb) - *offset);
 		if (dir == TO_XFER_BUF)
-			memcpy((unsigned char *) scsi_sglist(srb) + *offset,
+			memcpy((unsigned char *)scsi_sglist(srb) + *offset,
 			       buffer, cnt);
 		else
-			memcpy(buffer, (unsigned char *) scsi_sglist(srb) +
+			memcpy(buffer, (unsigned char *)scsi_sglist(srb) +
 			       *offset, cnt);
 		*offset += cnt;
 
@@ -73,7 +73,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 	 */
 	} else {
 		struct scatterlist *sg =
-				(struct scatterlist *) scsi_sglist(srb)
+				(struct scatterlist *)scsi_sglist(srb)
 				+ *index;
 
 		/* This loop handles a single s-g list entry, which may
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1329819 — [PATCH v2 5/9] Staging: rts5208: rtsx_transport.c: Remove extra newlines

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 5/9] Staging: rts5208: rtsx_transport.c: Remove extra newlines
Message-ID<r05rB-5cr-17@gated-at.bofh.it>
In reply to#1329814
This patch fixes the following issues in rtsx_transport.c as reported by
checkpatch.pl:

CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Please don't use multiple blank lines

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 901c64a..73302af 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -90,12 +90,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 			unsigned int sglen = sg->length - *offset;
 
 			if (sglen > buflen - cnt) {
-
 				/* Transfer ends within this s-g entry */
 				sglen = buflen - cnt;
 				*offset += sglen;
 			} else {
-
 				/* Transfer continues to next s-g entry */
 				*offset = 0;
 				++*index;
@@ -155,7 +153,6 @@ void rtsx_stor_get_xfer_buf(unsigned char *buffer,
 		scsi_set_resid(srb, scsi_bufflen(srb) - buflen);
 }
 
-
 /***********************************************************************
  * Transport routines
  ***********************************************************************/
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1329820 — [PATCH v2 9/9] Staging: rts5208: Add missing dma_mapping_error

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 9/9] Staging: rts5208: Add missing dma_mapping_error
Message-ID<r05rB-5cr-19@gated-at.bofh.it>
In reply to#1329814
This patch adds a dma_mapping_error call to debug potential DMA mapping
errors after the dma_map_single call in rtsx_transport.c.

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index c0fd8c5..00da7ab 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -664,7 +664,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
 		return -ENXIO;
 
 	addr = dma_map_single(&rtsx->pci->dev, buf, len, dma_dir);
-	if (!addr)
+	if (dma_mapping_error(&rtsx->pci->dev, addr))
 		return -ENOMEM;
 
 	if (card == SD_CARD)
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1329823 — [PATCH v2 6/9] Staging: rts5208: rtsx_transport.c: Fix label naming convention

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 6/9] Staging: rts5208: rtsx_transport.c: Fix label naming convention
Message-ID<r05rB-5cr-29@gated-at.bofh.it>
In reply to#1329814
This patch fixes the following naming convention issue in rtsx_transport.c,
as reported by checkpatch.pl:

CHECK: Avoid CamelCase: <Handle_Errors>

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 73302af..ca209c6 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -173,14 +173,14 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 	if (rtsx_chk_stat(chip, RTSX_STAT_ABORT)) {
 		dev_dbg(rtsx_dev(chip), "-- command was aborted\n");
 		srb->result = DID_ABORT << 16;
-		goto Handle_Errors;
+		goto handle_errors;
 	}
 
 	/* if there is a transport error, reset and don't auto-sense */
 	if (result == TRANSPORT_ERROR) {
 		dev_dbg(rtsx_dev(chip), "-- transport indicates error, resetting\n");
 		srb->result = DID_ERROR << 16;
-		goto Handle_Errors;
+		goto handle_errors;
 	}
 
 	srb->result = SAM_STAT_GOOD;
@@ -204,7 +204,7 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 	 * by issuing a port reset.  If that fails, try a class-specific
 	 * device reset.
 	 */
-Handle_Errors:
+handle_errors:
 	return;
 }
 
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1329824 — [PATCH v2 1/9] Staging: rts5208: rtsx_transport.c: Fix comment style warnings

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 1/9] Staging: rts5208: rtsx_transport.c: Fix comment style warnings
Message-ID<r05rB-5cr-27@gated-at.bofh.it>
In reply to#1329814
This patch fixes all comment style warnings in rtsx_transport.c reported by
checkpatch.pl:

WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index f27491e..3e3f6fb 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -36,7 +36,8 @@
  * For non-scatter-gather transfers, srb->request_buffer points to the
  * transfer buffer itself and srb->request_bufflen is the buffer's length.)
  * Update the *index and *offset variables so that the next copy will
- * pick up from where this one left off. */
+ * pick up from where this one left off.
+ */
 
 unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 	unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index,
@@ -45,7 +46,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 	unsigned int cnt;
 
 	/* If not using scatter-gather, just transfer the data directly.
-	 * Make certain it will fit in the available buffer space. */
+	 * Make certain it will fit in the available buffer space.
+	 */
 	if (scsi_sg_count(srb) == 0) {
 		if (*offset >= scsi_bufflen(srb))
 			return 0;
@@ -64,7 +66,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 	 * in kernel-addressable memory then kmap() will return its address.
 	 * If the page is not directly accessible -- such as a user buffer
 	 * located in high memory -- then kmap() will map it to a temporary
-	 * position in the kernel's virtual address space. */
+	 * position in the kernel's virtual address space.
+	 */
 	} else {
 		struct scatterlist *sg =
 				(struct scatterlist *) scsi_sglist(srb)
@@ -73,7 +76,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 		/* This loop handles a single s-g list entry, which may
 		 * include multiple pages.  Find the initial page structure
 		 * and the starting offset within the page, and update
-		 * the *offset and *index values for the next loop. */
+		 * the *offset and *index values for the next loop.
+		 */
 		cnt = 0;
 		while (cnt < buflen && *index < scsi_sg_count(srb)) {
 			struct page *page = sg_page(sg) +
@@ -97,7 +101,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 
 			/* Transfer the data for all the pages in this
 			 * s-g entry.  For each page: call kmap(), do the
-			 * transfer, and call kunmap() immediately after. */
+			 * transfer, and call kunmap() immediately after.
+			 */
 			while (sglen > 0) {
 				unsigned int plen = min(sglen, (unsigned int)
 						PAGE_SIZE - poff);
@@ -123,7 +128,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 }
 
 /* Store the contents of buffer into srb's transfer buffer and set the
-* SCSI residue. */
+ * SCSI residue.
+ */
 void rtsx_stor_set_xfer_buf(unsigned char *buffer,
 	unsigned int buflen, struct scsi_cmnd *srb)
 {
@@ -196,7 +202,8 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 
 	/* Error and abort processing: try to resynchronize with the device
 	 * by issuing a port reset.  If that fails, try a class-specific
-	 * device reset. */
+	 * device reset.
+	 */
 Handle_Errors:
 	return;
 }
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1329851 — Re: [PATCH v2 1/9] Staging: rts5208: rtsx_transport.c: Fix comment style warnings

FromJoshua Clayton <stillcompiling@gmail.com>
Date2016-02-09 04:10 +0100
SubjectRe: [PATCH v2 1/9] Staging: rts5208: rtsx_transport.c: Fix comment style warnings
Message-ID<r06QF-6k0-3@gated-at.bofh.it>
In reply to#1329824
Hello Shaun,
/*
 * Multiline comments (except in the net subsystem) should 
 * start with "/*" on a separate line. see Documentation/CodingStyle
 */
If you are going to fix the comments you should get both the beginning
and the end.
More comments inline. 

On Monday, February 08, 2016 05:31:17 PM Shaun Ren wrote:
> This patch fixes all comment style warnings in rtsx_transport.c reported by
> checkpatch.pl:
> 
> WARNING: Block comments use a trailing */ on a separate line
> 
> Signed-off-by: Shaun Ren <shaun.ren@linux.com>
> ---
>  drivers/staging/rts5208/rtsx_transport.c | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
> index f27491e..3e3f6fb 100644
> --- a/drivers/staging/rts5208/rtsx_transport.c
> +++ b/drivers/staging/rts5208/rtsx_transport.c
> @@ -36,7 +36,8 @@
>   * For non-scatter-gather transfers, srb->request_buffer points to the
>   * transfer buffer itself and srb->request_bufflen is the buffer's length.)
>   * Update the *index and *offset variables so that the next copy will
> - * pick up from where this one left off. */
> + * pick up from where this one left off.
> + */
> 
Fix the beginning too, as mentioned above.
 
>  unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
>  	unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index,
> @@ -45,7 +46,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
>  	unsigned int cnt;
>  
>  	/* If not using scatter-gather, just transfer the data directly.
> -	 * Make certain it will fit in the available buffer space. */
> +	 * Make certain it will fit in the available buffer space.
> +	 */

Either fix the beginning...  or better yet, get rid of the useless
(obvious) second line so it can be a single line comment.

>  	if (scsi_sg_count(srb) == 0) {
>  		if (*offset >= scsi_bufflen(srb))
>  			return 0;
> @@ -64,7 +66,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
>  	 * in kernel-addressable memory then kmap() will return its address.
>  	 * If the page is not directly accessible -- such as a user buffer
>  	 * located in high memory -- then kmap() will map it to a temporary
> -	 * position in the kernel's virtual address space. */
> +	 * position in the kernel's virtual address space.
> +	 */

Fix the beginning of this comment as well.
Also,  from "If the page is already in kernel -addressible memory..."
on is just  a description of what kmap() does.
I'd get rid of those lines. 

>  	} else {
>  		struct scatterlist *sg =
>  				(struct scatterlist *) scsi_sglist(srb)
> @@ -73,7 +76,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
>  		/* This loop handles a single s-g list entry, which may
>  		 * include multiple pages.  Find the initial page structure
>  		 * and the starting offset within the page, and update
> -		 * the *offset and *index values for the next loop. */
> +		 * the *offset and *index values for the next loop.
> +		 */

Fix the beginning of this comment.

>  		cnt = 0;
>  		while (cnt < buflen && *index < scsi_sg_count(srb)) {
>  			struct page *page = sg_page(sg) +
> @@ -97,7 +101,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
>  
>  			/* Transfer the data for all the pages in this
>  			 * s-g entry.  For each page: call kmap(), do the
> -			 * transfer, and call kunmap() immediately after. */
> +			 * transfer, and call kunmap() immediately after.
> +			 */

I'd get rid of this comment. It parrots what the code does, but does not
add any information.

>  			while (sglen > 0) {
>  				unsigned int plen = min(sglen, (unsigned int)
>  						PAGE_SIZE - poff);
> @@ -123,7 +128,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
>  }
>  
>  /* Store the contents of buffer into srb's transfer buffer and set the
> -* SCSI residue. */
> + * SCSI residue.
> + */

Fix the beginning as well.

>  void rtsx_stor_set_xfer_buf(unsigned char *buffer,
>  	unsigned int buflen, struct scsi_cmnd *srb)
>  {
> @@ -196,7 +202,8 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
>  
>  	/* Error and abort processing: try to resynchronize with the device
>  	 * by issuing a port reset.  If that fails, try a class-specific
> -	 * device reset. */
> +	 * device reset.
> +	 */

This comment  describes something that does not
happen in this function. Perhaps it did at one point. 
Regardless, It should be removed.

>  Handle_Errors:
>  	return;
>  }
> 

[toc] | [prev] | [next] | [standalone]


#1329826 — [PATCH v2 8/9] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 8/9] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL
Message-ID<r05rC-5cr-35@gated-at.bofh.it>
In reply to#1329814
This patch changes all comparsions to NULL with !..., as reported by
checkpatch.pl.

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index fa062f6..c0fd8c5 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -343,7 +343,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
 	struct scatterlist *sg_ptr;
 	u32 val = TRIG_DMA;
 
-	if ((sg == NULL) || (num_sg <= 0) || !offset || !index)
+	if (!sg || (num_sg <= 0) || !offset || !index)
 		return -EIO;
 
 	if (dma_dir == DMA_TO_DEVICE)
@@ -506,7 +506,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
 	long timeleft;
 	struct scatterlist *sg_ptr;
 
-	if ((sg == NULL) || (num_sg <= 0))
+	if (!sg || (num_sg <= 0))
 		return -EIO;
 
 	if (dma_dir == DMA_TO_DEVICE)
@@ -653,7 +653,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
 	u32 val = 1 << 31;
 	long timeleft;
 
-	if ((buf == NULL) || (len <= 0))
+	if (!buf || (len <= 0))
 		return -EIO;
 
 	if (dma_dir == DMA_TO_DEVICE)
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1329827 — [PATCH v2 4/9] Staging: rts5208: rtsx_transport.c: Add spaces around -

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-09 02:40 +0100
Subject[PATCH v2 4/9] Staging: rts5208: rtsx_transport.c: Add spaces around -
Message-ID<r05rC-5cr-33@gated-at.bofh.it>
In reply to#1329814
This patch fixes the following styling issue in rtsx_transport.c
as reported by checkpatch.pl:

CHECK: spaces preferred around that '-' (ctx:VxV)

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 8a68f64..901c64a 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -85,8 +85,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 		while (cnt < buflen && *index < scsi_sg_count(srb)) {
 			struct page *page = sg_page(sg) +
 					((sg->offset + *offset) >> PAGE_SHIFT);
-			unsigned int poff =
-					(sg->offset + *offset) & (PAGE_SIZE-1);
+			unsigned int poff = (sg->offset + *offset) &
+					    (PAGE_SIZE - 1);
 			unsigned int sglen = sg->length - *offset;
 
 			if (sglen > buflen - cnt) {
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1330856 — [PATCH v3 3/9] Staging: rts5208: rtsx_transport.c: Remove spaces after casts

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-10 03:50 +0100
Subject[PATCH v3 3/9] Staging: rts5208: rtsx_transport.c: Remove spaces after casts
Message-ID<r0t0R-4sE-1@gated-at.bofh.it>
In reply to#1329814
This patch removes all spaces after casts in rtsx_transport.c, as reported
by checkpatch.pl:

CHECK: No space is necessary after a cast

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 17bea8a..57b1f46 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -56,10 +56,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 			return 0;
 		cnt = min(buflen, scsi_bufflen(srb) - *offset);
 		if (dir == TO_XFER_BUF)
-			memcpy((unsigned char *) scsi_sglist(srb) + *offset,
+			memcpy((unsigned char *)scsi_sglist(srb) + *offset,
 			       buffer, cnt);
 		else
-			memcpy(buffer, (unsigned char *) scsi_sglist(srb) +
+			memcpy(buffer, (unsigned char *)scsi_sglist(srb) +
 			       *offset, cnt);
 		*offset += cnt;
 
@@ -70,7 +70,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 	 */
 	} else {
 		struct scatterlist *sg =
-				(struct scatterlist *) scsi_sglist(srb)
+				(struct scatterlist *)scsi_sglist(srb)
 				+ *index;
 
 		/*
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1330857 — [PATCH v3 6/9] Staging: rts5208: rtsx_transport.c: Fix label naming convention

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-10 03:50 +0100
Subject[PATCH v3 6/9] Staging: rts5208: rtsx_transport.c: Fix label naming convention
Message-ID<r0t0S-4sE-5@gated-at.bofh.it>
In reply to#1329814
This patch fixes the following naming convention issue in rtsx_transport.c,
as reported by checkpatch.pl:

CHECK: Avoid CamelCase: <Handle_Errors>

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
Changes since v2
 * Update patch to reflect the changes made in PATCH 1/9 (block comments)

 drivers/staging/rts5208/rtsx_transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 14321c0..ea00347 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -170,14 +170,14 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 	if (rtsx_chk_stat(chip, RTSX_STAT_ABORT)) {
 		dev_dbg(rtsx_dev(chip), "-- command was aborted\n");
 		srb->result = DID_ABORT << 16;
-		goto Handle_Errors;
+		goto handle_errors;
 	}
 
 	/* if there is a transport error, reset and don't auto-sense */
 	if (result == TRANSPORT_ERROR) {
 		dev_dbg(rtsx_dev(chip), "-- transport indicates error, resetting\n");
 		srb->result = DID_ERROR << 16;
-		goto Handle_Errors;
+		goto handle_errors;
 	}
 
 	srb->result = SAM_STAT_GOOD;
@@ -197,7 +197,7 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 
 	return;
 
-Handle_Errors:
+handle_errors:
 	return;
 }
 
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1330858 — [PATCH v3 0/9] Staging: rts5208: Coding style and dma mapping fixes

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-10 03:50 +0100
Subject[PATCH v3 0/9] Staging: rts5208: Coding style and dma mapping fixes
Message-ID<r0t0R-4sE-3@gated-at.bofh.it>
In reply to#1329814
This set of patches fixes the coding style issues in rtsx_transport.c, and
dds a missing call dma_mapping_error() after dma_map_single().

Changes since v2
 * Incorporated Joshua Clayton's suggestions regarding the block comments

[toc] | [prev] | [next] | [standalone]


#1330859 — [PATCH v3 8/9] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-10 03:50 +0100
Subject[PATCH v3 8/9] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL
Message-ID<r0t0S-4sE-7@gated-at.bofh.it>
In reply to#1330858
This patch changes all comparsions to NULL with !..., as reported by
checkpatch.pl.

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index c956072..46fc8c2 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -336,7 +336,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
 	struct scatterlist *sg_ptr;
 	u32 val = TRIG_DMA;
 
-	if ((sg == NULL) || (num_sg <= 0) || !offset || !index)
+	if (!sg || (num_sg <= 0) || !offset || !index)
 		return -EIO;
 
 	if (dma_dir == DMA_TO_DEVICE)
@@ -500,7 +500,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
 	long timeleft;
 	struct scatterlist *sg_ptr;
 
-	if ((sg == NULL) || (num_sg <= 0))
+	if (!sg || (num_sg <= 0))
 		return -EIO;
 
 	if (dma_dir == DMA_TO_DEVICE)
@@ -647,7 +647,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
 	u32 val = 1 << 31;
 	long timeleft;
 
-	if ((buf == NULL) || (len <= 0))
+	if (!buf || (len <= 0))
 		return -EIO;
 
 	if (dma_dir == DMA_TO_DEVICE)
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1330861 — [PATCH v3 5/9] Staging: rts5208: rtsx_transport.c: Remove extra newlines

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-10 03:50 +0100
Subject[PATCH v3 5/9] Staging: rts5208: rtsx_transport.c: Remove extra newlines
Message-ID<r0t0S-4sE-13@gated-at.bofh.it>
In reply to#1330858
This patch fixes the following issues in rtsx_transport.c as reported by
checkpatch.pl:

CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Please don't use multiple blank lines

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index b137aca..14321c0 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -88,12 +88,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 			unsigned int sglen = sg->length - *offset;
 
 			if (sglen > buflen - cnt) {
-
 				/* Transfer ends within this s-g entry */
 				sglen = buflen - cnt;
 				*offset += sglen;
 			} else {
-
 				/* Transfer continues to next s-g entry */
 				*offset = 0;
 				++*index;
@@ -150,7 +148,6 @@ void rtsx_stor_get_xfer_buf(unsigned char *buffer,
 		scsi_set_resid(srb, scsi_bufflen(srb) - buflen);
 }
 
-
 /***********************************************************************
  * Transport routines
  ***********************************************************************/
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1330862 — [PATCH v3 2/9] Staging: rts5208: rtsx_transport.c: Align to open parenthesis

FromShaun Ren <shaun.ren@linux.com>
Date2016-02-10 03:50 +0100
Subject[PATCH v3 2/9] Staging: rts5208: rtsx_transport.c: Align to open parenthesis
Message-ID<r0t0S-4sE-15@gated-at.bofh.it>
In reply to#1330858
This patch fixes the alignment issue reported by checkpatch.pl:

CHECK: Alignment should match open parenthesis

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
---
 drivers/staging/rts5208/rtsx_transport.c | 61 ++++++++++++++++++--------------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 5de8913..17bea8a 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -42,8 +42,11 @@
  */
 
 unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
-	unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index,
-	unsigned int *offset, enum xfer_buf_dir dir)
+				       unsigned int buflen,
+				       struct scsi_cmnd *srb,
+				       unsigned int *index,
+				       unsigned int *offset,
+				     enum xfer_buf_dir dir)
 {
 	unsigned int cnt;
 
@@ -54,10 +57,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 		cnt = min(buflen, scsi_bufflen(srb) - *offset);
 		if (dir == TO_XFER_BUF)
 			memcpy((unsigned char *) scsi_sglist(srb) + *offset,
-					buffer, cnt);
+			       buffer, cnt);
 		else
 			memcpy(buffer, (unsigned char *) scsi_sglist(srb) +
-					*offset, cnt);
+			       *offset, cnt);
 		*offset += cnt;
 
 	/*
@@ -126,7 +129,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
  * SCSI residue.
  */
 void rtsx_stor_set_xfer_buf(unsigned char *buffer,
-	unsigned int buflen, struct scsi_cmnd *srb)
+			    unsigned int buflen, struct scsi_cmnd *srb)
 {
 	unsigned int index = 0, offset = 0;
 
@@ -137,7 +140,7 @@ void rtsx_stor_set_xfer_buf(unsigned char *buffer,
 }
 
 void rtsx_stor_get_xfer_buf(unsigned char *buffer,
-	unsigned int buflen, struct scsi_cmnd *srb)
+			    unsigned int buflen, struct scsi_cmnd *srb)
 {
 	unsigned int index = 0, offset = 0;
 
@@ -191,8 +194,8 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 		/* set the result so the higher layers expect this data */
 		srb->result = SAM_STAT_CHECK_CONDITION;
 		memcpy(srb->sense_buffer,
-			(unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]),
-			sizeof(struct sense_data_t));
+		       (unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]),
+		       sizeof(struct sense_data_t));
 	}
 
 	return;
@@ -202,7 +205,7 @@ Handle_Errors:
 }
 
 void rtsx_add_cmd(struct rtsx_chip *chip,
-		u8 cmd_type, u16 reg_addr, u8 mask, u8 data)
+		  u8 cmd_type, u16 reg_addr, u8 mask, u8 data)
 {
 	u32 *cb = (u32 *)(chip->host_cmds_ptr);
 	u32 val = 0;
@@ -321,9 +324,11 @@ static inline void rtsx_add_sg_tbl(
 }
 
 static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
-		struct scatterlist *sg, int num_sg, unsigned int *index,
-		unsigned int *offset, int size,
-		enum dma_data_direction dma_dir, int timeout)
+					     struct scatterlist *sg, int num_sg,
+					     unsigned int *index,
+					     unsigned int *offset, int size,
+					     enum dma_data_direction dma_dir,
+					     int timeout)
 {
 	struct rtsx_dev *rtsx = chip->rtsx;
 	struct completion trans_done;
@@ -486,8 +491,9 @@ out:
 }
 
 static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
-		struct scatterlist *sg, int num_sg,
-		enum dma_data_direction dma_dir, int timeout)
+				     struct scatterlist *sg, int num_sg,
+				     enum dma_data_direction dma_dir,
+				     int timeout)
 {
 	struct rtsx_dev *rtsx = chip->rtsx;
 	struct completion trans_done;
@@ -633,7 +639,8 @@ out:
 }
 
 static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
-		size_t len, enum dma_data_direction dma_dir, int timeout)
+			     size_t len, enum dma_data_direction dma_dir,
+			     int timeout)
 {
 	struct rtsx_dev *rtsx = chip->rtsx;
 	struct completion trans_done;
@@ -716,9 +723,9 @@ out:
 }
 
 int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card,
-		void *buf, size_t len, int use_sg, unsigned int *index,
-		unsigned int *offset, enum dma_data_direction dma_dir,
-		int timeout)
+			       void *buf, size_t len, int use_sg,
+			       unsigned int *index, unsigned int *offset,
+			       enum dma_data_direction dma_dir, int timeout)
 {
 	int err = 0;
 
@@ -726,11 +733,13 @@ int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card,
 	if (rtsx_chk_stat(chip, RTSX_STAT_ABORT))
 		return -EIO;
 
-	if (use_sg)
-		err = rtsx_transfer_sglist_adma_partial(chip, card,
-				(struct scatterlist *)buf, use_sg,
-				index, offset, (int)len, dma_dir, timeout);
-	else
+	if (use_sg) {
+		struct scatterlist *sg = (struct scatterlist *)buf;
+
+		err = rtsx_transfer_sglist_adma_partial(chip, card, sg, use_sg,
+							index, offset, (int)len,
+							dma_dir, timeout);
+	} else
 		err = rtsx_transfer_buf(chip, card,
 					buf, len, dma_dir, timeout);
 	if (err < 0) {
@@ -745,7 +754,7 @@ int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card,
 }
 
 int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,
-		int use_sg, enum dma_data_direction dma_dir, int timeout)
+		       int use_sg, enum dma_data_direction dma_dir, int timeout)
 {
 	int err = 0;
 
@@ -757,8 +766,8 @@ int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,
 
 	if (use_sg) {
 		err = rtsx_transfer_sglist_adma(chip, card,
-				(struct scatterlist *)buf,
-				use_sg, dma_dir, timeout);
+						(struct scatterlist *)buf,
+						use_sg, dma_dir, timeout);
 	} else {
 		err = rtsx_transfer_buf(chip, card, buf, len, dma_dir, timeout);
 	}
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | linux.kernel


csiph-web