[PATCH] cleanup up seq file usage in resource.c

Jeff Muizelaar (muizelaar@rogers.com)
Wed, 28 May 2003 20:05:33 -0400


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-6219-1054166741-0001-2
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

This patch against 2.5.70-bk2 removes the buffer allocation from
resource.c and lets seq_read do it instead.

-Jeff

--=_courier-6219-1054166741-0001-2
Content-Type: text/plain; name="resource-seq-file-cleanup.patch"; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="resource-seq-file-cleanup.patch"

diff -urN linux-2.5.70-bk2/kernel/resource.c linux-2.5.70-bk2-resource-seq-file-cleanup/kernel/resource.c
--- linux-2.5.70-bk2/kernel/resource.c 2003-05-26 21:00:42.000000000 -0400
+++ linux-2.5.70-bk2-resource-seq-file-cleanup/kernel/resource.c 2003-05-28 19:22:04.000000000 -0400
@@ -71,20 +71,7 @@

static int ioresources_open(struct file *file, struct resource *root)
{
- char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
- struct seq_file *m;
- int res;
-
- if (!buf)
- return -ENOMEM;
- res = single_open(file, ioresources_show, root);
- if (!res) {
- m = file->private_data;
- m->buf = buf;
- m->size = PAGE_SIZE;
- } else
- kfree(buf);
- return res;
+ return single_open(file, ioresources_show, root);
}

static int ioports_open(struct inode *inode, struct file *file)

--=_courier-6219-1054166741-0001-2--