]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/firewire/fw-device.c
libata: prefer hardreset
[linux-2.6-omap-h63xx.git] / drivers / firewire / fw-device.c
index 2ab13e0f3469c2f3ccd4b68d120be57f4107c3a6..870125a3638e5a8e647684de358b4be5f4290491 100644 (file)
@@ -150,21 +150,10 @@ struct bus_type fw_bus_type = {
 };
 EXPORT_SYMBOL(fw_bus_type);
 
-struct fw_device *fw_device_get(struct fw_device *device)
-{
-       get_device(&device->device);
-
-       return device;
-}
-
-void fw_device_put(struct fw_device *device)
-{
-       put_device(&device->device);
-}
-
 static void fw_device_release(struct device *dev)
 {
        struct fw_device *device = fw_device(dev);
+       struct fw_card *card = device->card;
        unsigned long flags;
 
        /*
@@ -176,9 +165,9 @@ static void fw_device_release(struct device *dev)
        spin_unlock_irqrestore(&device->card->lock, flags);
 
        fw_node_put(device->node);
-       fw_card_put(device->card);
        kfree(device->config_rom);
        kfree(device);
+       atomic_dec(&card->device_count);
 }
 
 int fw_device_enable_phys_dma(struct fw_device *device)
@@ -668,7 +657,8 @@ static void fw_device_init(struct work_struct *work)
         */
 
        if (read_bus_info_block(device, device->generation) < 0) {
-               if (device->config_rom_retries < MAX_RETRIES) {
+               if (device->config_rom_retries < MAX_RETRIES &&
+                   atomic_read(&device->state) == FW_DEVICE_INITIALIZING) {
                        device->config_rom_retries++;
                        schedule_delayed_work(&device->work, RETRY_DELAY);
                } else {
@@ -805,7 +795,8 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
                 */
                device_initialize(&device->device);
                atomic_set(&device->state, FW_DEVICE_INITIALIZING);
-               device->card = fw_card_get(card);
+               atomic_inc(&card->device_count);
+               device->card = card;
                device->node = fw_node_get(node);
                device->node_id = node->node_id;
                device->generation = card->generation;