diff options
-rw-r--r-- | drivers/ata/libata-eh.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 1d7faab64810..b16c81a24ba3 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2375,6 +2375,22 @@ static int ata_eh_skip_recovery(struct ata_link *link) | |||
2375 | return 1; | 2375 | return 1; |
2376 | } | 2376 | } |
2377 | 2377 | ||
2378 | static int ata_eh_schedule_probe(struct ata_device *dev) | ||
2379 | { | ||
2380 | struct ata_eh_context *ehc = &dev->link->eh_context; | ||
2381 | |||
2382 | if (!(ehc->i.probe_mask & (1 << dev->devno)) || | ||
2383 | (ehc->did_probe_mask & (1 << dev->devno))) | ||
2384 | return 0; | ||
2385 | |||
2386 | ata_eh_detach_dev(dev); | ||
2387 | ata_dev_init(dev); | ||
2388 | ehc->did_probe_mask |= (1 << dev->devno); | ||
2389 | ehc->i.action |= ATA_EH_SOFTRESET; | ||
2390 | |||
2391 | return 1; | ||
2392 | } | ||
2393 | |||
2378 | static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | 2394 | static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) |
2379 | { | 2395 | { |
2380 | struct ata_eh_context *ehc = &dev->link->eh_context; | 2396 | struct ata_eh_context *ehc = &dev->link->eh_context; |
@@ -2406,16 +2422,9 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2406 | if (ata_link_offline(dev->link)) | 2422 | if (ata_link_offline(dev->link)) |
2407 | ata_eh_detach_dev(dev); | 2423 | ata_eh_detach_dev(dev); |
2408 | 2424 | ||
2409 | /* probe if requested */ | 2425 | /* schedule probe if necessary */ |
2410 | if ((ehc->i.probe_mask & (1 << dev->devno)) && | 2426 | if (ata_eh_schedule_probe(dev)) |
2411 | !(ehc->did_probe_mask & (1 << dev->devno))) { | ||
2412 | ata_eh_detach_dev(dev); | ||
2413 | ata_dev_init(dev); | ||
2414 | |||
2415 | ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; | 2427 | ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; |
2416 | ehc->did_probe_mask |= (1 << dev->devno); | ||
2417 | ehc->i.action |= ATA_EH_SOFTRESET; | ||
2418 | } | ||
2419 | 2428 | ||
2420 | return 1; | 2429 | return 1; |
2421 | } else { | 2430 | } else { |
@@ -2492,14 +2501,9 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2492 | if (dev->flags & ATA_DFLAG_DETACH) | 2501 | if (dev->flags & ATA_DFLAG_DETACH) |
2493 | ata_eh_detach_dev(dev); | 2502 | ata_eh_detach_dev(dev); |
2494 | 2503 | ||
2495 | if (!ata_dev_enabled(dev) && | 2504 | /* schedule probe if necessary */ |
2496 | ((ehc->i.probe_mask & (1 << dev->devno)) && | 2505 | if (!ata_dev_enabled(dev)) |
2497 | !(ehc->did_probe_mask & (1 << dev->devno)))) { | 2506 | ata_eh_schedule_probe(dev); |
2498 | ata_eh_detach_dev(dev); | ||
2499 | ata_dev_init(dev); | ||
2500 | ehc->did_probe_mask |= (1 << dev->devno); | ||
2501 | ehc->i.action |= ATA_EH_SOFTRESET; | ||
2502 | } | ||
2503 | } | 2507 | } |
2504 | } | 2508 | } |
2505 | 2509 | ||