[PATCH V4 09/16] staging: rtsx: use sg helper to operate scatterlist

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

 



Use the scatterlist iterators and remove direct indexing of the
scatterlist array.

This way allows us to pre-allocate one small scatterlist, which can be
chained with one runtime allocated scatterlist if the pre-allocated one
isn't enough for the whole request.

Cc: Kim Bradley <kim.jamie.bradley@xxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
---
 drivers/staging/rts5208/rtsx_transport.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 8277d7895608..407c9079b052 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -63,6 +63,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 		struct scatterlist *sg =
 				(struct scatterlist *)scsi_sglist(srb)
 				+ *index;
+		if (sg_is_chain(sg))
+			sg = sg_chain_ptr(sg);
 
 		/*
 		 * This loop handles a single s-g list entry, which may
@@ -86,7 +88,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
 				/* Transfer continues to next s-g entry */
 				*offset = 0;
 				++*index;
-				++sg;
+				sg = sg_next(sg);
 			}
 
 			while (sglen > 0) {
-- 
2.20.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux