scsi: zfcp: replace zfcp_qdio_sbale_count by sg_nents
authorLABBE Corentin <clabbe.montjoie@gmail.com>
Fri, 28 Jul 2017 10:30:47 +0000 (12:30 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 10 Aug 2017 23:36:52 +0000 (19:36 -0400)
The zfcp_qdio_sbale_count function do the same work than sg_nents().
So replace it by sg_nents() for removing duplicate code.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/s390/scsi/zfcp_fsf.c
drivers/s390/scsi/zfcp_qdio.h

index 27ff38f839fc1c752385f430f55020fb934ed6de..3b69ec5e69edf38bd2fa417124c1683385353569 100644 (file)
@@ -991,8 +991,7 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
                qtcb->bottom.support.resp_buf_length =
                        zfcp_qdio_real_bytes(sg_resp);
 
-               zfcp_qdio_set_data_div(qdio, &req->qdio_req,
-                                       zfcp_qdio_sbale_count(sg_req));
+               zfcp_qdio_set_data_div(qdio, &req->qdio_req, sg_nents(sg_req));
                zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
                zfcp_qdio_set_scount(qdio, &req->qdio_req);
                return 0;
index 497cd379b0d10b065940e096ee1b60491c48ac44..85cdb82127e88c3ae684e2417a6875c2982ce080 100644 (file)
@@ -224,21 +224,6 @@ void zfcp_qdio_set_data_div(struct zfcp_qdio *qdio,
        sbale->length = count;
 }
 
-/**
- * zfcp_qdio_sbale_count - count sbale used
- * @sg: pointer to struct scatterlist
- */
-static inline
-unsigned int zfcp_qdio_sbale_count(struct scatterlist *sg)
-{
-       unsigned int count = 0;
-
-       for (; sg; sg = sg_next(sg))
-               count++;
-
-       return count;
-}
-
 /**
  * zfcp_qdio_real_bytes - count bytes used
  * @sg: pointer to struct scatterlist