[PATCH 10/10] Staging: rts5139: rts51x_scsi: fix coding style issues

Dan Carpenter dan.carpenter at oracle.com
Tue May 29 12:32:20 UTC 2012


On Tue, May 29, 2012 at 01:02:54PM +0100, Adnan Ali wrote:
> This commit fixes coding style issue including
> deprecated min().
> 

If this is patch 10/10, where are the other patches?  The subject
should say something about min_t() or min() or something.  You're
sending these things as fast as you write them and you're doing it
in a sloppy way.  Please slow down.

I said this already.

> Signed-off-by: Adnan Ali <adnan.ali at codethink.co.uk>
> ---
> @@ -1027,7 +1027,7 @@ static int read_mem(struct scsi_cmnd *srb, struct rts51x_chip *chip)
>  		}
>  	}
>  
> -	len = (unsigned short)min(scsi_bufflen(srb), (unsigned int)len);
> +	len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len);
              ^^^^^^^^^^^^^^^^
This cast isn't needed.  If len weren't already a short, I would
worry why it is truncating the significant bits away.

>  	rts51x_set_xfer_buf(buf, len, srb);
>  	scsi_set_resid(srb, scsi_bufflen(srb) - len);
>  
> @@ -1054,7 +1054,7 @@ static int write_mem(struct scsi_cmnd *srb, struct rts51x_chip *chip)
>  		return TRANSPORT_GOOD;
>  	}
>  
> -	len = (unsigned short)min(scsi_bufflen(srb), (unsigned int)len);
> +	len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len);
              ^^^^^^^^^^^^^^^^
Not needed.

>  	buf = vmalloc(len);
>  	if (!buf)
>  		TRACE_RET(chip, TRANSPORT_ERROR);

regards,
dan carpenter




More information about the devel mailing list