]> err.no Git - linux-2.6/commitdiff
libata: kill ata_ehi_schedule_probe()
authorTejun Heo <htejun@gmail.com>
Wed, 23 Jan 2008 15:05:14 +0000 (00:05 +0900)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 17 Apr 2008 19:44:16 +0000 (15:44 -0400)
ata_ehi_schedule_probe() was created to hide details of link-resuming
reset magic.  Now that all the softreset workarounds are gone,
scheduling probe is very simple - set probe_mask and request RESET.
Kill ata_ehi_schedule_probe() and open code it.  This also increases
consistency as ata_ehi_schedule_probe() couldn't cover individual
device probings so they were open-coded even when the helper existed.

While at it, define ATA_ALL_DEVICES as mask of all possible devices on
a link and always use it when requesting probe on link level for
simplicity and consistency.  Setting extra bits in the probe_mask
doesn't hurt anybody.

Signed-off-by: Tejun Heo <htejun@gmail.com>
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-pmp.c
drivers/ata/libata-scsi.c
include/linux/libata.h

index baef749ec5286920d0309a40f323d587c12d2aff..4dc429fd00560172b0a6f17eb9b08aa21132cef6 100644 (file)
@@ -7156,8 +7156,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
                        /* kick EH for boot probing */
                        spin_lock_irqsave(ap->lock, flags);
 
-                       ehi->probe_mask =
-                               (1 << ata_link_max_devices(&ap->link)) - 1;
+                       ehi->probe_mask |= ATA_ALL_DEVICES;
                        ehi->action |= ATA_EH_RESET;
                        ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET;
 
index e6584fa7f456d4e4c1d31bf09b93216540efc3ca..0d0a2c0ab9e7b23864f09b729f9be963f0b3d89d 100644 (file)
@@ -1746,7 +1746,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
                ata_eh_analyze_serror(link);
        } else if (rc != -EOPNOTSUPP) {
                /* SError read failed, force reset and probing */
-               ata_ehi_schedule_probe(&ehc->i);
+               ehc->i.probe_mask |= ATA_ALL_DEVICES;
                ehc->i.action |= ATA_EH_RESET;
                ehc->i.err_mask |= AC_ERR_OTHER;
        }
index df1d3252b9e611946279f6e0de52bc070b1cb51f..39e036c8a2bc5c25285ca21a4c96e73534278c71 100644 (file)
@@ -435,7 +435,7 @@ static int sata_pmp_init_links(struct ata_port *ap, int nr_ports)
                struct ata_eh_context *ehc = &link->eh_context;
 
                link->flags = 0;
-               ehc->i.probe_mask |= 1;
+               ehc->i.probe_mask |= ATA_ALL_DEVICES;
                ehc->i.action |= ATA_EH_RESET;
        }
 
@@ -831,8 +831,12 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
                ata_eh_thaw_port(ap);
 
                /* PMP is reset, SErrors cannot be trusted, scan all */
-               ata_port_for_each_link(tlink, ap)
-                       ata_ehi_schedule_probe(&tlink->eh_context.i);
+               ata_port_for_each_link(tlink, ap) {
+                       struct ata_eh_context *ehc = &tlink->eh_context;
+
+                       ehc->i.probe_mask |= ATA_ALL_DEVICES;
+                       ehc->i.action |= ATA_EH_RESET;
+               }
        }
 
        /* If revalidation is requested, revalidate and reconfigure;
@@ -847,7 +851,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
                tries--;
 
                if (rc == -ENODEV) {
-                       ehc->i.probe_mask |= 1;
+                       ehc->i.probe_mask |= ATA_ALL_DEVICES;
                        detach = 1;
                        /* give it just two more chances */
                        tries = min(tries, 2);
index caffca7dd76f72a6a20dcfcccc4ceba91b8154af..798ba5e45710ef06c8e8f137bc707abc54796de9 100644 (file)
@@ -3507,7 +3507,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
 
                ata_port_for_each_link(link, ap) {
                        struct ata_eh_info *ehi = &link->eh_info;
-                       ehi->probe_mask |= (1 << ata_link_max_devices(link)) - 1;
+                       ehi->probe_mask |= ATA_ALL_DEVICES;
                        ehi->action |= ATA_EH_RESET;
                }
        } else {
index 6eec11957e54743ff80d5f0e01dada8b4bf359f2..bc60132c7d339ffb0d7651295774b2b1a86bc72e 100644 (file)
@@ -122,6 +122,8 @@ enum {
 
        ATAPI_MAX_DRAIN         = 16 << 10,
 
+       ATA_ALL_DEVICES         = (1 << ATA_MAX_DEVICES) - 1,
+
        ATA_SHT_EMULATED        = 1,
        ATA_SHT_CMD_PER_LUN     = 1,
        ATA_SHT_THIS_ID         = -1,
@@ -1089,17 +1091,11 @@ extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
        __attribute__ ((format (printf, 2, 3)));
 extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
 
-static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi)
-{
-       ehi->action |= ATA_EH_RESET;
-       ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
-}
-
 static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
 {
-       ata_ehi_schedule_probe(ehi);
+       ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
        ehi->flags |= ATA_EHI_HOTPLUGGED;
-       ehi->action |= ATA_EH_ENABLE_LINK;
+       ehi->action |= ATA_EH_RESET | ATA_EH_ENABLE_LINK;
        ehi->err_mask |= AC_ERR_ATA_BUS;
 }