Commit dde2b954 authored by Kristian Høgsberg's avatar Kristian Høgsberg Committed by Stefan Richter

firewire: Don't use subsystem rwsem, it's going away.

Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 0fc7d6e4
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/rwsem.h>
#include "fw-transaction.h" #include "fw-transaction.h"
#include "fw-topology.h" #include "fw-topology.h"
#include "fw-device.h" #include "fw-device.h"
...@@ -49,6 +50,7 @@ crc16_itu_t(const u32 *buffer, size_t length) ...@@ -49,6 +50,7 @@ crc16_itu_t(const u32 *buffer, size_t length)
return crc; return crc;
} }
static DECLARE_RWSEM(card_rwsem);
static LIST_HEAD(card_list); static LIST_HEAD(card_list);
static LIST_HEAD(descriptor_list); static LIST_HEAD(descriptor_list);
...@@ -162,7 +164,7 @@ fw_core_add_descriptor (struct fw_descriptor *desc) ...@@ -162,7 +164,7 @@ fw_core_add_descriptor (struct fw_descriptor *desc)
if (i != desc->length) if (i != desc->length)
return -EINVAL; return -EINVAL;
down_write(&fw_bus_type.subsys.rwsem); down_write(&card_rwsem);
list_add_tail (&desc->link, &descriptor_list); list_add_tail (&desc->link, &descriptor_list);
descriptor_count++; descriptor_count++;
...@@ -170,7 +172,7 @@ fw_core_add_descriptor (struct fw_descriptor *desc) ...@@ -170,7 +172,7 @@ fw_core_add_descriptor (struct fw_descriptor *desc)
descriptor_count++; descriptor_count++;
update_config_roms(); update_config_roms();
up_write(&fw_bus_type.subsys.rwsem); up_write(&card_rwsem);
return 0; return 0;
} }
...@@ -179,7 +181,7 @@ EXPORT_SYMBOL(fw_core_add_descriptor); ...@@ -179,7 +181,7 @@ EXPORT_SYMBOL(fw_core_add_descriptor);
void void
fw_core_remove_descriptor (struct fw_descriptor *desc) fw_core_remove_descriptor (struct fw_descriptor *desc)
{ {
down_write(&fw_bus_type.subsys.rwsem); down_write(&card_rwsem);
list_del(&desc->link); list_del(&desc->link);
descriptor_count--; descriptor_count--;
...@@ -187,7 +189,7 @@ fw_core_remove_descriptor (struct fw_descriptor *desc) ...@@ -187,7 +189,7 @@ fw_core_remove_descriptor (struct fw_descriptor *desc)
descriptor_count--; descriptor_count--;
update_config_roms(); update_config_roms();
up_write(&fw_bus_type.subsys.rwsem); up_write(&card_rwsem);
} }
EXPORT_SYMBOL(fw_core_remove_descriptor); EXPORT_SYMBOL(fw_core_remove_descriptor);
...@@ -404,10 +406,10 @@ fw_card_add(struct fw_card *card, ...@@ -404,10 +406,10 @@ fw_card_add(struct fw_card *card,
* drops it when the driver calls fw_core_remove_card. */ * drops it when the driver calls fw_core_remove_card. */
fw_card_get(card); fw_card_get(card);
down_write(&fw_bus_type.subsys.rwsem); down_write(&card_rwsem);
config_rom = generate_config_rom (card, &length); config_rom = generate_config_rom (card, &length);
list_add_tail(&card->link, &card_list); list_add_tail(&card->link, &card_list);
up_write(&fw_bus_type.subsys.rwsem); up_write(&card_rwsem);
return card->driver->enable(card, config_rom, length); return card->driver->enable(card, config_rom, length);
} }
...@@ -487,9 +489,9 @@ fw_core_remove_card(struct fw_card *card) ...@@ -487,9 +489,9 @@ fw_core_remove_card(struct fw_card *card)
PHY_LINK_ACTIVE | PHY_CONTENDER, 0); PHY_LINK_ACTIVE | PHY_CONTENDER, 0);
fw_core_initiate_bus_reset(card, 1); fw_core_initiate_bus_reset(card, 1);
down_write(&fw_bus_type.subsys.rwsem); down_write(&card_rwsem);
list_del(&card->link); list_del(&card->link);
up_write(&fw_bus_type.subsys.rwsem); up_write(&card_rwsem);
/* Set up the dummy driver. */ /* Set up the dummy driver. */
card->driver = &dummy_driver; card->driver = &dummy_driver;
......
...@@ -550,6 +550,7 @@ static int shutdown_unit(struct device *device, void *data) ...@@ -550,6 +550,7 @@ static int shutdown_unit(struct device *device, void *data)
return 0; return 0;
} }
static DECLARE_RWSEM(idr_rwsem);
static DEFINE_IDR(fw_device_idr); static DEFINE_IDR(fw_device_idr);
int fw_cdev_major; int fw_cdev_major;
...@@ -557,9 +558,9 @@ struct fw_device *fw_device_from_devt(dev_t devt) ...@@ -557,9 +558,9 @@ struct fw_device *fw_device_from_devt(dev_t devt)
{ {
struct fw_device *device; struct fw_device *device;
down_read(&fw_bus_type.subsys.rwsem); down_read(&idr_rwsem);
device = idr_find(&fw_device_idr, MINOR(devt)); device = idr_find(&fw_device_idr, MINOR(devt));
up_read(&fw_bus_type.subsys.rwsem); up_read(&idr_rwsem);
return device; return device;
} }
...@@ -570,9 +571,9 @@ static void fw_device_shutdown(struct work_struct *work) ...@@ -570,9 +571,9 @@ static void fw_device_shutdown(struct work_struct *work)
container_of(work, struct fw_device, work.work); container_of(work, struct fw_device, work.work);
int minor = MINOR(device->device.devt); int minor = MINOR(device->device.devt);
down_write(&fw_bus_type.subsys.rwsem); down_write(&idr_rwsem);
idr_remove(&fw_device_idr, minor); idr_remove(&fw_device_idr, minor);
up_write(&fw_bus_type.subsys.rwsem); up_write(&idr_rwsem);
fw_device_cdev_remove(device); fw_device_cdev_remove(device);
device_for_each_child(&device->device, NULL, shutdown_unit); device_for_each_child(&device->device, NULL, shutdown_unit);
...@@ -621,10 +622,10 @@ static void fw_device_init(struct work_struct *work) ...@@ -621,10 +622,10 @@ static void fw_device_init(struct work_struct *work)
} }
err = -ENOMEM; err = -ENOMEM;
down_write(&fw_bus_type.subsys.rwsem); down_write(&idr_rwsem);
if (idr_pre_get(&fw_device_idr, GFP_KERNEL)) if (idr_pre_get(&fw_device_idr, GFP_KERNEL))
err = idr_get_new(&fw_device_idr, device, &minor); err = idr_get_new(&fw_device_idr, device, &minor);
up_write(&fw_bus_type.subsys.rwsem); up_write(&idr_rwsem);
if (err < 0) if (err < 0)
goto error; goto error;
...@@ -670,9 +671,9 @@ static void fw_device_init(struct work_struct *work) ...@@ -670,9 +671,9 @@ static void fw_device_init(struct work_struct *work)
return; return;
error_with_cdev: error_with_cdev:
down_write(&fw_bus_type.subsys.rwsem); down_write(&idr_rwsem);
idr_remove(&fw_device_idr, minor); idr_remove(&fw_device_idr, minor);
up_write(&fw_bus_type.subsys.rwsem); up_write(&idr_rwsem);
error: error:
put_device(&device->device); put_device(&device->device);
} }
......
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