#include <linux/module.h>
#include <linux/errno.h>
#include <linux/device.h>
+#include <linux/rwsem.h>
#include "fw-transaction.h"
#include "fw-topology.h"
#include "fw-device.h"
return crc;
}
+static DECLARE_RWSEM(card_rwsem);
static LIST_HEAD(card_list);
static LIST_HEAD(descriptor_list);
if (i != desc->length)
return -EINVAL;
- down_write(&fw_bus_type.subsys.rwsem);
+ down_write(&card_rwsem);
list_add_tail (&desc->link, &descriptor_list);
descriptor_count++;
descriptor_count++;
update_config_roms();
- up_write(&fw_bus_type.subsys.rwsem);
+ up_write(&card_rwsem);
return 0;
}
void
fw_core_remove_descriptor (struct fw_descriptor *desc)
{
- down_write(&fw_bus_type.subsys.rwsem);
+ down_write(&card_rwsem);
list_del(&desc->link);
descriptor_count--;
descriptor_count--;
update_config_roms();
- up_write(&fw_bus_type.subsys.rwsem);
+ up_write(&card_rwsem);
}
EXPORT_SYMBOL(fw_core_remove_descriptor);
* drops it when the driver calls fw_core_remove_card. */
fw_card_get(card);
- down_write(&fw_bus_type.subsys.rwsem);
+ down_write(&card_rwsem);
config_rom = generate_config_rom (card, &length);
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);
}
PHY_LINK_ACTIVE | PHY_CONTENDER, 0);
fw_core_initiate_bus_reset(card, 1);
- down_write(&fw_bus_type.subsys.rwsem);
+ down_write(&card_rwsem);
list_del(&card->link);
- up_write(&fw_bus_type.subsys.rwsem);
+ up_write(&card_rwsem);
/* Set up the dummy driver. */
card->driver = &dummy_driver;
return 0;
}
+static DECLARE_RWSEM(idr_rwsem);
static DEFINE_IDR(fw_device_idr);
int fw_cdev_major;
{
struct fw_device *device;
- down_read(&fw_bus_type.subsys.rwsem);
+ down_read(&idr_rwsem);
device = idr_find(&fw_device_idr, MINOR(devt));
- up_read(&fw_bus_type.subsys.rwsem);
+ up_read(&idr_rwsem);
return device;
}
container_of(work, struct fw_device, work.work);
int minor = MINOR(device->device.devt);
- down_write(&fw_bus_type.subsys.rwsem);
+ down_write(&idr_rwsem);
idr_remove(&fw_device_idr, minor);
- up_write(&fw_bus_type.subsys.rwsem);
+ up_write(&idr_rwsem);
fw_device_cdev_remove(device);
device_for_each_child(&device->device, NULL, shutdown_unit);
}
err = -ENOMEM;
- down_write(&fw_bus_type.subsys.rwsem);
+ down_write(&idr_rwsem);
if (idr_pre_get(&fw_device_idr, GFP_KERNEL))
err = idr_get_new(&fw_device_idr, device, &minor);
- up_write(&fw_bus_type.subsys.rwsem);
+ up_write(&idr_rwsem);
if (err < 0)
goto error;
return;
error_with_cdev:
- down_write(&fw_bus_type.subsys.rwsem);
+ down_write(&idr_rwsem);
idr_remove(&fw_device_idr, minor);
- up_write(&fw_bus_type.subsys.rwsem);
+ up_write(&idr_rwsem);
error:
put_device(&device->device);
}