[PATCH] Use sg_set_buf/sg_init_one where applicable
This patch uses sg_set_buf/sg_init_one in some places where it was duplicated. Signed-off-by: David Hardeman <david@2gen.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Greg KH <greg@kroah.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
d32311fed7
commit
378f058cc4
@@ -9,7 +9,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <asm/scatterlist.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <linux/usb.h>
|
||||
|
||||
@@ -381,7 +381,6 @@ alloc_sglist (int nents, int max, int vary)
|
||||
sg = kmalloc (nents * sizeof *sg, SLAB_KERNEL);
|
||||
if (!sg)
|
||||
return NULL;
|
||||
memset (sg, 0, nents * sizeof *sg);
|
||||
|
||||
for (i = 0; i < nents; i++) {
|
||||
char *buf;
|
||||
@@ -394,9 +393,7 @@ alloc_sglist (int nents, int max, int vary)
|
||||
memset (buf, 0, size);
|
||||
|
||||
/* kmalloc pages are always physically contiguous! */
|
||||
sg [i].page = virt_to_page (buf);
|
||||
sg [i].offset = offset_in_page (buf);
|
||||
sg [i].length = size;
|
||||
sg_init_one(&sg[i], buf, size);
|
||||
|
||||
if (vary) {
|
||||
size += vary;
|
||||
|
Reference in New Issue
Block a user