summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2012-09-28 10:38:15 +0200
committerJens Axboe <axboe@kernel.dk>2012-09-28 10:38:15 +0200
commit232f1b51062553b7cf49f99719fbd1b8a8d80f29 (patch)
treebf0ad31232df77562ad42a48b1bf21a0e2948c3f
parent2e484610296b25f0a04b516bc144a00731d1d845 (diff)
downloadop-kernel-dev-232f1b51062553b7cf49f99719fbd1b8a8d80f29.zip
op-kernel-dev-232f1b51062553b7cf49f99719fbd1b8a8d80f29.tar.gz
scatterlist: refactor the sg_nents
Replace 'while' with 'for' as suggested by Tejun Heo Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--lib/scatterlist.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 1bf60ef..8cd2ced 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -49,12 +49,9 @@ EXPORT_SYMBOL(sg_next);
**/
int sg_nents(struct scatterlist *sg)
{
- int nents = 0;
- while (sg) {
+ int nents;
+ for (nents = 0; sg; sg = sg_next(sg))
nents++;
- sg = sg_next(sg);
- }
-
return nents;
}
EXPORT_SYMBOL(sg_nents);
OpenPOWER on IntegriCloud