Commit 3ba94986 authored by Stefan Richter's avatar Stefan Richter

firewire: cdev: replace some spin_lock_irqsave by spin_lock_irq

All of these functions are entered with IRQs enabled.
Hence the unconditional spin_unlock_irq can be used.

Function:                  Caller context:
    dequeue_event()            client process, via read(2)
    fill_bus_reset_event()     fw-device.c update worqueue job
    release_client_resource()  client process, via ioctl(2)
    fw_device_op_release()     client process, via close(2)
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 5d3fd692
...@@ -237,7 +237,6 @@ static void queue_event(struct client *client, struct event *event, ...@@ -237,7 +237,6 @@ static void queue_event(struct client *client, struct event *event,
static int dequeue_event(struct client *client, static int dequeue_event(struct client *client,
char __user *buffer, size_t count) char __user *buffer, size_t count)
{ {
unsigned long flags;
struct event *event; struct event *event;
size_t size, total; size_t size, total;
int i, ret; int i, ret;
...@@ -252,10 +251,10 @@ static int dequeue_event(struct client *client, ...@@ -252,10 +251,10 @@ static int dequeue_event(struct client *client,
fw_device_is_shutdown(client->device)) fw_device_is_shutdown(client->device))
return -ENODEV; return -ENODEV;
spin_lock_irqsave(&client->lock, flags); spin_lock_irq(&client->lock);
event = list_first_entry(&client->event_list, struct event, link); event = list_first_entry(&client->event_list, struct event, link);
list_del(&event->link); list_del(&event->link);
spin_unlock_irqrestore(&client->lock, flags); spin_unlock_irq(&client->lock);
total = 0; total = 0;
for (i = 0; i < ARRAY_SIZE(event->v) && total < count; i++) { for (i = 0; i < ARRAY_SIZE(event->v) && total < count; i++) {
...@@ -286,9 +285,8 @@ static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, ...@@ -286,9 +285,8 @@ static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event,
struct client *client) struct client *client)
{ {
struct fw_card *card = client->device->card; struct fw_card *card = client->device->card;
unsigned long flags;
spin_lock_irqsave(&card->lock, flags); spin_lock_irq(&card->lock);
event->closure = client->bus_reset_closure; event->closure = client->bus_reset_closure;
event->type = FW_CDEV_EVENT_BUS_RESET; event->type = FW_CDEV_EVENT_BUS_RESET;
...@@ -299,7 +297,7 @@ static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, ...@@ -299,7 +297,7 @@ static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event,
event->irm_node_id = card->irm_node->node_id; event->irm_node_id = card->irm_node->node_id;
event->root_node_id = card->root_node->node_id; event->root_node_id = card->root_node->node_id;
spin_unlock_irqrestore(&card->lock, flags); spin_unlock_irq(&card->lock);
} }
static void for_each_client(struct fw_device *device, static void for_each_client(struct fw_device *device,
...@@ -432,16 +430,15 @@ static int release_client_resource(struct client *client, u32 handle, ...@@ -432,16 +430,15 @@ static int release_client_resource(struct client *client, u32 handle,
struct client_resource **resource) struct client_resource **resource)
{ {
struct client_resource *r; struct client_resource *r;
unsigned long flags;
spin_lock_irqsave(&client->lock, flags); spin_lock_irq(&client->lock);
if (client->in_shutdown) if (client->in_shutdown)
r = NULL; r = NULL;
else else
r = idr_find(&client->resource_idr, handle); r = idr_find(&client->resource_idr, handle);
if (r && r->release == release) if (r && r->release == release)
idr_remove(&client->resource_idr, handle); idr_remove(&client->resource_idr, handle);
spin_unlock_irqrestore(&client->lock, flags); spin_unlock_irq(&client->lock);
if (!(r && r->release == release)) if (!(r && r->release == release))
return -EINVAL; return -EINVAL;
...@@ -1384,7 +1381,6 @@ static int fw_device_op_release(struct inode *inode, struct file *file) ...@@ -1384,7 +1381,6 @@ static int fw_device_op_release(struct inode *inode, struct file *file)
{ {
struct client *client = file->private_data; struct client *client = file->private_data;
struct event *e, *next_e; struct event *e, *next_e;
unsigned long flags;
mutex_lock(&client->device->client_list_mutex); mutex_lock(&client->device->client_list_mutex);
list_del(&client->link); list_del(&client->link);
...@@ -1397,9 +1393,9 @@ static int fw_device_op_release(struct inode *inode, struct file *file) ...@@ -1397,9 +1393,9 @@ static int fw_device_op_release(struct inode *inode, struct file *file)
fw_iso_context_destroy(client->iso_context); fw_iso_context_destroy(client->iso_context);
/* Freeze client->resource_idr and client->event_list */ /* Freeze client->resource_idr and client->event_list */
spin_lock_irqsave(&client->lock, flags); spin_lock_irq(&client->lock);
client->in_shutdown = true; client->in_shutdown = true;
spin_unlock_irqrestore(&client->lock, flags); spin_unlock_irq(&client->lock);
idr_for_each(&client->resource_idr, shutdown_resource, client); idr_for_each(&client->resource_idr, shutdown_resource, client);
idr_remove_all(&client->resource_idr); idr_remove_all(&client->resource_idr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment