diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-11 15:28:50 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-11 15:28:50 -0800 |
commit | 68aa69ec74575d546c16d103310234b013bccde2 (patch) | |
tree | db9fe0bc87e929c36ffc4961fa0fb5b6605206af /driver | |
parent | ad7369e38f8255fd52107b1f4ba8c75bfcd6ec2b (diff) | |
download | patches-68aa69ec74575d546c16d103310234b013bccde2.tar.gz |
add big driver mutex patch
Diffstat (limited to 'driver')
-rw-r--r-- | driver/driver-model-convert-driver-model-to-mutexes.patch | 1150 | ||||
-rw-r--r-- | driver/spi-add-spi_bitbang-driver.patch | 2 | ||||
-rw-r--r-- | driver/spi-misc-fixes.patch | 2 |
3 files changed, 1152 insertions, 2 deletions
diff --git a/driver/driver-model-convert-driver-model-to-mutexes.patch b/driver/driver-model-convert-driver-model-to-mutexes.patch new file mode 100644 index 0000000000000..67139a710db2c --- /dev/null +++ b/driver/driver-model-convert-driver-model-to-mutexes.patch @@ -0,0 +1,1150 @@ +From SRS0+a5501d92eec33f199aa0+870+infradead.org+arjan@pentafluge.srs.infradead.org Wed Jan 11 13:56:06 2006 +Date: Tue, 10 Jan 2006 05:52:55 +0000 +From: arjan@infradead.org +To: <greg@kroah.com> +Cc: <mingo@elte.hu> +Subject: driver model: convert driver model to mutexes +Message-ID: <20060110055255.GA21364@infradead.org> +Content-Disposition: inline + +Patch below converts drivers/base to mutexes, including some of the +subsystems that register semaphores(mutexes) to the driver subsystem. + +Signed-off-by: Arjan van de Ven <arjan@infradead.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + block/genhd.c | 25 +++++++++++++------------ + drivers/base/attribute_container.c | 27 ++++++++++++++------------- + drivers/base/bus.c | 16 ++++++++-------- + drivers/base/class.c | 22 +++++++++++----------- + drivers/base/core.c | 2 +- + drivers/base/dd.c | 36 ++++++++++++++++++------------------ + drivers/base/dmapool.c | 15 ++++++++------- + drivers/base/firmware_class.c | 21 +++++++++++---------- + drivers/base/map.c | 20 ++++++++++---------- + drivers/base/memory.c | 6 +++--- + drivers/base/power/resume.c | 4 ++-- + drivers/base/power/suspend.c | 4 ++-- + drivers/base/sys.c | 23 ++++++++++++----------- + drivers/usb/core/devio.c | 4 ++-- + drivers/usb/core/hub.c | 8 ++++---- + fs/char_dev.c | 17 +++++++++-------- + include/linux/device.h | 5 +++-- + include/linux/kobj_map.h | 4 ++-- + include/linux/memory.h | 5 ++--- + include/linux/usb.h | 6 +++--- + 20 files changed, 138 insertions(+), 132 deletions(-) + +--- gregkh-2.6.orig/block/genhd.c ++++ gregkh-2.6/block/genhd.c +@@ -15,12 +15,13 @@ + #include <linux/kmod.h> + #include <linux/kobj_map.h> + #include <linux/buffer_head.h> ++#include <linux/mutex.h> + + #define MAX_PROBE_HASH 255 /* random */ + + static struct subsystem block_subsys; + +-static DECLARE_MUTEX(block_subsys_sem); ++static DEFINE_MUTEX(block_subsys_mutex); + + /* + * Can be deleted altogether. Later. +@@ -47,7 +48,7 @@ int get_blkdev_list(char *p, int used) + + len = snprintf(p, (PAGE_SIZE-used), "\nBlock devices:\n"); + +- down(&block_subsys_sem); ++ mutex_lock(&block_subsys_mutex); + for (i = 0; i < ARRAY_SIZE(major_names); i++) { + for (n = major_names[i]; n; n = n->next) { + /* +@@ -61,7 +62,7 @@ int get_blkdev_list(char *p, int used) + } + } + page_full: +- up(&block_subsys_sem); ++ mutex_unlock(&block_subsys_mutex); + + return len; + } +@@ -72,7 +73,7 @@ int register_blkdev(unsigned int major, + struct blk_major_name **n, *p; + int index, ret = 0; + +- down(&block_subsys_sem); ++ mutex_lock(&block_subsys_mutex); + + /* temporary */ + if (major == 0) { +@@ -117,7 +118,7 @@ int register_blkdev(unsigned int major, + kfree(p); + } + out: +- up(&block_subsys_sem); ++ mutex_unlock(&block_subsys_mutex); + return ret; + } + +@@ -131,7 +132,7 @@ int unregister_blkdev(unsigned int major + int index = major_to_index(major); + int ret = 0; + +- down(&block_subsys_sem); ++ mutex_lock(&block_subsys_mutex); + for (n = &major_names[index]; *n; n = &(*n)->next) + if ((*n)->major == major) + break; +@@ -141,7 +142,7 @@ int unregister_blkdev(unsigned int major + p = *n; + *n = p->next; + } +- up(&block_subsys_sem); ++ mutex_unlock(&block_subsys_mutex); + kfree(p); + + return ret; +@@ -235,7 +236,7 @@ static void *part_start(struct seq_file + struct list_head *p; + loff_t l = *pos; + +- down(&block_subsys_sem); ++ mutex_lock(&block_subsys_mutex); + list_for_each(p, &block_subsys.kset.list) + if (!l--) + return list_entry(p, struct gendisk, kobj.entry); +@@ -252,7 +253,7 @@ static void *part_next(struct seq_file * + + static void part_stop(struct seq_file *part, void *v) + { +- up(&block_subsys_sem); ++ mutex_unlock(&block_subsys_mutex); + } + + static int show_partition(struct seq_file *part, void *v) +@@ -311,7 +312,7 @@ static struct kobject *base_probe(dev_t + + static int __init genhd_device_init(void) + { +- bdev_map = kobj_map_init(base_probe, &block_subsys_sem); ++ bdev_map = kobj_map_init(base_probe, &block_subsys_mutex); + blk_dev_init(); + subsystem_register(&block_subsys); + return 0; +@@ -545,7 +546,7 @@ static void *diskstats_start(struct seq_ + loff_t k = *pos; + struct list_head *p; + +- down(&block_subsys_sem); ++ mutex_lock(&block_subsys_mutex); + list_for_each(p, &block_subsys.kset.list) + if (!k--) + return list_entry(p, struct gendisk, kobj.entry); +@@ -562,7 +563,7 @@ static void *diskstats_next(struct seq_f + + static void diskstats_stop(struct seq_file *part, void *v) + { +- up(&block_subsys_sem); ++ mutex_unlock(&block_subsys_mutex); + } + + static int diskstats_show(struct seq_file *s, void *v) +--- gregkh-2.6.orig/drivers/base/attribute_container.c ++++ gregkh-2.6/drivers/base/attribute_container.c +@@ -18,6 +18,7 @@ + #include <linux/slab.h> + #include <linux/list.h> + #include <linux/module.h> ++#include <linux/mutex.h> + + #include "base.h" + +@@ -62,7 +63,7 @@ EXPORT_SYMBOL_GPL(attribute_container_cl + + static struct list_head attribute_container_list; + +-static DECLARE_MUTEX(attribute_container_mutex); ++static DEFINE_MUTEX(attribute_container_mutex); + + /** + * attribute_container_register - register an attribute container +@@ -77,9 +78,9 @@ attribute_container_register(struct attr + klist_init(&cont->containers,internal_container_klist_get, + internal_container_klist_put); + +- down(&attribute_container_mutex); ++ mutex_lock(&attribute_container_mutex); + list_add_tail(&cont->node, &attribute_container_list); +- up(&attribute_container_mutex); ++ mutex_unlock(&attribute_container_mutex); + + return 0; + } +@@ -94,7 +95,7 @@ int + attribute_container_unregister(struct attribute_container *cont) + { + int retval = -EBUSY; +- down(&attribute_container_mutex); ++ mutex_lock(&attribute_container_mutex); + spin_lock(&cont->containers.k_lock); + if (!list_empty(&cont->containers.k_list)) + goto out; +@@ -102,7 +103,7 @@ attribute_container_unregister(struct at + list_del(&cont->node); + out: + spin_unlock(&cont->containers.k_lock); +- up(&attribute_container_mutex); ++ mutex_unlock(&attribute_container_mutex); + return retval; + + } +@@ -145,7 +146,7 @@ attribute_container_add_device(struct de + { + struct attribute_container *cont; + +- down(&attribute_container_mutex); ++ mutex_lock(&attribute_container_mutex); + list_for_each_entry(cont, &attribute_container_list, node) { + struct internal_container *ic; + +@@ -173,7 +174,7 @@ attribute_container_add_device(struct de + attribute_container_add_class_device(&ic->classdev); + klist_add_tail(&ic->node, &cont->containers); + } +- up(&attribute_container_mutex); ++ mutex_unlock(&attribute_container_mutex); + } + + /* FIXME: can't break out of this unless klist_iter_exit is also +@@ -211,7 +212,7 @@ attribute_container_remove_device(struct + { + struct attribute_container *cont; + +- down(&attribute_container_mutex); ++ mutex_lock(&attribute_container_mutex); + list_for_each_entry(cont, &attribute_container_list, node) { + struct internal_container *ic; + struct klist_iter iter; +@@ -234,7 +235,7 @@ attribute_container_remove_device(struct + } + } + } +- up(&attribute_container_mutex); ++ mutex_unlock(&attribute_container_mutex); + } + EXPORT_SYMBOL_GPL(attribute_container_remove_device); + +@@ -256,7 +257,7 @@ attribute_container_device_trigger(struc + { + struct attribute_container *cont; + +- down(&attribute_container_mutex); ++ mutex_lock(&attribute_container_mutex); + list_for_each_entry(cont, &attribute_container_list, node) { + struct internal_container *ic; + struct klist_iter iter; +@@ -274,7 +275,7 @@ attribute_container_device_trigger(struc + fn(cont, dev, &ic->classdev); + } + } +- up(&attribute_container_mutex); ++ mutex_unlock(&attribute_container_mutex); + } + EXPORT_SYMBOL_GPL(attribute_container_device_trigger); + +@@ -297,12 +298,12 @@ attribute_container_trigger(struct devic + { + struct attribute_container *cont; + +- down(&attribute_container_mutex); ++ mutex_lock(&attribute_container_mutex); + list_for_each_entry(cont, &attribute_container_list, node) { + if (cont->match(cont, dev)) + fn(cont, dev); + } +- up(&attribute_container_mutex); ++ mutex_unlock(&attribute_container_mutex); + } + EXPORT_SYMBOL_GPL(attribute_container_trigger); + +--- gregkh-2.6.orig/drivers/base/bus.c ++++ gregkh-2.6/drivers/base/bus.c +@@ -153,10 +153,10 @@ static ssize_t driver_unbind(struct devi + dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); + if (dev && dev->driver == drv) { + if (dev->parent) /* Needed for USB */ +- down(&dev->parent->sem); ++ mutex_lock(&dev->parent->mutex); + device_release_driver(dev); + if (dev->parent) +- up(&dev->parent->sem); ++ mutex_unlock(&dev->parent->mutex); + err = count; + } + put_device(dev); +@@ -180,12 +180,12 @@ static ssize_t driver_bind(struct device + dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); + if (dev && dev->driver == NULL) { + if (dev->parent) /* Needed for USB */ +- down(&dev->parent->sem); +- down(&dev->sem); ++ mutex_lock(&dev->parent->mutex); ++ mutex_lock(&dev->mutex); + err = driver_probe_device(drv, dev); +- up(&dev->sem); ++ mutex_unlock(&dev->mutex); + if (dev->parent) +- up(&dev->parent->sem); ++ mutex_unlock(&dev->parent->mutex); + } + put_device(dev); + put_bus(bus); +@@ -512,10 +512,10 @@ static int bus_rescan_devices_helper(str + { + if (!dev->driver) { + if (dev->parent) /* Needed for USB */ +- down(&dev->parent->sem); ++ mutex_lock(&dev->parent->mutex); + device_attach(dev); + if (dev->parent) +- up(&dev->parent->sem); ++ mutex_unlock(&dev->parent->mutex); + } + return 0; + } +--- gregkh-2.6.orig/drivers/base/class.c ++++ gregkh-2.6/drivers/base/class.c +@@ -143,7 +143,7 @@ int class_register(struct class * cls) + + INIT_LIST_HEAD(&cls->children); + INIT_LIST_HEAD(&cls->interfaces); +- init_MUTEX(&cls->sem); ++ mutex_init(&cls->mutex); + error = kobject_set_name(&cls->subsys.kset.kobj, "%s", cls->name); + if (error) + return error; +@@ -563,12 +563,12 @@ int class_device_add(struct class_device + + /* notify any interfaces this device is now here */ + if (parent_class) { +- down(&parent_class->sem); ++ mutex_lock(&parent_class->mutex); + list_add_tail(&class_dev->node, &parent_class->children); + list_for_each_entry(class_intf, &parent_class->interfaces, node) + if (class_intf->add) + class_intf->add(class_dev, class_intf); +- up(&parent_class->sem); ++ mutex_unlock(&parent_class->mutex); + } + + register_done: +@@ -656,12 +656,12 @@ void class_device_del(struct class_devic + char *class_name = NULL; + + if (parent_class) { +- down(&parent_class->sem); ++ mutex_lock(&parent_class->mutex); + list_del_init(&class_dev->node); + list_for_each_entry(class_intf, &parent_class->interfaces, node) + if (class_intf->remove) + class_intf->remove(class_dev, class_intf); +- up(&parent_class->sem); ++ mutex_unlock(&parent_class->mutex); + } + + if (class_dev->dev) { +@@ -703,14 +703,14 @@ void class_device_destroy(struct class * + struct class_device *class_dev = NULL; + struct class_device *class_dev_tmp; + +- down(&cls->sem); ++ mutex_lock(&cls->mutex); + list_for_each_entry(class_dev_tmp, &cls->children, node) { + if (class_dev_tmp->devt == devt) { + class_dev = class_dev_tmp; + break; + } + } +- up(&cls->sem); ++ mutex_unlock(&cls->mutex); + + if (class_dev) + class_device_unregister(class_dev); +@@ -775,13 +775,13 @@ int class_interface_register(struct clas + if (!parent) + return -EINVAL; + +- down(&parent->sem); ++ mutex_lock(&parent->mutex); + list_add_tail(&class_intf->node, &parent->interfaces); + if (class_intf->add) { + list_for_each_entry(class_dev, &parent->children, node) + class_intf->add(class_dev, class_intf); + } +- up(&parent->sem); ++ mutex_unlock(&parent->mutex); + + return 0; + } +@@ -794,13 +794,13 @@ void class_interface_unregister(struct c + if (!parent) + return; + +- down(&parent->sem); ++ mutex_lock(&parent->mutex); + list_del_init(&class_intf->node); + if (class_intf->remove) { + list_for_each_entry(class_dev, &parent->children, node) + class_intf->remove(class_dev, class_intf); + } +- up(&parent->sem); ++ mutex_unlock(&parent->mutex); + + class_put(parent); + } +--- gregkh-2.6.orig/drivers/base/core.c ++++ gregkh-2.6/drivers/base/core.c +@@ -231,7 +231,7 @@ void device_initialize(struct device *de + klist_init(&dev->klist_children, klist_children_get, + klist_children_put); + INIT_LIST_HEAD(&dev->dma_pools); +- init_MUTEX(&dev->sem); ++ mutex_init(&dev->mutex); + device_init_wakeup(dev, 0); + } + +--- gregkh-2.6.orig/drivers/base/dd.c ++++ gregkh-2.6/drivers/base/dd.c +@@ -36,7 +36,7 @@ + * for before calling this. (It is ok to call with no other effort + * from a driver's probe() method.) + * +- * This function must be called with @dev->sem held. ++ * This function must be called with @dev->mutex held. + */ + void device_bind_driver(struct device * dev) + { +@@ -65,8 +65,8 @@ void device_bind_driver(struct device * + * This function returns 1 if a match is found, an error if one + * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise. + * +- * This function must be called with @dev->sem held. When called +- * for a USB interface, @dev->parent->sem must be held as well. ++ * This function must be called with @dev->mutex held. When called ++ * for a USB interface, @dev->parent->mutex must be held as well. + */ + int driver_probe_device(struct device_driver * drv, struct device * dev) + { +@@ -131,19 +131,19 @@ static int __device_attach(struct device + * Returns 1 if the device was bound to a driver; + * 0 if no matching device was found; error code otherwise. + * +- * When called for a USB interface, @dev->parent->sem must be held. ++ * When called for a USB interface, @dev->parent->mutex must be held. + */ + int device_attach(struct device * dev) + { + int ret = 0; + +- down(&dev->sem); ++ mutex_lock(&dev->mutex); + if (dev->driver) { + device_bind_driver(dev); + ret = 1; + } else + ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); +- up(&dev->sem); ++ mutex_unlock(&dev->mutex); + return ret; + } + +@@ -162,13 +162,13 @@ static int __driver_attach(struct device + */ + + if (dev->parent) /* Needed for USB */ +- down(&dev->parent->sem); +- down(&dev->sem); ++ mutex_lock(&dev->parent->mutex); ++ mutex_lock(&dev->mutex); + if (!dev->driver) + driver_probe_device(drv, dev); +- up(&dev->sem); ++ mutex_unlock(&dev->mutex); + if (dev->parent) +- up(&dev->parent->sem); ++ mutex_unlock(&dev->parent->mutex); + + return 0; + } +@@ -193,8 +193,8 @@ void driver_attach(struct device_driver + * + * Manually detach device from driver. + * +- * __device_release_driver() must be called with @dev->sem held. +- * When called for a USB interface, @dev->parent->sem must be held ++ * __device_release_driver() must be called with @dev->mutex held. ++ * When called for a USB interface, @dev->parent->mutex must be held + * as well. + */ + +@@ -225,9 +225,9 @@ void device_release_driver(struct device + * within their ->remove callback for the same device, they + * will deadlock right here. + */ +- down(&dev->sem); ++ mutex_lock(&dev->mutex); + __device_release_driver(dev); +- up(&dev->sem); ++ mutex_unlock(&dev->mutex); + } + + +@@ -251,13 +251,13 @@ void driver_detach(struct device_driver + spin_unlock(&drv->klist_devices.k_lock); + + if (dev->parent) /* Needed for USB */ +- down(&dev->parent->sem); +- down(&dev->sem); ++ mutex_lock(&dev->parent->mutex); ++ mutex_lock(&dev->mutex); + if (dev->driver == drv) + __device_release_driver(dev); +- up(&dev->sem); ++ mutex_unlock(&dev->mutex); + if (dev->parent) +- up(&dev->parent->sem); ++ mutex_unlock(&dev->parent->mutex); + put_device(dev); + } + } +--- gregkh-2.6.orig/drivers/base/dmapool.c ++++ gregkh-2.6/drivers/base/dmapool.c +@@ -7,6 +7,7 @@ + #include <linux/dmapool.h> + #include <linux/slab.h> + #include <linux/module.h> ++#include <linux/mutex.h> + + /* + * Pool allocator ... wraps the dma_alloc_coherent page allocator, so +@@ -38,7 +39,7 @@ struct dma_page { /* cacheable header fo + #define POOL_POISON_FREED 0xa7 /* !inuse */ + #define POOL_POISON_ALLOCATED 0xa9 /* !initted */ + +-static DECLARE_MUTEX (pools_lock); ++static DEFINE_MUTEX(pools_lock); + + static ssize_t + show_pools (struct device *dev, struct device_attribute *attr, char *buf) +@@ -56,7 +57,7 @@ show_pools (struct device *dev, struct d + size -= temp; + next += temp; + +- down (&pools_lock); ++ mutex_lock(&pools_lock); + list_for_each_entry(pool, &dev->dma_pools, pools) { + unsigned pages = 0; + unsigned blocks = 0; +@@ -74,7 +75,7 @@ show_pools (struct device *dev, struct d + size -= temp; + next += temp; + } +- up (&pools_lock); ++ mutex_unlock(&pools_lock); + + return PAGE_SIZE - size; + } +@@ -142,12 +143,12 @@ dma_pool_create (const char *name, struc + init_waitqueue_head (&retval->waitq); + + if (dev) { +- down (&pools_lock); ++ mutex_lock(&pools_lock); + if (list_empty (&dev->dma_pools)) + device_create_file (dev, &dev_attr_pools); + /* note: not currently insisting "name" be unique */ + list_add (&retval->pools, &dev->dma_pools); +- up (&pools_lock); ++ mutex_unlock(&pools_lock); + } else + INIT_LIST_HEAD (&retval->pools); + +@@ -223,11 +224,11 @@ pool_free_page (struct dma_pool *pool, s + void + dma_pool_destroy (struct dma_pool *pool) + { +- down (&pools_lock); ++ mutex_lock(&pools_lock); + list_del (&pool->pools); + if (pool->dev && list_empty (&pool->dev->dma_pools)) + device_remove_file (pool->dev, &dev_attr_pools); +- up (&pools_lock); ++ mutex_unlock(&pools_lock); + + while (!list_empty (&pool->page_list)) { + struct dma_page *page; +--- gregkh-2.6.orig/drivers/base/firmware_class.c ++++ gregkh-2.6/drivers/base/firmware_class.c +@@ -14,6 +14,7 @@ + #include <linux/vmalloc.h> + #include <linux/interrupt.h> + #include <linux/bitops.h> ++#include <linux/mutex.h> + #include <asm/semaphore.h> + + #include <linux/firmware.h> +@@ -35,7 +36,7 @@ static int loading_timeout = 10; /* In s + + /* fw_lock could be moved to 'struct firmware_priv' but since it is just + * guarding for corner cases a global lock should be OK */ +-static DECLARE_MUTEX(fw_lock); ++static DEFINE_MUTEX(fw_lock); + + struct firmware_priv { + char fw_id[FIRMWARE_NAME_MAX]; +@@ -144,9 +145,9 @@ firmware_loading_store(struct class_devi + + switch (loading) { + case 1: +- down(&fw_lock); ++ mutex_lock(&fw_lock); + if (!fw_priv->fw) { +- up(&fw_lock); ++ mutex_unlock(&fw_lock); + break; + } + vfree(fw_priv->fw->data); +@@ -154,7 +155,7 @@ firmware_loading_store(struct class_devi + fw_priv->fw->size = 0; + fw_priv->alloc_size = 0; + set_bit(FW_STATUS_LOADING, &fw_priv->status); +- up(&fw_lock); ++ mutex_unlock(&fw_lock); + break; + case 0: + if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) { +@@ -187,7 +188,7 @@ firmware_data_read(struct kobject *kobj, + struct firmware *fw; + ssize_t ret_count = count; + +- down(&fw_lock); ++ mutex_lock(&fw_lock); + fw = fw_priv->fw; + if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { + ret_count = -ENODEV; +@@ -202,7 +203,7 @@ firmware_data_read(struct kobject *kobj, + + memcpy(buffer, fw->data + offset, ret_count); + out: +- up(&fw_lock); ++ mutex_unlock(&fw_lock); + return ret_count; + } + +@@ -253,7 +254,7 @@ firmware_data_write(struct kobject *kobj + if (!capable(CAP_SYS_RAWIO)) + return -EPERM; + +- down(&fw_lock); ++ mutex_lock(&fw_lock); + fw = fw_priv->fw; + if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { + retval = -ENODEV; +@@ -268,7 +269,7 @@ firmware_data_write(struct kobject *kobj + fw->size = max_t(size_t, offset + count, fw->size); + retval = count; + out: +- up(&fw_lock); ++ mutex_unlock(&fw_lock); + return retval; + } + +@@ -436,14 +437,14 @@ _request_firmware(const struct firmware + } else + wait_for_completion(&fw_priv->completion); + +- down(&fw_lock); ++ mutex_lock(&fw_lock); + if (!fw_priv->fw->size || test_bit(FW_STATUS_ABORT, &fw_priv->status)) { + retval = -ENOENT; + release_firmware(fw_priv->fw); + *firmware_p = NULL; + } + fw_priv->fw = NULL; +- up(&fw_lock); ++ mutex_unlock(&fw_lock); + class_device_unregister(class_dev); + goto out; + +--- gregkh-2.6.orig/drivers/base/map.c ++++ gregkh-2.6/drivers/base/map.c +@@ -25,7 +25,7 @@ struct kobj_map { + int (*lock)(dev_t, void *); + void *data; + } *probes[255]; +- struct semaphore *sem; ++ struct mutex *mutex; + }; + + int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range, +@@ -53,7 +53,7 @@ int kobj_map(struct kobj_map *domain, de + p->range = range; + p->data = data; + } +- down(domain->sem); ++ mutex_lock(domain->mutex); + for (i = 0, p -= n; i < n; i++, p++, index++) { + struct probe **s = &domain->probes[index % 255]; + while (*s && (*s)->range < range) +@@ -61,7 +61,7 @@ int kobj_map(struct kobj_map *domain, de + p->next = *s; + *s = p; + } +- up(domain->sem); ++ mutex_unlock(domain->mutex); + return 0; + } + +@@ -75,7 +75,7 @@ void kobj_unmap(struct kobj_map *domain, + if (n > 255) + n = 255; + +- down(domain->sem); ++ mutex_lock(domain->mutex); + for (i = 0; i < n; i++, index++) { + struct probe **s; + for (s = &domain->probes[index % 255]; *s; s = &(*s)->next) { +@@ -88,7 +88,7 @@ void kobj_unmap(struct kobj_map *domain, + } + } + } +- up(domain->sem); ++ mutex_unlock(domain->mutex); + kfree(found); + } + +@@ -99,7 +99,7 @@ struct kobject *kobj_lookup(struct kobj_ + unsigned long best = ~0UL; + + retry: +- down(domain->sem); ++ mutex_lock(domain->mutex); + for (p = domain->probes[MAJOR(dev) % 255]; p; p = p->next) { + struct kobject *(*probe)(dev_t, int *, void *); + struct module *owner; +@@ -120,7 +120,7 @@ retry: + module_put(owner); + continue; + } +- up(domain->sem); ++ mutex_unlock(domain->mutex); + kobj = probe(dev, index, data); + /* Currently ->owner protects _only_ ->probe() itself. */ + module_put(owner); +@@ -128,11 +128,11 @@ retry: + return kobj; + goto retry; + } +- up(domain->sem); ++ mutex_unlock(domain->mutex); + return NULL; + } + +-struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct semaphore *sem) ++struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct mutex *mutex) + { + struct kobj_map *p = kmalloc(sizeof(struct kobj_map), GFP_KERNEL); + struct probe *base = kzalloc(sizeof(*base), GFP_KERNEL); +@@ -149,6 +149,6 @@ struct kobj_map *kobj_map_init(kobj_prob + base->get = base_probe; + for (i = 0; i < 255; i++) + p->probes[i] = base; +- p->sem = sem; ++ p->mutex = mutex; + return p; + } +--- gregkh-2.6.orig/drivers/base/memory.c ++++ gregkh-2.6/drivers/base/memory.c +@@ -213,7 +213,7 @@ static int memory_block_change_state(str + unsigned long to_state, unsigned long from_state_req) + { + int ret = 0; +- down(&mem->state_sem); ++ mutex_lock(&mem->state_mutex); + + if (mem->state != from_state_req) { + ret = -EINVAL; +@@ -225,7 +225,7 @@ static int memory_block_change_state(str + mem->state = to_state; + + out: +- up(&mem->state_sem); ++ mutex_unlock(&mem->state_mutex); + return ret; + } + +@@ -346,7 +346,7 @@ static int add_memory_block(unsigned lon + + mem->phys_index = __section_nr(section); + mem->state = state; +- init_MUTEX(&mem->state_sem); ++ mutex_init(&mem->state_mutex); + mem->phys_device = phys_device; + + ret = register_memory(mem, section, NULL); +--- gregkh-2.6.orig/drivers/base/power/resume.c ++++ gregkh-2.6/drivers/base/power/resume.c +@@ -24,7 +24,7 @@ int resume_device(struct device * dev) + { + int error = 0; + +- down(&dev->sem); ++ mutex_lock(&dev->mutex); + if (dev->power.pm_parent + && dev->power.pm_parent->power.power_state.event) { + dev_err(dev, "PM: resume from %d, parent %s still %d\n", +@@ -36,7 +36,7 @@ int resume_device(struct device * dev) + dev_dbg(dev,"resuming\n"); + error = dev->bus->resume(dev); + } +- up(&dev->sem); ++ mutex_unlock(&dev->mutex); + return error; + } + +--- gregkh-2.6.orig/drivers/base/power/suspend.c ++++ gregkh-2.6/drivers/base/power/suspend.c +@@ -39,7 +39,7 @@ int suspend_device(struct device * dev, + { + int error = 0; + +- down(&dev->sem); ++ mutex_lock(&dev->mutex); + if (dev->power.power_state.event) { + dev_dbg(dev, "PM: suspend %d-->%d\n", + dev->power.power_state.event, state.event); +@@ -59,7 +59,7 @@ int suspend_device(struct device * dev, + dev_dbg(dev, "suspending\n"); + error = dev->bus->suspend(dev, state); + } +- up(&dev->sem); ++ mutex_unlock(&dev->mutex); + return error; + } + +--- gregkh-2.6.orig/drivers/base/sys.c ++++ gregkh-2.6/drivers/base/sys.c +@@ -21,6 +21,7 @@ + #include <linux/slab.h> + #include <linux/string.h> + #include <linux/pm.h> ++#include <linux/mutex.h> + #include <asm/semaphore.h> + + extern struct subsystem devices_subsys; +@@ -104,7 +105,7 @@ EXPORT_SYMBOL_GPL(sysdev_class_unregiste + + + static LIST_HEAD(sysdev_drivers); +-static DECLARE_MUTEX(sysdev_drivers_lock); ++static DEFINE_MUTEX(sysdev_drivers_lock); + + /** + * sysdev_driver_register - Register auxillary driver +@@ -121,7 +122,7 @@ static DECLARE_MUTEX(sysdev_drivers_lock + int sysdev_driver_register(struct sysdev_class * cls, + struct sysdev_driver * drv) + { +- down(&sysdev_drivers_lock); ++ mutex_lock(&sysdev_drivers_lock); + if (cls && kset_get(&cls->kset)) { + list_add_tail(&drv->entry, &cls->drivers); + +@@ -133,7 +134,7 @@ int sysdev_driver_register(struct sysdev + } + } else + list_add_tail(&drv->entry, &sysdev_drivers); +- up(&sysdev_drivers_lock); ++ mutex_unlock(&sysdev_drivers_lock); + return 0; + } + +@@ -146,7 +147,7 @@ int sysdev_driver_register(struct sysdev + void sysdev_driver_unregister(struct sysdev_class * cls, + struct sysdev_driver * drv) + { +- down(&sysdev_drivers_lock); ++ mutex_lock(&sysdev_drivers_lock); + list_del_init(&drv->entry); + if (cls) { + if (drv->remove) { +@@ -156,7 +157,7 @@ void sysdev_driver_unregister(struct sys + } + kset_put(&cls->kset); + } +- up(&sysdev_drivers_lock); ++ mutex_unlock(&sysdev_drivers_lock); + } + + EXPORT_SYMBOL_GPL(sysdev_driver_register); +@@ -195,7 +196,7 @@ int sysdev_register(struct sys_device * + if (!error) { + struct sysdev_driver * drv; + +- down(&sysdev_drivers_lock); ++ mutex_lock(&sysdev_drivers_lock); + /* Generic notification is implicit, because it's that + * code that should have called us. + */ +@@ -211,7 +212,7 @@ int sysdev_register(struct sys_device * + if (drv->add) + drv->add(sysdev); + } +- up(&sysdev_drivers_lock); ++ mutex_unlock(&sysdev_drivers_lock); + } + return error; + } +@@ -220,7 +221,7 @@ void sysdev_unregister(struct sys_device + { + struct sysdev_driver * drv; + +- down(&sysdev_drivers_lock); ++ mutex_lock(&sysdev_drivers_lock); + list_for_each_entry(drv, &sysdev_drivers, entry) { + if (drv->remove) + drv->remove(sysdev); +@@ -230,7 +231,7 @@ void sysdev_unregister(struct sys_device + if (drv->remove) + drv->remove(sysdev); + } +- up(&sysdev_drivers_lock); ++ mutex_unlock(&sysdev_drivers_lock); + + kobject_unregister(&sysdev->kobj); + } +@@ -257,7 +258,7 @@ void sysdev_shutdown(void) + + pr_debug("Shutting Down System Devices\n"); + +- down(&sysdev_drivers_lock); ++ mutex_lock(&sysdev_drivers_lock); + list_for_each_entry_reverse(cls, &system_subsys.kset.list, + kset.kobj.entry) { + struct sys_device * sysdev; +@@ -286,7 +287,7 @@ void sysdev_shutdown(void) + cls->shutdown(sysdev); + } + } +- up(&sysdev_drivers_lock); ++ mutex_unlock(&sysdev_drivers_lock); + } + + static void __sysdev_resume(struct sys_device *dev) +--- gregkh-2.6.orig/drivers/usb/core/devio.c ++++ gregkh-2.6/drivers/usb/core/devio.c +@@ -522,14 +522,14 @@ static struct usb_device *usbdev_lookup_ + struct class_device *class_dev; + struct usb_device *dev = NULL; + +- down(&usb_device_class->sem); ++ mutex_lock(&usb_device_class->mutex); + list_for_each_entry(class_dev, &usb_device_class->children, node) { + if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) { + dev = class_dev->class_data; + break; + } + } +- up(&usb_device_class->sem); ++ mutex_unlock(&usb_device_class->mutex); + + return dev; + }; +--- gregkh-2.6.orig/fs/char_dev.c ++++ gregkh-2.6/fs/char_dev.c +@@ -9,6 +9,7 @@ + #include <linux/fs.h> + #include <linux/slab.h> + #include <linux/string.h> ++#include <linux/mutex.h> + + #include <linux/major.h> + #include <linux/errno.h> +@@ -28,7 +29,7 @@ static struct kobj_map *cdev_map; + + #define MAX_PROBE_HASH 255 /* random */ + +-static DECLARE_MUTEX(chrdevs_lock); ++static DEFINE_MUTEX(chrdevs_lock); + + static struct char_device_struct { + struct char_device_struct *next; +@@ -54,7 +55,7 @@ int get_chrdev_list(char *page) + + len = sprintf(page, "Character devices:\n"); + +- down(&chrdevs_lock); ++ mutex_lock(&chrdevs_lock); + for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) { + for (cd = chrdevs[i]; cd; cd = cd->next) { + /* +@@ -71,7 +72,7 @@ int get_chrdev_list(char *page) + } + } + page_full: +- up(&chrdevs_lock); ++ mutex_unlock(&chrdevs_lock); + + return len; + } +@@ -101,7 +102,7 @@ __register_chrdev_region(unsigned int ma + + memset(cd, 0, sizeof(struct char_device_struct)); + +- down(&chrdevs_lock); ++ mutex_lock(&chrdevs_lock); + + /* temporary */ + if (major == 0) { +@@ -136,10 +137,10 @@ __register_chrdev_region(unsigned int ma + } + cd->next = *cp; + *cp = cd; +- up(&chrdevs_lock); ++ mutex_unlock(&chrdevs_lock); + return cd; + out: +- up(&chrdevs_lock); ++ mutex_unlock(&chrdevs_lock); + kfree(cd); + return ERR_PTR(ret); + } +@@ -150,7 +151,7 @@ __unregister_chrdev_region(unsigned majo + struct char_device_struct *cd = NULL, **cp; + int i = major_to_index(major); + +- down(&chrdevs_lock); ++ mutex_lock(&chrdevs_lock); + for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next) + if ((*cp)->major == major && + (*cp)->baseminor == baseminor && +@@ -160,7 +161,7 @@ __unregister_chrdev_region(unsigned majo + cd = *cp; + *cp = cd->next; + } +- up(&chrdevs_lock); ++ mutex_unlock(&chrdevs_lock); + return cd; + } + +--- gregkh-2.6.orig/include/linux/device.h ++++ gregkh-2.6/include/linux/device.h +@@ -18,6 +18,7 @@ + #include <linux/list.h> + #include <linux/types.h> + #include <linux/module.h> ++#include <linux/mutex.h> + #include <linux/pm.h> + #include <asm/semaphore.h> + #include <asm/atomic.h> +@@ -149,7 +150,7 @@ struct class { + struct subsystem subsys; + struct list_head children; + struct list_head interfaces; +- struct semaphore sem; /* locks both the children and interfaces lists */ ++ struct mutex mutex; /* locks both the children and interfaces lists */ + + struct class_attribute * class_attrs; + struct class_device_attribute * class_dev_attrs; +@@ -313,7 +314,7 @@ struct device { + char bus_id[BUS_ID_SIZE]; /* position on parent bus */ + struct device_attribute uevent_attr; + +- struct semaphore sem; /* semaphore to synchronize calls to ++ struct mutex mutex; /* semaphore to synchronize calls to + * its driver. + */ + +--- gregkh-2.6.orig/include/linux/kobj_map.h ++++ gregkh-2.6/include/linux/kobj_map.h +@@ -1,6 +1,6 @@ + #ifdef __KERNEL__ + +-#include <asm/semaphore.h> ++#include <linux/mutex.h> + + typedef struct kobject *kobj_probe_t(dev_t, int *, void *); + struct kobj_map; +@@ -9,6 +9,6 @@ int kobj_map(struct kobj_map *, dev_t, u + kobj_probe_t *, int (*)(dev_t, void *), void *); + void kobj_unmap(struct kobj_map *, dev_t, unsigned long); + struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); +-struct kobj_map *kobj_map_init(kobj_probe_t *, struct semaphore *); ++struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); + + #endif +--- gregkh-2.6.orig/include/linux/memory.h ++++ gregkh-2.6/include/linux/memory.h +@@ -18,8 +18,7 @@ + #include <linux/sysdev.h> + #include <linux/node.h> + #include <linux/compiler.h> +- +-#include <asm/semaphore.h> ++#include <linux/mutex.h> + + struct memory_block { + unsigned long phys_index; +@@ -30,7 +29,7 @@ struct memory_block { + * created long after the critical areas during + * initialization. + */ +- struct semaphore state_sem; ++ struct mutex state_mutex; + int phys_device; /* to which fru does this belong? */ + void *hw; /* optional pointer to fw/hw data */ + int (*phys_callback)(struct memory_block *); +--- gregkh-2.6.orig/drivers/usb/core/hub.c ++++ gregkh-2.6/drivers/usb/core/hub.c +@@ -32,8 +32,8 @@ + #include "hub.h" + + /* Protect struct usb_device->state and ->children members +- * Note: Both are also protected by ->dev.sem, except that ->state can +- * change to USB_STATE_NOTATTACHED even when the semaphore isn't held. */ ++ * Note: Both are also protected by ->dev.mutex, except that ->state can ++ * change to USB_STATE_NOTATTACHED even when the mutex isn't held. */ + static DEFINE_SPINLOCK(device_state_lock); + + /* khubd's worklist and its lock */ +@@ -1785,9 +1785,9 @@ static int finish_device_resume(struct u + struct device *dev = + &udev->actconfig->interface[i]->dev; + +- down(&dev->sem); ++ mutex_lock(&dev->mutex); + (void) resume(dev); +- up(&dev->sem); ++ mutex_unlock(&dev->mutex); + } + status = 0; + +--- gregkh-2.6.orig/include/linux/usb.h ++++ gregkh-2.6/include/linux/usb.h +@@ -379,9 +379,9 @@ extern struct usb_device *usb_get_dev(st + extern void usb_put_dev(struct usb_device *dev); + + /* USB device locking */ +-#define usb_lock_device(udev) down(&(udev)->dev.sem) +-#define usb_unlock_device(udev) up(&(udev)->dev.sem) +-#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) ++#define usb_lock_device(udev) mutex_lock(&(udev)->dev.mutex) ++#define usb_unlock_device(udev) mutex_unlock(&(udev)->dev.mutex) ++#define usb_trylock_device(udev) mutex_trylock(&(udev)->dev.mutex) + extern int usb_lock_device_for_reset(struct usb_device *udev, + struct usb_interface *iface); + diff --git a/driver/spi-add-spi_bitbang-driver.patch b/driver/spi-add-spi_bitbang-driver.patch index a8ea669af707e..93cc235c3c646 100644 --- a/driver/spi-add-spi_bitbang-driver.patch +++ b/driver/spi-add-spi_bitbang-driver.patch @@ -45,7 +45,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- gregkh-2.6.orig/drivers/spi/Kconfig +++ gregkh-2.6/drivers/spi/Kconfig -@@ -66,6 +66,19 @@ config SPI_MASTER +@@ -51,6 +51,19 @@ config SPI_MASTER comment "SPI Master Controller Drivers" depends on SPI_MASTER diff --git a/driver/spi-misc-fixes.patch b/driver/spi-misc-fixes.patch index f6abb373da270..451b2d6afa3b4 100644 --- a/driver/spi-misc-fixes.patch +++ b/driver/spi-misc-fixes.patch @@ -89,7 +89,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- gregkh-2.6.orig/drivers/spi/Kconfig +++ gregkh-2.6/drivers/spi/Kconfig -@@ -80,6 +80,16 @@ config SPI_BITBANG +@@ -65,6 +65,16 @@ config SPI_BITBANG need it. You only need to select this explicitly to support driver modules that aren't part of this kernel tree. |