aboutsummaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-02-22 15:02:34 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2006-02-22 15:02:34 -0800
commiteb6b406dcc7096974eec722b436e0f05eca353a4 (patch)
tree0fa607d200cd276b6774f0f863e317a0741fc493 /driver
parent4fffec22d6b7a52d17e144280ea226114c92e0a0 (diff)
downloadpatches-eb6b406dcc7096974eec722b436e0f05eca353a4.tar.gz
usb, pci, and driver patches added
Diffstat (limited to 'driver')
-rw-r--r--driver/firmware-fix-bug-in-fw_realloc_buffer.patch50
-rw-r--r--driver/sysfs-add-__attr_relay-helper-for-relay-attributes.patch38
-rw-r--r--driver/sysfs-kzalloc-conversion.patch46
3 files changed, 134 insertions, 0 deletions
diff --git a/driver/firmware-fix-bug-in-fw_realloc_buffer.patch b/driver/firmware-fix-bug-in-fw_realloc_buffer.patch
new file mode 100644
index 0000000000000..aaecc69d9369f
--- /dev/null
+++ b/driver/firmware-fix-bug-in-fw_realloc_buffer.patch
@@ -0,0 +1,50 @@
+From akpm@osdl.org Mon Feb 13 14:53:31 2006
+Message-Id: <200602132253.k1DMrUXe010880@shell0.pdx.osdl.net>
+Subject: firmware: fix BUG: in fw_realloc_buffer
+To: jmoyer@redhat.com, greg@kroah.com, mm-commits@vger.kernel.org
+From: akpm@osdl.org
+Date: Mon, 13 Feb 2006 14:52:38 -0800
+
+From: Jeff Moyer <jmoyer@redhat.com>
+
+The fw_realloc_buffer routine does not handle an increase in buffer size of
+more than 4k. It's not clear to me why it expects that it will only get an
+extra 4k of data. The attached patch modifies fw_realloc_buffer to vmalloc
+as much memory as is requested, instead of what we previously had + 4k.
+
+I've tested this on my laptop, which would crash occaisionally on boot
+without the patch. With the patch, it hasn't crashed, but I can't be
+certain that this code path is exercised.
+
+Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/base/firmware_class.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- gregkh-2.6.orig/drivers/base/firmware_class.c
++++ gregkh-2.6/drivers/base/firmware_class.c
+@@ -211,18 +211,20 @@ static int
+ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
+ {
+ u8 *new_data;
++ int new_size = fw_priv->alloc_size;
+
+ if (min_size <= fw_priv->alloc_size)
+ return 0;
+
+- new_data = vmalloc(fw_priv->alloc_size + PAGE_SIZE);
++ new_size = ALIGN(min_size, PAGE_SIZE);
++ new_data = vmalloc(new_size);
+ if (!new_data) {
+ printk(KERN_ERR "%s: unable to alloc buffer\n", __FUNCTION__);
+ /* Make sure that we don't keep incomplete data */
+ fw_load_abort(fw_priv);
+ return -ENOMEM;
+ }
+- fw_priv->alloc_size += PAGE_SIZE;
++ fw_priv->alloc_size = new_size;
+ if (fw_priv->fw->data) {
+ memcpy(new_data, fw_priv->fw->data, fw_priv->fw->size);
+ vfree(fw_priv->fw->data);
diff --git a/driver/sysfs-add-__attr_relay-helper-for-relay-attributes.patch b/driver/sysfs-add-__attr_relay-helper-for-relay-attributes.patch
new file mode 100644
index 0000000000000..7027b0cbc50f0
--- /dev/null
+++ b/driver/sysfs-add-__attr_relay-helper-for-relay-attributes.patch
@@ -0,0 +1,38 @@
+From lethal@linux-sh.org Tue Feb 21 07:10:32 2006
+Date: Tue, 21 Feb 2006 17:10:31 +0200
+From: Paul Mundt <lethal@linux-sh.org>
+To: Greg KH <greg@kroah.com>
+Cc: <zanussi@us.ibm.com>
+Subject: sysfs: Add __ATTR_RELAY() helper for relay attributes.
+Message-ID: <20060221151031.GA20816@linux-sh.org>
+Content-Disposition: inline
+
+This adds a simple __ATTR_RELAY() to help people define relay attributes,
+this takes care of things like getting the module owner right.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/sysfs.h | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- gregkh-2.6.orig/include/linux/sysfs.h
++++ gregkh-2.6/include/linux/sysfs.h
+@@ -44,6 +44,16 @@ struct attribute_group {
+ .show = _name##_show, \
+ }
+
++#define __ATTR_RELAY(_name,_buffer_size,_nr_buffers) { \
++ .attr = { \
++ .owner = THIS_MODULE, \
++ .name = __stringify(_name), \
++ .mode = 0400, \
++ }, \
++ .subbuf_size = _buffer_size, \
++ .n_subbufs = _nr_buffers, \
++}
++
+ #define __ATTR_NULL { .attr = { .name = NULL } }
+
+ #define attr_name(_attr) (_attr).attr.name
diff --git a/driver/sysfs-kzalloc-conversion.patch b/driver/sysfs-kzalloc-conversion.patch
new file mode 100644
index 0000000000000..a98b633718ae6
--- /dev/null
+++ b/driver/sysfs-kzalloc-conversion.patch
@@ -0,0 +1,46 @@
+From snakebyte@gmx.de Wed Feb 22 02:18:18 2006
+From: Eric Sesterhenn <snakebyte@gmx.de>
+Subject: sysfs: kzalloc conversion
+Cc: gregkh@suse.de
+Date: Wed, 22 Feb 2006 11:18:15 +0100
+Message-Id: <1140603496.14898.20.camel@alice>
+
+this converts fs/sysfs to kzalloc() usage.
+compile tested with make allyesconfig
+
+Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/sysfs/file.c | 3 +--
+ fs/sysfs/inode.c | 3 +--
+ 2 files changed, 2 insertions(+), 4 deletions(-)
+
+--- gregkh-2.6.orig/fs/sysfs/file.c
++++ gregkh-2.6/fs/sysfs/file.c
+@@ -310,9 +310,8 @@ static int check_perm(struct inode * ino
+ /* No error? Great, allocate a buffer for the file, and store it
+ * it in file->private_data for easy access.
+ */
+- buffer = kmalloc(sizeof(struct sysfs_buffer),GFP_KERNEL);
++ buffer = kzalloc(sizeof(struct sysfs_buffer), GFP_KERNEL);
+ if (buffer) {
+- memset(buffer,0,sizeof(struct sysfs_buffer));
+ init_MUTEX(&buffer->sem);
+ buffer->needs_read_fill = 1;
+ buffer->ops = ops;
+--- gregkh-2.6.orig/fs/sysfs/inode.c
++++ gregkh-2.6/fs/sysfs/inode.c
+@@ -54,11 +54,10 @@ int sysfs_setattr(struct dentry * dentry
+
+ if (!sd_iattr) {
+ /* setting attributes for the first time, allocate now */
+- sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL);
++ sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL);
+ if (!sd_iattr)
+ return -ENOMEM;
+ /* assign default attributes */
+- memset(sd_iattr, 0, sizeof(struct iattr));
+ sd_iattr->ia_mode = sd->s_mode;
+ sd_iattr->ia_uid = 0;
+ sd_iattr->ia_gid = 0;