]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
firewire: core: wait for inaccessible devices after bus reset
authorClemens Ladisch <clemens@ladisch.de>
Wed, 11 Apr 2012 15:36:39 +0000 (17:36 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Tue, 17 Apr 2012 20:27:37 +0000 (22:27 +0200)
When reread_config_rom() encountered a config rom that was marked as not
yet accessible, that device would be treated as "gone".  This would mean
that that device would effectively vanish until the next bus reset.

The correct way to handle this situation is the same as in
read_config_rom(), to treat this like other errors and to retry the read
later, when the (possibly changed) config rom is available.  The device
is marked "gone" only if it continues to return zero values after these
retries.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/core-device.c

index 68109e9bb04e4395bdbeadc02e0edfa9229074a8..8038311e173756d99f647e7998a3bd8fe9589069 100644 (file)
@@ -505,7 +505,7 @@ static int read_config_rom(struct fw_device *device, int generation)
                if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE)
                        goto out;
                /*
-                * As per IEEE1212 7.2, during power-up, devices can
+                * As per IEEE1212 7.2, during initialization, devices can
                 * reply with a 0 for the first quadlet of the config
                 * rom to indicate that they are booting (for example,
                 * if the firmware is on the disk of a external
@@ -1071,7 +1071,6 @@ static void fw_device_init(struct work_struct *work)
 
 enum {
        REREAD_BIB_ERROR,
-       REREAD_BIB_GONE,
        REREAD_BIB_UNCHANGED,
        REREAD_BIB_CHANGED,
 };
@@ -1087,7 +1086,8 @@ static int reread_config_rom(struct fw_device *device, int generation)
                        return REREAD_BIB_ERROR;
 
                if (i == 0 && q == 0)
-                       return REREAD_BIB_GONE;
+                       /* inaccessible (see read_config_rom); retry later */
+                       return REREAD_BIB_ERROR;
 
                if (q != device->config_rom[i])
                        return REREAD_BIB_CHANGED;
@@ -1114,9 +1114,6 @@ static void fw_device_refresh(struct work_struct *work)
                }
                goto give_up;
 
-       case REREAD_BIB_GONE:
-               goto gone;
-
        case REREAD_BIB_UNCHANGED:
                if (atomic_cmpxchg(&device->state,
                                   FW_DEVICE_INITIALIZING,