Commit 232f1b51 authored by Maxim Levitsky's avatar Maxim Levitsky Committed by Jens Axboe

scatterlist: refactor the sg_nents

Replace 'while' with 'for' as suggested by Tejun Heo
Signed-off-by: default avatarMaxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 2e484610
...@@ -49,12 +49,9 @@ EXPORT_SYMBOL(sg_next); ...@@ -49,12 +49,9 @@ EXPORT_SYMBOL(sg_next);
**/ **/
int sg_nents(struct scatterlist *sg) int sg_nents(struct scatterlist *sg)
{ {
int nents = 0; int nents;
while (sg) { for (nents = 0; sg; sg = sg_next(sg))
nents++; nents++;
sg = sg_next(sg);
}
return nents; return nents;
} }
EXPORT_SYMBOL(sg_nents); EXPORT_SYMBOL(sg_nents);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment