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

firewire: Use atomic_t's for serial numbers.

Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>

Use atomic_inc_return.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 362c2c8c
......@@ -367,9 +367,9 @@ void
fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
struct device *device)
{
static int index;
static atomic_t index = ATOMIC_INIT(-1);
card->index = index++;
card->index = atomic_inc_return(&index);
card->driver = driver;
card->device = device;
card->current_tlabel = 0;
......
......@@ -434,7 +434,7 @@ static void fw_device_shutdown(struct work_struct *work)
static void fw_device_init(struct work_struct *work)
{
static int serial;
static atomic_t serial = ATOMIC_INIT(-1);
struct fw_device *device =
container_of(work, struct fw_device, work.work);
......@@ -460,7 +460,7 @@ static void fw_device_init(struct work_struct *work)
device->device.release = fw_device_release;
device->device.parent = device->card->device;
snprintf(device->device.bus_id, sizeof device->device.bus_id,
"fw%d", serial++);
"fw%d", atomic_inc_return(&serial));
if (alloc_chrdev_region(&device->device.devt, 0, 1, "fw")) {
fw_error("Failed to register char device region.\n");
......
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