aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--class-move-driver-core-specific-parts-to-a-private-structure.patch165
-rw-r--r--driver-core/block-make-proc-partitions-and-proc-diskstats-use-class_find_device.patch61
-rw-r--r--driver-core/block-move-header-for-proc-partitions-to-seq_start.patch40
-rw-r--r--driver-core/driver-core-add-ability-for-class_find_device-to-start-in-middle-of-list.patch17
-rw-r--r--driver-core/driver-core-add-ability-for-class_for_each_device-to-start-in-middle-of-list.patch13
-rw-r--r--driver-core/i2c-use-class_for_each_device.patch148
-rw-r--r--series3
-rw-r--r--version2
8 files changed, 284 insertions, 165 deletions
diff --git a/class-move-driver-core-specific-parts-to-a-private-structure.patch b/class-move-driver-core-specific-parts-to-a-private-structure.patch
index ff6033d98eb8b4..e66e023796e5b0 100644
--- a/class-move-driver-core-specific-parts-to-a-private-structure.patch
+++ b/class-move-driver-core-specific-parts-to-a-private-structure.patch
@@ -8,20 +8,16 @@ This moves the portions of struct class that are dynamic (kobject and
lock and lists) out of the main structure and into a dymamic, private,
structure.
-Note, right now this breaks the genhd.c code badly, hopefully Kay can
-fix this up for me :)
-
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
- drivers/base/base.h | 27 +++++++++++++
- drivers/base/class.c | 89 +++++++++++++++++++++++++--------------------
- drivers/base/core.c | 41 +++++++++++---------
- drivers/i2c/i2c-core.c | 96 ++++++++++++++++++++++++++-----------------------
+ drivers/base/base.h | 27 ++++++++++++++
+ drivers/base/class.c | 89 ++++++++++++++++++++++++++-----------------------
+ drivers/base/core.c | 41 ++++++++++++----------
include/linux/device.h | 8 +---
- 5 files changed, 153 insertions(+), 108 deletions(-)
+ 4 files changed, 101 insertions(+), 64 deletions(-)
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -215,10 +211,10 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
- list_for_each_entry(dev, &class->devices, node) {
+ down(&class->p->sem);
+ list_for_each_entry(dev, &class->p->devices, node) {
- if (start && start != dev)
- continue;
- else
-@@ -292,7 +301,7 @@ int class_for_each_device(struct class *
+ if (start) {
+ if (start == dev)
+ start = NULL;
+@@ -293,7 +302,7 @@ int class_for_each_device(struct class *
if (error)
break;
}
@@ -227,7 +223,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return error;
}
-@@ -329,8 +338,8 @@ struct device *class_find_device(struct
+@@ -330,8 +339,8 @@ struct device *class_find_device(struct
if (!class)
return NULL;
@@ -235,10 +231,10 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
- list_for_each_entry(dev, &class->devices, node) {
+ down(&class->p->sem);
+ list_for_each_entry(dev, &class->p->devices, node) {
- if (start && start != dev)
- continue;
- else
-@@ -342,7 +351,7 @@ struct device *class_find_device(struct
+ if (start) {
+ if (start == dev)
+ start = NULL;
+@@ -344,7 +353,7 @@ struct device *class_find_device(struct
} else
put_device(dev);
}
@@ -247,7 +243,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return found ? dev : NULL;
}
-@@ -360,13 +369,13 @@ int class_interface_register(struct clas
+@@ -362,13 +371,13 @@ int class_interface_register(struct clas
if (!parent)
return -EINVAL;
@@ -265,7 +261,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return 0;
}
-@@ -379,13 +388,13 @@ void class_interface_unregister(struct c
+@@ -381,13 +390,13 @@ void class_interface_unregister(struct c
if (!parent)
return;
@@ -411,137 +407,6 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
}
#endif
---- a/drivers/i2c/i2c-core.c
-+++ b/drivers/i2c/i2c-core.c
-@@ -646,6 +646,15 @@ EXPORT_SYMBOL(i2c_del_adapter);
-
- /* ------------------------------------------------------------------------- */
-
-+static int attach_device(struct device *dev, void *data)
-+{
-+ struct i2c_adapter *adapter = to_i2c_adapter(dev);
-+ struct i2c_driver *driver = data;
-+
-+ driver->attach_adapter(adapter);
-+ return 0;
-+}
-+
- /*
- * An i2c_driver is used with one or more i2c_client (device) nodes to access
- * i2c slave chips, on a bus instance associated with some i2c_adapter. There
-@@ -686,22 +695,52 @@ int i2c_register_driver(struct module *o
- pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
-
- /* legacy drivers scan i2c busses directly */
-- if (driver->attach_adapter) {
-- struct i2c_adapter *adapter;
--
-- down(&i2c_adapter_class.sem);
-- list_for_each_entry(adapter, &i2c_adapter_class.devices,
-- dev.node) {
-- driver->attach_adapter(adapter);
-- }
-- up(&i2c_adapter_class.sem);
-- }
-+ if (driver->attach_adapter)
-+ class_for_each_device(&i2c_adapter_class, (void *)driver,
-+ attach_device);
-
- mutex_unlock(&core_lock);
- return 0;
- }
- EXPORT_SYMBOL(i2c_register_driver);
-
-+static int detach_device(struct device *dev, void *data)
-+{
-+ struct i2c_adapter *adapter = to_i2c_adapter(dev);
-+ struct i2c_driver *driver = data;
-+ struct list_head *item2;
-+ struct list_head *_n;
-+ struct i2c_client *client;
-+
-+ /* Have a look at each adapter, if clients of this driver are still
-+ * attached. If so, detach them to be able to kill the driver
-+ * afterwards.
-+ */
-+ if (driver->detach_adapter) {
-+ if (driver->detach_adapter(adapter)) {
-+ dev_err(&adapter->dev, "detach_adapter failed "
-+ "for driver [%s]\n",
-+ driver->driver.name);
-+ }
-+ } else {
-+ list_for_each_safe(item2, _n, &adapter->clients) {
-+ client = list_entry(item2, struct i2c_client, list);
-+ if (client->driver != driver)
-+ continue;
-+ dev_dbg(&adapter->dev, "detaching client [%s] "
-+ "at 0x%02x\n", client->name,
-+ client->addr);
-+ if (driver->detach_client(client)) {
-+ dev_err(&adapter->dev, "detach_client "
-+ "failed for client [%s] at "
-+ "0x%02x\n", client->name,
-+ client->addr);
-+ }
-+ }
-+ }
-+ return 0;
-+}
-+
- /**
- * i2c_del_driver - unregister I2C driver
- * @driver: the driver being unregistered
-@@ -709,46 +748,15 @@ EXPORT_SYMBOL(i2c_register_driver);
- */
- void i2c_del_driver(struct i2c_driver *driver)
- {
-- struct list_head *item2, *_n;
-- struct i2c_client *client;
-- struct i2c_adapter *adap;
--
- mutex_lock(&core_lock);
-
- /* new-style driver? */
- if (is_newstyle_driver(driver))
- goto unregister;
-
-- /* Have a look at each adapter, if clients of this driver are still
-- * attached. If so, detach them to be able to kill the driver
-- * afterwards.
-- */
-- down(&i2c_adapter_class.sem);
-- list_for_each_entry(adap, &i2c_adapter_class.devices, dev.node) {
-- if (driver->detach_adapter) {
-- if (driver->detach_adapter(adap)) {
-- dev_err(&adap->dev, "detach_adapter failed "
-- "for driver [%s]\n",
-- driver->driver.name);
-- }
-- } else {
-- list_for_each_safe(item2, _n, &adap->clients) {
-- client = list_entry(item2, struct i2c_client, list);
-- if (client->driver != driver)
-- continue;
-- dev_dbg(&adap->dev, "detaching client [%s] "
-- "at 0x%02x\n", client->name,
-- client->addr);
-- if (driver->detach_client(client)) {
-- dev_err(&adap->dev, "detach_client "
-- "failed for client [%s] at "
-- "0x%02x\n", client->name,
-- client->addr);
-- }
-- }
-- }
-- }
-- up(&i2c_adapter_class.sem);
-+ /* old-style driver, do it by hand */
-+ class_for_each_device(&i2c_adapter_class, (void *)driver,
-+ detach_device);
-
- unregister:
- driver_unregister(&driver->driver);
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -30,6 +30,7 @@ struct device;
diff --git a/driver-core/block-make-proc-partitions-and-proc-diskstats-use-class_find_device.patch b/driver-core/block-make-proc-partitions-and-proc-diskstats-use-class_find_device.patch
new file mode 100644
index 00000000000000..17bb7da1f885f5
--- /dev/null
+++ b/driver-core/block-make-proc-partitions-and-proc-diskstats-use-class_find_device.patch
@@ -0,0 +1,61 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Thu, 22 May 2008 17:21:08 -0400
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: block: make /proc/partitions and /proc/diskstats use class_find_device()
+
+Use the proper class iterator function instead of mucking around in the
+internals of the class structures.
+
+Cc: Kay Sievers <kay.sievers@vrfy.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ block/genhd.c | 25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+--- a/block/genhd.c
++++ b/block/genhd.c
+@@ -315,17 +315,21 @@ static void *part_start(struct seq_file
+ return NULL;
+ }
+
++static int find_next(struct device *dev, void *data)
++{
++ if (dev->type == &disk_type)
++ return 1;
++ return 0;
++}
++
+ static void *part_next(struct seq_file *part, void *v, loff_t *pos)
+ {
+ struct gendisk *gp = v;
+ struct device *dev;
+ ++*pos;
+- list_for_each_entry(dev, &gp->dev.node, node) {
+- if (&dev->node == &block_class.devices)
+- return NULL;
+- if (dev->type == &disk_type)
+- return dev_to_disk(dev);
+- }
++ dev = class_find_device(&block_class, &gp->dev, NULL, find_next);
++ if (dev)
++ return dev_to_disk(dev);
+ return NULL;
+ }
+
+@@ -565,12 +569,9 @@ static void *diskstats_next(struct seq_f
+ struct device *dev;
+
+ ++*pos;
+- list_for_each_entry(dev, &gp->dev.node, node) {
+- if (&dev->node == &block_class.devices)
+- return NULL;
+- if (dev->type == &disk_type)
+- return dev_to_disk(dev);
+- }
++ dev = class_find_device(&block_class, &gp->dev, NULL, find_next);
++ if (dev)
++ return dev_to_disk(dev);
+ return NULL;
+ }
+
diff --git a/driver-core/block-move-header-for-proc-partitions-to-seq_start.patch b/driver-core/block-move-header-for-proc-partitions-to-seq_start.patch
new file mode 100644
index 00000000000000..3b23d17b6d117e
--- /dev/null
+++ b/driver-core/block-move-header-for-proc-partitions-to-seq_start.patch
@@ -0,0 +1,40 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Thu, 22 May 2008 17:21:08 -0400
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: block: move header for /proc/partitions to seq_start
+
+The seq_start call is the better place for the header for the file, that
+way we don't have to be mucking in the class structure to try to figure
+out if this is the first partition or not.
+
+Cc: Kay Sievers <kay.sievers@vrfy.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+---
+ block/genhd.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/block/genhd.c
++++ b/block/genhd.c
+@@ -303,6 +303,10 @@ static int find_start(struct device *dev
+ static void *part_start(struct seq_file *part, loff_t *pos)
+ {
+ struct device *dev;
++ loff_t n = *pos;
++
++ if (!n)
++ seq_puts(part, "major minor #blocks name\n\n");
+
+ mutex_lock(&block_class_lock);
+ dev = class_find_device(&block_class, NULL, (void *)pos, find_start);
+@@ -336,9 +340,6 @@ static int show_partition(struct seq_fil
+ int n;
+ char buf[BDEVNAME_SIZE];
+
+- if (&sgp->dev.node == block_class.devices.next)
+- seq_puts(part, "major minor #blocks name\n\n");
+-
+ /* Don't show non-partitionable removeable devices or empty devices */
+ if (!get_capacity(sgp) ||
+ (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)))
diff --git a/driver-core/driver-core-add-ability-for-class_find_device-to-start-in-middle-of-list.patch b/driver-core/driver-core-add-ability-for-class_find_device-to-start-in-middle-of-list.patch
index 0a57a3f7098a39..fac2282e256100 100644
--- a/driver-core/driver-core-add-ability-for-class_find_device-to-start-in-middle-of-list.patch
+++ b/driver-core/driver-core-add-ability-for-class_find_device-to-start-in-middle-of-list.patch
@@ -17,18 +17,18 @@ Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
- drivers/base/class.c | 21 ++++++++++++---------
+ drivers/base/class.c | 22 +++++++++++++---------
drivers/base/core.c | 2 +-
drivers/ieee1394/nodemgr.c | 9 ++++++---
drivers/rtc/interface.c | 2 +-
drivers/scsi/hosts.c | 3 ++-
drivers/spi/spi.c | 2 +-
include/linux/device.h | 3 ++-
- 7 files changed, 25 insertions(+), 17 deletions(-)
+ 7 files changed, 26 insertions(+), 17 deletions(-)
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
-@@ -301,6 +301,7 @@ EXPORT_SYMBOL_GPL(class_for_each_device)
+@@ -302,6 +302,7 @@ EXPORT_SYMBOL_GPL(class_for_each_device)
/**
* class_find_device - device iterator for locating a particular device
* @class: the class we're iterating
@@ -36,7 +36,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* @data: data for the match function
* @match: function to check device
*
-@@ -318,8 +319,9 @@ EXPORT_SYMBOL_GPL(class_for_each_device)
+@@ -319,8 +320,9 @@ EXPORT_SYMBOL_GPL(class_for_each_device)
* re-acquired in @match, otherwise it will self-deadlocking. For
* example, calls to add or remove class members would be verboten.
*/
@@ -48,14 +48,15 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
{
struct device *dev;
int found = 0;
-@@ -329,15 +331,16 @@ struct device *class_find_device(struct
+@@ -330,15 +332,17 @@ struct device *class_find_device(struct
down(&class->sem);
list_for_each_entry(dev, &class->devices, node) {
-+ if (start && start != dev)
++ if (start) {
++ if (start == dev)
++ start = NULL;
+ continue;
-+ else
-+ start = NULL;
++ }
dev = get_device(dev);
- if (dev) {
- if (match(dev, data)) {
diff --git a/driver-core/driver-core-add-ability-for-class_for_each_device-to-start-in-middle-of-list.patch b/driver-core/driver-core-add-ability-for-class_for_each_device-to-start-in-middle-of-list.patch
index 02c0c877b44b7a..394a70b3d763be 100644
--- a/driver-core/driver-core-add-ability-for-class_for_each_device-to-start-in-middle-of-list.patch
+++ b/driver-core/driver-core-add-ability-for-class_for_each_device-to-start-in-middle-of-list.patch
@@ -17,12 +17,12 @@ Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
- drivers/base/class.c | 20 ++++++++++++--------
+ drivers/base/class.c | 21 +++++++++++++--------
drivers/ieee1394/nodemgr.c | 14 +++++++++-----
drivers/power/apm_power.c | 2 +-
drivers/power/power_supply_core.c | 4 ++--
include/linux/device.h | 3 ++-
- 5 files changed, 26 insertions(+), 17 deletions(-)
+ 5 files changed, 27 insertions(+), 17 deletions(-)
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -53,14 +53,15 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
{
struct device *dev;
int error = 0;
-@@ -279,12 +282,13 @@ int class_for_each_device(struct class *
+@@ -279,12 +282,14 @@ int class_for_each_device(struct class *
return -EINVAL;
down(&class->sem);
list_for_each_entry(dev, &class->devices, node) {
-+ if (start && start != dev)
++ if (start) {
++ if (start == dev)
++ start = NULL;
+ continue;
-+ else
-+ start = NULL;
++ }
dev = get_device(dev);
- if (dev) {
- error = fn(dev, data);
diff --git a/driver-core/i2c-use-class_for_each_device.patch b/driver-core/i2c-use-class_for_each_device.patch
new file mode 100644
index 00000000000000..c2425e2600a401
--- /dev/null
+++ b/driver-core/i2c-use-class_for_each_device.patch
@@ -0,0 +1,148 @@
+erom foo@baz Tue Apr 9 12:12:43 2002
+Date: Tue, 22 Jan 2008 18:17:41 -0500
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: I2C: use class_for_each_device
+
+Don't much around in the internals of struct class, but use the proper
+iterator functions instead.
+
+Cc: Kay Sievers <kay.sievers@vrfy.org>
+Cc: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/i2c/i2c-core.c | 96 ++++++++++++++++++++++++++-----------------------
+ 1 file changed, 52 insertions(+), 44 deletions(-)
+
+--- a/drivers/i2c/i2c-core.c
++++ b/drivers/i2c/i2c-core.c
+@@ -646,6 +646,15 @@ EXPORT_SYMBOL(i2c_del_adapter);
+
+ /* ------------------------------------------------------------------------- */
+
++static int attach_device(struct device *dev, void *data)
++{
++ struct i2c_adapter *adapter = to_i2c_adapter(dev);
++ struct i2c_driver *driver = data;
++
++ driver->attach_adapter(adapter);
++ return 0;
++}
++
+ /*
+ * An i2c_driver is used with one or more i2c_client (device) nodes to access
+ * i2c slave chips, on a bus instance associated with some i2c_adapter. There
+@@ -686,22 +695,52 @@ int i2c_register_driver(struct module *o
+ pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
+
+ /* legacy drivers scan i2c busses directly */
+- if (driver->attach_adapter) {
+- struct i2c_adapter *adapter;
+-
+- down(&i2c_adapter_class.sem);
+- list_for_each_entry(adapter, &i2c_adapter_class.devices,
+- dev.node) {
+- driver->attach_adapter(adapter);
+- }
+- up(&i2c_adapter_class.sem);
+- }
++ if (driver->attach_adapter)
++ class_for_each_device(&i2c_adapter_class, (void *)driver,
++ attach_device);
+
+ mutex_unlock(&core_lock);
+ return 0;
+ }
+ EXPORT_SYMBOL(i2c_register_driver);
+
++static int detach_device(struct device *dev, void *data)
++{
++ struct i2c_adapter *adapter = to_i2c_adapter(dev);
++ struct i2c_driver *driver = data;
++ struct list_head *item2;
++ struct list_head *_n;
++ struct i2c_client *client;
++
++ /* Have a look at each adapter, if clients of this driver are still
++ * attached. If so, detach them to be able to kill the driver
++ * afterwards.
++ */
++ if (driver->detach_adapter) {
++ if (driver->detach_adapter(adapter)) {
++ dev_err(&adapter->dev, "detach_adapter failed "
++ "for driver [%s]\n",
++ driver->driver.name);
++ }
++ } else {
++ list_for_each_safe(item2, _n, &adapter->clients) {
++ client = list_entry(item2, struct i2c_client, list);
++ if (client->driver != driver)
++ continue;
++ dev_dbg(&adapter->dev, "detaching client [%s] "
++ "at 0x%02x\n", client->name,
++ client->addr);
++ if (driver->detach_client(client)) {
++ dev_err(&adapter->dev, "detach_client "
++ "failed for client [%s] at "
++ "0x%02x\n", client->name,
++ client->addr);
++ }
++ }
++ }
++ return 0;
++}
++
+ /**
+ * i2c_del_driver - unregister I2C driver
+ * @driver: the driver being unregistered
+@@ -709,46 +748,15 @@ EXPORT_SYMBOL(i2c_register_driver);
+ */
+ void i2c_del_driver(struct i2c_driver *driver)
+ {
+- struct list_head *item2, *_n;
+- struct i2c_client *client;
+- struct i2c_adapter *adap;
+-
+ mutex_lock(&core_lock);
+
+ /* new-style driver? */
+ if (is_newstyle_driver(driver))
+ goto unregister;
+
+- /* Have a look at each adapter, if clients of this driver are still
+- * attached. If so, detach them to be able to kill the driver
+- * afterwards.
+- */
+- down(&i2c_adapter_class.sem);
+- list_for_each_entry(adap, &i2c_adapter_class.devices, dev.node) {
+- if (driver->detach_adapter) {
+- if (driver->detach_adapter(adap)) {
+- dev_err(&adap->dev, "detach_adapter failed "
+- "for driver [%s]\n",
+- driver->driver.name);
+- }
+- } else {
+- list_for_each_safe(item2, _n, &adap->clients) {
+- client = list_entry(item2, struct i2c_client, list);
+- if (client->driver != driver)
+- continue;
+- dev_dbg(&adap->dev, "detaching client [%s] "
+- "at 0x%02x\n", client->name,
+- client->addr);
+- if (driver->detach_client(client)) {
+- dev_err(&adap->dev, "detach_client "
+- "failed for client [%s] at "
+- "0x%02x\n", client->name,
+- client->addr);
+- }
+- }
+- }
+- }
+- up(&i2c_adapter_class.sem);
++ /* old-style driver, do it by hand */
++ class_for_each_device(&i2c_adapter_class, (void *)driver,
++ detach_device);
+
+ unregister:
+ driver_unregister(&driver->driver);
diff --git a/series b/series
index 7a65fb1cbf2010..a8d19a8a3413f8 100644
--- a/series
+++ b/series
@@ -74,6 +74,9 @@ driver-core/block-fix-compiler-warning-in-genhd.c.patch
driver-core/block-make-printk_partition-use-the-class-iterator-function.patch
driver-core/block-make-blk_lookup_devt-use-the-class-iterator-function.patch
driver-core/block-make-proc-files-seq_start-use-the-class_find_device.patch
+driver-core/block-move-header-for-proc-partitions-to-seq_start.patch
+driver-core/block-make-proc-partitions-and-proc-diskstats-use-class_find_device.patch
+driver-core/i2c-use-class_for_each_device.patch
driver-core/driver-core-remove-kobj_name_len-define.patch
driver-core/driver-core-remove-device_name_size-define.patch
diff --git a/version b/version
index 1601d326fbff23..3d6467d2596e4c 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-2.6.26-rc3-git4
+2.6.26-rc3-git6