aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-04-17 11:51:57 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-04-17 15:14:32 -0400
commitdde2b954302d143deee6dbd931ba2aa21413bb0a (patch)
tree783ecd8fffecaae521540ad533c5aeb343778ac0 /drivers
parent0fc7d6e4f4c243b49077b29466c9e135e3401938 (diff)
firewire: Don't use subsystem rwsem, it's going away.
Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firewire/fw-card.c18
-rw-r--r--drivers/firewire/fw-device.c17
2 files changed, 19 insertions, 16 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;
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index 71976571c807..7503b8d9abe5 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -550,6 +550,7 @@ static int shutdown_unit(struct device *device, void *data)
550 return 0; 550 return 0;
551} 551}
552 552
553static DECLARE_RWSEM(idr_rwsem);
553static DEFINE_IDR(fw_device_idr); 554static DEFINE_IDR(fw_device_idr);
554int fw_cdev_major; 555int fw_cdev_major;
555 556
@@ -557,9 +558,9 @@ struct fw_device *fw_device_from_devt(dev_t devt)
557{ 558{
558 struct fw_device *device; 559 struct fw_device *device;
559 560
560 down_read(&fw_bus_type.subsys.rwsem); 561 down_read(&idr_rwsem);
561 device = idr_find(&fw_device_idr, MINOR(devt)); 562 device = idr_find(&fw_device_idr, MINOR(devt));
562 up_read(&fw_bus_type.subsys.rwsem); 563 up_read(&idr_rwsem);
563 564
564 return device; 565 return device;
565} 566}
@@ -570,9 +571,9 @@ static void fw_device_shutdown(struct work_struct *work)
570 container_of(work, struct fw_device, work.work); 571 container_of(work, struct fw_device, work.work);
571 int minor = MINOR(device->device.devt); 572 int minor = MINOR(device->device.devt);
572 573
573 down_write(&fw_bus_type.subsys.rwsem); 574 down_write(&idr_rwsem);
574 idr_remove(&fw_device_idr, minor); 575 idr_remove(&fw_device_idr, minor);
575 up_write(&fw_bus_type.subsys.rwsem); 576 up_write(&idr_rwsem);
576 577
577 fw_device_cdev_remove(device); 578 fw_device_cdev_remove(device);
578 device_for_each_child(&device->device, NULL, shutdown_unit); 579 device_for_each_child(&device->device, NULL, shutdown_unit);
@@ -621,10 +622,10 @@ static void fw_device_init(struct work_struct *work)
621 } 622 }
622 623
623 err = -ENOMEM; 624 err = -ENOMEM;
624 down_write(&fw_bus_type.subsys.rwsem); 625 down_write(&idr_rwsem);
625 if (idr_pre_get(&fw_device_idr, GFP_KERNEL)) 626 if (idr_pre_get(&fw_device_idr, GFP_KERNEL))
626 err = idr_get_new(&fw_device_idr, device, &minor); 627 err = idr_get_new(&fw_device_idr, device, &minor);
627 up_write(&fw_bus_type.subsys.rwsem); 628 up_write(&idr_rwsem);
628 if (err < 0) 629 if (err < 0)
629 goto error; 630 goto error;
630 631
@@ -670,9 +671,9 @@ static void fw_device_init(struct work_struct *work)
670 return; 671 return;
671 672
672 error_with_cdev: 673 error_with_cdev:
673 down_write(&fw_bus_type.subsys.rwsem); 674 down_write(&idr_rwsem);
674 idr_remove(&fw_device_idr, minor); 675 idr_remove(&fw_device_idr, minor);
675 up_write(&fw_bus_type.subsys.rwsem); 676 up_write(&idr_rwsem);
676 error: 677 error:
677 put_device(&device->device); 678 put_device(&device->device);
678} 679}