summaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-10-05 10:37:11 +0200
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-03-24 20:56:37 +0100
commitd67cfb9613f373d76daa2c8d209629601424ca12 (patch)
tree64d5633a8531fd1b978bef2104c6eee5303d3d8c /drivers/firewire
parentcf417e5494582453c033d8cac9e1352e74215435 (diff)
downloadlinux-d67cfb9613f373d76daa2c8d209629601424ca12.tar.gz
linux-d67cfb9613f373d76daa2c8d209629601424ca12.tar.bz2
linux-d67cfb9613f373d76daa2c8d209629601424ca12.zip
firewire: convert client_list_lock to mutex
So far it is only taken in non-atomic contexts. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-cdev.c20
-rw-r--r--drivers/firewire/fw-device.c3
-rw-r--r--drivers/firewire/fw-device.h7
3 files changed, 14 insertions, 16 deletions
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index 40cc9732dc28..75bbd66f852e 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -24,6 +24,7 @@
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/vmalloc.h>
+#include <linux/mutex.h>
#include <linux/poll.h>
#include <linux/preempt.h>
#include <linux/time.h>
@@ -108,7 +109,6 @@ static int fw_device_op_open(struct inode *inode, struct file *file)
{
struct fw_device *device;
struct client *client;
- unsigned long flags;
device = fw_device_get_by_devt(inode->i_rdev);
if (device == NULL)
@@ -133,9 +133,9 @@ static int fw_device_op_open(struct inode *inode, struct file *file)
file->private_data = client;
- spin_lock_irqsave(&device->client_list_lock, flags);
+ mutex_lock(&device->client_list_mutex);
list_add_tail(&client->link, &device->client_list);
- spin_unlock_irqrestore(&device->client_list_lock, flags);
+ mutex_unlock(&device->client_list_mutex);
return 0;
}
@@ -232,14 +232,11 @@ for_each_client(struct fw_device *device,
void (*callback)(struct client *client))
{
struct client *c;
- unsigned long flags;
-
- spin_lock_irqsave(&device->client_list_lock, flags);
+ mutex_lock(&device->client_list_mutex);
list_for_each_entry(c, &device->client_list, link)
callback(c);
-
- spin_unlock_irqrestore(&device->client_list_lock, flags);
+ mutex_unlock(&device->client_list_mutex);
}
static void
@@ -247,7 +244,7 @@ queue_bus_reset_event(struct client *client)
{
struct bus_reset *bus_reset;
- bus_reset = kzalloc(sizeof(*bus_reset), GFP_ATOMIC);
+ bus_reset = kzalloc(sizeof(*bus_reset), GFP_KERNEL);
if (bus_reset == NULL) {
fw_notify("Out of memory when allocating bus reset event\n");
return;
@@ -988,7 +985,6 @@ static int fw_device_op_release(struct inode *inode, struct file *file)
struct client *client = file->private_data;
struct event *e, *next_e;
struct client_resource *r, *next_r;
- unsigned long flags;
if (client->buffer.pages)
fw_iso_buffer_destroy(&client->buffer, client->device->card);
@@ -1007,9 +1003,9 @@ static int fw_device_op_release(struct inode *inode, struct file *file)
list_for_each_entry_safe(e, next_e, &client->event_list, link)
kfree(e);
- spin_lock_irqsave(&client->device->client_list_lock, flags);
+ mutex_lock(&client->device->client_list_mutex);
list_del(&client->link);
- spin_unlock_irqrestore(&client->device->client_list_lock, flags);
+ mutex_unlock(&client->device->client_list_mutex);
fw_device_put(client->device);
kfree(client);
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index ffde1bed46b2..2de3dd5ebc4b 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -27,6 +27,7 @@
#include <linux/idr.h>
#include <linux/jiffies.h>
#include <linux/string.h>
+#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/semaphore.h>
#include <linux/spinlock.h>
@@ -1005,7 +1006,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
device->node = fw_node_get(node);
device->node_id = node->node_id;
device->generation = card->generation;
- spin_lock_init(&device->client_list_lock);
+ mutex_init(&device->client_list_mutex);
INIT_LIST_HEAD(&device->client_list);
/*
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h
index 008a7908a865..655d7e838012 100644
--- a/drivers/firewire/fw-device.h
+++ b/drivers/firewire/fw-device.h
@@ -23,7 +23,7 @@
#include <linux/cdev.h>
#include <linux/idr.h>
#include <linux/rwsem.h>
-#include <linux/spinlock.h>
+#include <linux/mutex.h>
#include <asm/atomic.h>
enum fw_device_state {
@@ -65,9 +65,10 @@ struct fw_device {
bool cmc;
struct fw_card *card;
struct device device;
- /* to prevent deadlocks, never take this lock with card->lock held */
- spinlock_t client_list_lock;
+
+ struct mutex client_list_mutex;
struct list_head client_list;
+
u32 *config_rom;
size_t config_rom_length;
int config_rom_retries;