diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-07-22 05:56:38 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-07-27 05:04:10 -0400 |
commit | 685c3f80b6d88478a6428676f9daab59faf3cd4b (patch) | |
tree | 3f1f93927c0241ba12d887bcf7b90fc52d760884 /drivers/firewire/nosy.c | |
parent | a2d39db9dec0e7e403f54c9cf98b7dbc82b4c44a (diff) |
firewire: nosy: use flagless variants of spinlock accessors
nosy_start/stop_snoop() are always only called by the ioctl method, i.e.
with IRQs enabled. packet_handler() and bus_reset_handler() are always
only called by the IRQ handler. Hence neither one needs to track IRQ
flags.
To underline the call context of packet_handler() and
bus_reset_handler(), rename these functions to *_irq_handler().
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/nosy.c')
-rw-r--r-- | drivers/firewire/nosy.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c index 637e51485a70..2357e170e930 100644 --- a/drivers/firewire/nosy.c +++ b/drivers/firewire/nosy.c | |||
@@ -263,21 +263,17 @@ set_phy_reg(struct pcilynx *lynx, int addr, int val) | |||
263 | static void | 263 | static void |
264 | nosy_start_snoop(struct client *client) | 264 | nosy_start_snoop(struct client *client) |
265 | { | 265 | { |
266 | unsigned long flags; | 266 | spin_lock_irq(&client->lynx->client_list_lock); |
267 | |||
268 | spin_lock_irqsave(&client->lynx->client_list_lock, flags); | ||
269 | list_add_tail(&client->link, &client->lynx->client_list); | 267 | list_add_tail(&client->link, &client->lynx->client_list); |
270 | spin_unlock_irqrestore(&client->lynx->client_list_lock, flags); | 268 | spin_unlock_irq(&client->lynx->client_list_lock); |
271 | } | 269 | } |
272 | 270 | ||
273 | static void | 271 | static void |
274 | nosy_stop_snoop(struct client *client) | 272 | nosy_stop_snoop(struct client *client) |
275 | { | 273 | { |
276 | unsigned long flags; | 274 | spin_lock_irq(&client->lynx->client_list_lock); |
277 | |||
278 | spin_lock_irqsave(&client->lynx->client_list_lock, flags); | ||
279 | list_del_init(&client->link); | 275 | list_del_init(&client->link); |
280 | spin_unlock_irqrestore(&client->lynx->client_list_lock, flags); | 276 | spin_unlock_irq(&client->lynx->client_list_lock); |
281 | } | 277 | } |
282 | 278 | ||
283 | static struct client * | 279 | static struct client * |
@@ -410,9 +406,8 @@ struct link_packet { | |||
410 | }; | 406 | }; |
411 | 407 | ||
412 | static void | 408 | static void |
413 | packet_handler(struct pcilynx *lynx) | 409 | packet_irq_handler(struct pcilynx *lynx) |
414 | { | 410 | { |
415 | unsigned long flags; | ||
416 | struct client *client; | 411 | struct client *client; |
417 | u32 tcode_mask; | 412 | u32 tcode_mask; |
418 | size_t length; | 413 | size_t length; |
@@ -432,31 +427,30 @@ packet_handler(struct pcilynx *lynx) | |||
432 | else | 427 | else |
433 | tcode_mask = 1 << packet->tcode; | 428 | tcode_mask = 1 << packet->tcode; |
434 | 429 | ||
435 | spin_lock_irqsave(&lynx->client_list_lock, flags); | 430 | spin_lock(&lynx->client_list_lock); |
436 | 431 | ||
437 | list_for_each_entry(client, &lynx->client_list, link) | 432 | list_for_each_entry(client, &lynx->client_list, link) |
438 | if (client->tcode_mask & tcode_mask) | 433 | if (client->tcode_mask & tcode_mask) |
439 | packet_buffer_put(&client->buffer, | 434 | packet_buffer_put(&client->buffer, |
440 | lynx->rcv_buffer, length + 4); | 435 | lynx->rcv_buffer, length + 4); |
441 | 436 | ||
442 | spin_unlock_irqrestore(&lynx->client_list_lock, flags); | 437 | spin_unlock(&lynx->client_list_lock); |
443 | } | 438 | } |
444 | 439 | ||
445 | static void | 440 | static void |
446 | bus_reset_handler(struct pcilynx *lynx) | 441 | bus_reset_irq_handler(struct pcilynx *lynx) |
447 | { | 442 | { |
448 | unsigned long flags; | ||
449 | struct client *client; | 443 | struct client *client; |
450 | struct timeval tv; | 444 | struct timeval tv; |
451 | 445 | ||
452 | do_gettimeofday(&tv); | 446 | do_gettimeofday(&tv); |
453 | 447 | ||
454 | spin_lock_irqsave(&lynx->client_list_lock, flags); | 448 | spin_lock(&lynx->client_list_lock); |
455 | 449 | ||
456 | list_for_each_entry(client, &lynx->client_list, link) | 450 | list_for_each_entry(client, &lynx->client_list, link) |
457 | packet_buffer_put(&client->buffer, &tv.tv_usec, 4); | 451 | packet_buffer_put(&client->buffer, &tv.tv_usec, 4); |
458 | 452 | ||
459 | spin_unlock_irqrestore(&lynx->client_list_lock, flags); | 453 | spin_unlock(&lynx->client_list_lock); |
460 | } | 454 | } |
461 | 455 | ||
462 | static irqreturn_t | 456 | static irqreturn_t |
@@ -478,7 +472,7 @@ irq_handler(int irq, void *device) | |||
478 | reg_write(lynx, LINK_INT_STATUS, link_int_status); | 472 | reg_write(lynx, LINK_INT_STATUS, link_int_status); |
479 | 473 | ||
480 | if ((link_int_status & LINK_INT_PHY_BUSRESET) > 0) | 474 | if ((link_int_status & LINK_INT_PHY_BUSRESET) > 0) |
481 | bus_reset_handler(lynx); | 475 | bus_reset_irq_handler(lynx); |
482 | } | 476 | } |
483 | 477 | ||
484 | /* Clear the PCI_INT_STATUS register only after clearing the | 478 | /* Clear the PCI_INT_STATUS register only after clearing the |
@@ -488,7 +482,7 @@ irq_handler(int irq, void *device) | |||
488 | reg_write(lynx, PCI_INT_STATUS, pci_int_status); | 482 | reg_write(lynx, PCI_INT_STATUS, pci_int_status); |
489 | 483 | ||
490 | if ((pci_int_status & PCI_INT_DMA0_HLT) > 0) { | 484 | if ((pci_int_status & PCI_INT_DMA0_HLT) > 0) { |
491 | packet_handler(lynx); | 485 | packet_irq_handler(lynx); |
492 | run_pcl(lynx, lynx->rcv_start_pcl_bus, 0); | 486 | run_pcl(lynx, lynx->rcv_start_pcl_bus, 0); |
493 | } | 487 | } |
494 | 488 | ||