aboutsummaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-01-16 14:19:52 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-16 14:19:52 -0800
commitf37752a5fedef203decdcf6197f53b9cffa04416 (patch)
tree08512e83fba2a7ea076e85c3c4303e64337c180d /driver
parentd07e9db91955bb3909a915f56e90b380c189d8fb (diff)
downloadpatches-f37752a5fedef203decdcf6197f53b9cffa04416.tar.gz
more patches added
Diffstat (limited to 'driver')
-rw-r--r--driver/allow-sysfs-attribute-files-to-be-pollable.patch2
-rw-r--r--driver/fix-up-the-sysfs-pollable-patch.patch122
-rw-r--r--driver/kobject-don-t-oops-on-null-kobject.name.patch37
3 files changed, 160 insertions, 1 deletions
diff --git a/driver/allow-sysfs-attribute-files-to-be-pollable.patch b/driver/allow-sysfs-attribute-files-to-be-pollable.patch
index 6a3e9fb447787..aedf27538425e 100644
--- a/driver/allow-sysfs-attribute-files-to-be-pollable.patch
+++ b/driver/allow-sysfs-attribute-files-to-be-pollable.patch
@@ -229,7 +229,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
#endif /* _SYSFS_H_ */
--- gregkh-2.6.orig/lib/kobject.c
+++ gregkh-2.6/lib/kobject.c
-@@ -125,6 +125,7 @@ void kobject_init(struct kobject * kobj)
+@@ -129,6 +129,7 @@ void kobject_init(struct kobject * kobj)
WARN_ON(atomic_read(&kobj->kref.refcount));
kref_init(&kobj->kref);
INIT_LIST_HEAD(&kobj->entry);
diff --git a/driver/fix-up-the-sysfs-pollable-patch.patch b/driver/fix-up-the-sysfs-pollable-patch.patch
new file mode 100644
index 0000000000000..11b0dc601fa32
--- /dev/null
+++ b/driver/fix-up-the-sysfs-pollable-patch.patch
@@ -0,0 +1,122 @@
+From neilb@suse.de Mon Jan 16 13:57:41 2006
+From: Neil Brown <neilb@suse.de>
+To: maneesh@in.ibm.com
+Date: Thu, 12 Jan 2006 12:17:40 +1100
+Message-ID: <17349.44596.839590.753601@cse.unsw.edu.au>
+Cc: <gregkh@suse.de>, greg@kroah.com
+Subject: fix up the sysfs pollable patch
+
+On Friday December 23, maneesh@in.ibm.com wrote:
+>
+> I donot agree with the sysfs_find() implementation and I think
+> Neil is trying to rework that. Also IMO, to allow proper poll semantics,
+> the read buffer should be flushed so as to see new contents on re-read.
+
+Does the patch below remove your concerns with sysfs_find?
+
+It also should allow you to reread the file (not requiring close and
+re-open). How I don't think this really classifies as "proper poll
+semantics". What we are doing is something quite different to what
+'poll' is normally used for. It is really a lot more like 'notify',
+but that interface isn't as mature yet.
+
+NeilBrown
+
+Signed-off-by: Neil Brown <neilb@suse.de>
+Acked-by: Maneesh Soni <maneesh@in.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ fs/sysfs/file.c | 44 ++++++++++++++++++++++++++++++++++++--------
+ fs/sysfs/inode.c | 21 ---------------------
+ 2 files changed, 36 insertions(+), 29 deletions(-)
+
+--- gregkh-2.6.orig/fs/sysfs/file.c
++++ gregkh-2.6/fs/sysfs/file.c
+@@ -375,22 +375,50 @@ static unsigned int sysfs_poll(struct fi
+
+ poll_wait(filp, &kobj->poll, wait);
+
+- if (buffer->event != atomic_read(&sd->s_event))
++ if (buffer->event != atomic_read(&sd->s_event)) {
+ res = POLLERR|POLLPRI;
++ buffer->needs_read_fill = 1;
++ }
+
+ return res;
+ }
+
++
++static struct dentry *step_down(struct dentry *dir, const char * name)
++{
++ struct dentry * de;
++
++ if (dir == NULL || dir->d_inode == NULL)
++ return NULL;
++
++ mutex_lock(&dir->d_inode->i_mutex);
++ de = lookup_one_len(name, dir, strlen(name));
++ mutex_unlock(&dir->d_inode->i_mutex);
++ dput(dir);
++ if (IS_ERR(de))
++ return NULL;
++ if (de->d_inode == NULL) {
++ dput(de);
++ return NULL;
++ }
++ return de;
++}
++
+ void sysfs_notify(struct kobject * k, char *dir, char *attr)
+ {
+- struct sysfs_dirent * sd = k->dentry->d_fsdata;
+- if (sd && dir)
+- sd = sysfs_find(sd, dir);
+- if (sd && attr)
+- sd = sysfs_find(sd, attr);
+- if (sd) {
+- atomic_inc(&sd->s_event);
++ struct dentry *de = k->dentry;
++ if (de)
++ dget(de);
++ if (de && dir)
++ de = step_down(de, dir);
++ if (de && attr)
++ de = step_down(de, attr);
++ if (de) {
++ struct sysfs_dirent * sd = de->d_fsdata;
++ if (sd)
++ atomic_inc(&sd->s_event);
+ wake_up_interruptible(&k->poll);
++ dput(de);
+ }
+ }
+ EXPORT_SYMBOL_GPL(sysfs_notify);
+--- gregkh-2.6.orig/fs/sysfs/inode.c
++++ gregkh-2.6/fs/sysfs/inode.c
+@@ -246,24 +246,3 @@ void sysfs_hash_and_remove(struct dentry
+ }
+ mutex_unlock(&dir->d_inode->i_mutex);
+ }
+-
+-struct sysfs_dirent *sysfs_find(struct sysfs_dirent *dir, const char * name)
+-{
+- struct sysfs_dirent * sd, * rv = NULL;
+-
+- if (dir->s_dentry == NULL ||
+- dir->s_dentry->d_inode == NULL)
+- return NULL;
+-
+- mutex_lock(&dir->s_dentry->d_inode->i_mutex);
+- list_for_each_entry(sd, &dir->s_children, s_sibling) {
+- if (!sd->s_element)
+- continue;
+- if (!strcmp(sysfs_get_name(sd), name)) {
+- rv = sd;
+- break;
+- }
+- }
+- mutex_unlock(&dir->s_dentry->d_inode->i_mutex);
+- return rv;
+-}
diff --git a/driver/kobject-don-t-oops-on-null-kobject.name.patch b/driver/kobject-don-t-oops-on-null-kobject.name.patch
new file mode 100644
index 0000000000000..344960df77116
--- /dev/null
+++ b/driver/kobject-don-t-oops-on-null-kobject.name.patch
@@ -0,0 +1,37 @@
+From 76306.1226@compuserve.com Mon Jan 16 14:06:48 2006
+Date: Thu, 12 Jan 2006 20:02:00 -0500
+From: Chuck Ebbert <76306.1226@compuserve.com>
+Subject: kobject: don't oops on null kobject.name
+To: Greg KH <greg@kroah.com>
+Message-ID: <200601122004_MC3-1-B5C5-4B72@compuserve.com>
+Content-Disposition: inline
+
+kobject_get_path() will oops if one of the component names is
+NULL. Fix that by returning NULL instead of oopsing.
+
+Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ lib/kobject.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- gregkh-2.6.orig/lib/kobject.c
++++ gregkh-2.6/lib/kobject.c
+@@ -72,6 +72,8 @@ static int get_kobj_path_length(struct k
+ * Add 1 to strlen for leading '/' of each level.
+ */
+ do {
++ if (kobject_name(parent) == NULL)
++ return 0;
+ length += strlen(kobject_name(parent)) + 1;
+ parent = parent->parent;
+ } while (parent);
+@@ -107,6 +109,8 @@ char *kobject_get_path(struct kobject *k
+ int len;
+
+ len = get_kobj_path_length(kobj);
++ if (len == 0)
++ return NULL;
+ path = kmalloc(len, gfp_mask);
+ if (!path)
+ return NULL;