aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-card.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-card.c')
-rw-r--r--drivers/firewire/fw-card.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index 3eb06556a0c1..a2de680d9d52 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/rwsem.h>
25#include "fw-transaction.h" 26#include "fw-transaction.h"
26#include "fw-topology.h" 27#include "fw-topology.h"
27#include "fw-device.h" 28#include "fw-device.h"
@@ -49,6 +50,7 @@ crc16_itu_t(const u32 *buffer, size_t length)
49 return crc; 50 return crc;
50} 51}
51 52
53static DECLARE_RWSEM(card_rwsem);
52static LIST_HEAD(card_list); 54static LIST_HEAD(card_list);
53 55
54static LIST_HEAD(descriptor_list); 56static LIST_HEAD(descriptor_list);
@@ -162,7 +164,7 @@ fw_core_add_descriptor (struct fw_descriptor *desc)
162 if (i != desc->length) 164 if (i != desc->length)
163 return -EINVAL; 165 return -EINVAL;
164 166
165 down_write(&fw_bus_type.subsys.rwsem); 167 down_write(&card_rwsem);
166 168
167 list_add_tail (&desc->link, &descriptor_list); 169 list_add_tail (&desc->link, &descriptor_list);
168 descriptor_count++; 170 descriptor_count++;
@@ -170,7 +172,7 @@ fw_core_add_descriptor (struct fw_descriptor *desc)
170 descriptor_count++; 172 descriptor_count++;
171 update_config_roms(); 173 update_config_roms();
172 174
173 up_write(&fw_bus_type.subsys.rwsem); 175 up_write(&card_rwsem);
174 176
175 return 0; 177 return 0;
176} 178}
@@ -179,7 +181,7 @@ EXPORT_SYMBOL(fw_core_add_descriptor);
179void 181void
180fw_core_remove_descriptor (struct fw_descriptor *desc) 182fw_core_remove_descriptor (struct fw_descriptor *desc)
181{ 183{
182 down_write(&fw_bus_type.subsys.rwsem); 184 down_write(&card_rwsem);
183 185
184 list_del(&desc->link); 186 list_del(&desc->link);
185 descriptor_count--; 187 descriptor_count--;
@@ -187,7 +189,7 @@ fw_core_remove_descriptor (struct fw_descriptor *desc)
187 descriptor_count--; 189 descriptor_count--;
188 update_config_roms(); 190 update_config_roms();
189 191
190 up_write(&fw_bus_type.subsys.rwsem); 192 up_write(&card_rwsem);
191} 193}
192EXPORT_SYMBOL(fw_core_remove_descriptor); 194EXPORT_SYMBOL(fw_core_remove_descriptor);
193 195
@@ -404,10 +406,10 @@ fw_card_add(struct fw_card *card,
404 * drops it when the driver calls fw_core_remove_card. */ 406 * drops it when the driver calls fw_core_remove_card. */
405 fw_card_get(card); 407 fw_card_get(card);
406 408
407 down_write(&fw_bus_type.subsys.rwsem); 409 down_write(&card_rwsem);
408 config_rom = generate_config_rom (card, &length); 410 config_rom = generate_config_rom (card, &length);
409 list_add_tail(&card->link, &card_list); 411 list_add_tail(&card->link, &card_list);
410 up_write(&fw_bus_type.subsys.rwsem); 412 up_write(&card_rwsem);
411 413
412 return card->driver->enable(card, config_rom, length); 414 return card->driver->enable(card, config_rom, length);
413} 415}
@@ -487,9 +489,9 @@ fw_core_remove_card(struct fw_card *card)
487 PHY_LINK_ACTIVE | PHY_CONTENDER, 0); 489 PHY_LINK_ACTIVE | PHY_CONTENDER, 0);
488 fw_core_initiate_bus_reset(card, 1); 490 fw_core_initiate_bus_reset(card, 1);
489 491
490 down_write(&fw_bus_type.subsys.rwsem); 492 down_write(&card_rwsem);
491 list_del(&card->link); 493 list_del(&card->link);
492 up_write(&fw_bus_type.subsys.rwsem); 494 up_write(&card_rwsem);
493 495
494 /* Set up the dummy driver. */ 496 /* Set up the dummy driver. */
495 card->driver = &dummy_driver; 497 card->driver = &dummy_driver;