diff mbox

[10/22] staging: unisys: visorbus: Make use of the new sg_map helper function

Message ID 1492121135-4437-11-git-send-email-logang@deltatee.com (mailing list archive)
State New, archived
Headers show

Commit Message

Logan Gunthorpe April 13, 2017, 10:05 p.m. UTC
Straightforward conversion to the new function.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
 drivers/staging/unisys/visorhba/visorhba_main.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Kershner, David A April 14, 2017, 4:07 p.m. UTC | #1
> -----Original Message-----
> From: Logan Gunthorpe [mailto:logang@deltatee.com]
...
> Subject: [PATCH 10/22] staging: unisys: visorbus: Make use of the new
> sg_map helper function
> 
> Straightforward conversion to the new function.
> 
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>

Can you add Acked-by for this patch? 

Acked-by: David Kershner <david.kershner@unisys.com>

Tested on s-Par and no problems. 

Thanks,
David Kershner

> ---
>  drivers/staging/unisys/visorhba/visorhba_main.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c
> b/drivers/staging/unisys/visorhba/visorhba_main.c
> index 0ce92c8..2d8c8bc 100644
> --- a/drivers/staging/unisys/visorhba/visorhba_main.c
> +++ b/drivers/staging/unisys/visorhba/visorhba_main.c
> @@ -842,7 +842,6 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct
> scsi_cmnd *scsicmd)
>  	struct scatterlist *sg;
>  	unsigned int i;
>  	char *this_page;
> -	char *this_page_orig;
>  	int bufind = 0;
>  	struct visordisk_info *vdisk;
>  	struct visorhba_devdata *devdata;
> @@ -869,11 +868,14 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp,
> struct scsi_cmnd *scsicmd)
> 
>  		sg = scsi_sglist(scsicmd);
>  		for (i = 0; i < scsi_sg_count(scsicmd); i++) {
> -			this_page_orig = kmap_atomic(sg_page(sg + i));
> -			this_page = (void *)((unsigned long)this_page_orig |
> -					     sg[i].offset);
> +			this_page = sg_map(sg + i, SG_KMAP_ATOMIC);
> +			if (IS_ERR(this_page)) {
> +				scsicmd->result = DID_ERROR << 16;
> +				return;
> +			}
> +
>  			memcpy(this_page, buf + bufind, sg[i].length);
> -			kunmap_atomic(this_page_orig);
> +			sg_unmap(sg + i, this_page, SG_KMAP_ATOMIC);
>  		}
>  	} else {
>  		devdata = (struct visorhba_devdata *)scsidev->host-
> >hostdata;
> --
> 2.1.4
Logan Gunthorpe April 14, 2017, 4:12 p.m. UTC | #2
Great, thanks!

Logan

On 14/04/17 10:07 AM, Kershner, David A wrote:
> Can you add Acked-by for this patch? 
> 
> Acked-by: David Kershner <david.kershner@unisys.com>
> 
> Tested on s-Par and no problems. 
> 
> Thanks,
> David Kershner
> 
>> ---
>>  drivers/staging/unisys/visorhba/visorhba_main.c | 12 +++++++-----
>>  1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c
>> b/drivers/staging/unisys/visorhba/visorhba_main.c
>> index 0ce92c8..2d8c8bc 100644
>> --- a/drivers/staging/unisys/visorhba/visorhba_main.c
>> +++ b/drivers/staging/unisys/visorhba/visorhba_main.c
>> @@ -842,7 +842,6 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct
>> scsi_cmnd *scsicmd)
>>  	struct scatterlist *sg;
>>  	unsigned int i;
>>  	char *this_page;
>> -	char *this_page_orig;
>>  	int bufind = 0;
>>  	struct visordisk_info *vdisk;
>>  	struct visorhba_devdata *devdata;
>> @@ -869,11 +868,14 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp,
>> struct scsi_cmnd *scsicmd)
>>
>>  		sg = scsi_sglist(scsicmd);
>>  		for (i = 0; i < scsi_sg_count(scsicmd); i++) {
>> -			this_page_orig = kmap_atomic(sg_page(sg + i));
>> -			this_page = (void *)((unsigned long)this_page_orig |
>> -					     sg[i].offset);
>> +			this_page = sg_map(sg + i, SG_KMAP_ATOMIC);
>> +			if (IS_ERR(this_page)) {
>> +				scsicmd->result = DID_ERROR << 16;
>> +				return;
>> +			}
>> +
>>  			memcpy(this_page, buf + bufind, sg[i].length);
>> -			kunmap_atomic(this_page_orig);
>> +			sg_unmap(sg + i, this_page, SG_KMAP_ATOMIC);
>>  		}
>>  	} else {
>>  		devdata = (struct visorhba_devdata *)scsidev->host-
>>> hostdata;
>> --
>> 2.1.4
>
diff mbox

Patch

diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 0ce92c8..2d8c8bc 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -842,7 +842,6 @@  do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
 	struct scatterlist *sg;
 	unsigned int i;
 	char *this_page;
-	char *this_page_orig;
 	int bufind = 0;
 	struct visordisk_info *vdisk;
 	struct visorhba_devdata *devdata;
@@ -869,11 +868,14 @@  do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
 
 		sg = scsi_sglist(scsicmd);
 		for (i = 0; i < scsi_sg_count(scsicmd); i++) {
-			this_page_orig = kmap_atomic(sg_page(sg + i));
-			this_page = (void *)((unsigned long)this_page_orig |
-					     sg[i].offset);
+			this_page = sg_map(sg + i, SG_KMAP_ATOMIC);
+			if (IS_ERR(this_page)) {
+				scsicmd->result = DID_ERROR << 16;
+				return;
+			}
+
 			memcpy(this_page, buf + bufind, sg[i].length);
-			kunmap_atomic(this_page_orig);
+			sg_unmap(sg + i, this_page, SG_KMAP_ATOMIC);
 		}
 	} else {
 		devdata = (struct visorhba_devdata *)scsidev->host->hostdata;