diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-01-04 10:23:29 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-03-24 15:56:45 -0400 |
commit | 3ba949868a6dc082b24cba5c3bf3f50de7391433 (patch) | |
tree | 67111ee78f57bae142182a43b5193802c1183d22 /drivers/firewire | |
parent | 5d3fd692a7196a9045fb606f891f5987959b65a0 (diff) |
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: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/fw-cdev.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index 6b33f15584cb..3d816a6395cd 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -237,7 +237,6 @@ static void queue_event(struct client *client, struct event *event, | |||
237 | static int dequeue_event(struct client *client, | 237 | static int dequeue_event(struct client *client, |
238 | char __user *buffer, size_t count) | 238 | char __user *buffer, size_t count) |
239 | { | 239 | { |
240 | unsigned long flags; | ||
241 | struct event *event; | 240 | struct event *event; |
242 | size_t size, total; | 241 | size_t size, total; |
243 | int i, ret; | 242 | int i, ret; |
@@ -252,10 +251,10 @@ static int dequeue_event(struct client *client, | |||
252 | fw_device_is_shutdown(client->device)) | 251 | fw_device_is_shutdown(client->device)) |
253 | return -ENODEV; | 252 | return -ENODEV; |
254 | 253 | ||
255 | spin_lock_irqsave(&client->lock, flags); | 254 | spin_lock_irq(&client->lock); |
256 | event = list_first_entry(&client->event_list, struct event, link); | 255 | event = list_first_entry(&client->event_list, struct event, link); |
257 | list_del(&event->link); | 256 | list_del(&event->link); |
258 | spin_unlock_irqrestore(&client->lock, flags); | 257 | spin_unlock_irq(&client->lock); |
259 | 258 | ||
260 | total = 0; | 259 | total = 0; |
261 | for (i = 0; i < ARRAY_SIZE(event->v) && total < count; i++) { | 260 | 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 | struct client *client) | 285 | struct client *client) |
287 | { | 286 | { |
288 | struct fw_card *card = client->device->card; | 287 | struct fw_card *card = client->device->card; |
289 | unsigned long flags; | ||
290 | 288 | ||
291 | spin_lock_irqsave(&card->lock, flags); | 289 | spin_lock_irq(&card->lock); |
292 | 290 | ||
293 | event->closure = client->bus_reset_closure; | 291 | event->closure = client->bus_reset_closure; |
294 | event->type = FW_CDEV_EVENT_BUS_RESET; | 292 | 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 | event->irm_node_id = card->irm_node->node_id; | 297 | event->irm_node_id = card->irm_node->node_id; |
300 | event->root_node_id = card->root_node->node_id; | 298 | event->root_node_id = card->root_node->node_id; |
301 | 299 | ||
302 | spin_unlock_irqrestore(&card->lock, flags); | 300 | spin_unlock_irq(&card->lock); |
303 | } | 301 | } |
304 | 302 | ||
305 | static void for_each_client(struct fw_device *device, | 303 | static void for_each_client(struct fw_device *device, |
@@ -432,16 +430,15 @@ static int release_client_resource(struct client *client, u32 handle, | |||
432 | struct client_resource **resource) | 430 | struct client_resource **resource) |
433 | { | 431 | { |
434 | struct client_resource *r; | 432 | struct client_resource *r; |
435 | unsigned long flags; | ||
436 | 433 | ||
437 | spin_lock_irqsave(&client->lock, flags); | 434 | spin_lock_irq(&client->lock); |
438 | if (client->in_shutdown) | 435 | if (client->in_shutdown) |
439 | r = NULL; | 436 | r = NULL; |
440 | else | 437 | else |
441 | r = idr_find(&client->resource_idr, handle); | 438 | r = idr_find(&client->resource_idr, handle); |
442 | if (r && r->release == release) | 439 | if (r && r->release == release) |
443 | idr_remove(&client->resource_idr, handle); | 440 | idr_remove(&client->resource_idr, handle); |
444 | spin_unlock_irqrestore(&client->lock, flags); | 441 | spin_unlock_irq(&client->lock); |
445 | 442 | ||
446 | if (!(r && r->release == release)) | 443 | if (!(r && r->release == release)) |
447 | return -EINVAL; | 444 | return -EINVAL; |
@@ -1384,7 +1381,6 @@ static int fw_device_op_release(struct inode *inode, struct file *file) | |||
1384 | { | 1381 | { |
1385 | struct client *client = file->private_data; | 1382 | struct client *client = file->private_data; |
1386 | struct event *e, *next_e; | 1383 | struct event *e, *next_e; |
1387 | unsigned long flags; | ||
1388 | 1384 | ||
1389 | mutex_lock(&client->device->client_list_mutex); | 1385 | mutex_lock(&client->device->client_list_mutex); |
1390 | list_del(&client->link); | 1386 | list_del(&client->link); |
@@ -1397,9 +1393,9 @@ static int fw_device_op_release(struct inode *inode, struct file *file) | |||
1397 | fw_iso_context_destroy(client->iso_context); | 1393 | fw_iso_context_destroy(client->iso_context); |
1398 | 1394 | ||
1399 | /* Freeze client->resource_idr and client->event_list */ | 1395 | /* Freeze client->resource_idr and client->event_list */ |
1400 | spin_lock_irqsave(&client->lock, flags); | 1396 | spin_lock_irq(&client->lock); |
1401 | client->in_shutdown = true; | 1397 | client->in_shutdown = true; |
1402 | spin_unlock_irqrestore(&client->lock, flags); | 1398 | spin_unlock_irq(&client->lock); |
1403 | 1399 | ||
1404 | idr_for_each(&client->resource_idr, shutdown_resource, client); | 1400 | idr_for_each(&client->resource_idr, shutdown_resource, client); |
1405 | idr_remove_all(&client->resource_idr); | 1401 | idr_remove_all(&client->resource_idr); |