提交 232f1b51 编写于 作者: M Maxim Levitsky 提交者: Jens Axboe

scatterlist: refactor the sg_nents

Replace 'while' with 'for' as suggested by Tejun Heo
Signed-off-by: NMaxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册