[SCSI] libata: plumb sas port scan into standard libata paths
authorJames Bottomley <James.Bottomley@suse.de>
Sun, 23 Jan 2011 14:28:33 +0000 (08:28 -0600)
committerJames Bottomley <James.Bottomley@suse.de>
Sun, 13 Feb 2011 19:14:29 +0000 (13:14 -0600)
The function ata_sas_port_init() has always really done its own thing.
However, as a precursor to moving to the libata new eh, it has to be
properly using the standard libata scan paths.  This means separating
the current libata scan paths into pieces which can be shared with
libsas and pieces which cant (really just the async call and the host
scan).

Cc: Tejun Heo <tj@kernel.org>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/ata/libata-core.c
drivers/ata/libata-scsi.c
drivers/ata/libata.h

index a31fe96f7de670927dd0a10f7c1abc74a89a03e6..f5917756c49db981031da9bd33ea8cabc501a985 100644 (file)
@@ -5886,21 +5886,9 @@ void ata_host_init(struct ata_host *host, struct device *dev,
        host->ops = ops;
 }
 
-
-static void async_port_probe(void *data, async_cookie_t cookie)
+int ata_port_probe(struct ata_port *ap)
 {
-       int rc;
-       struct ata_port *ap = data;
-
-       /*
-        * If we're not allowed to scan this host in parallel,
-        * we need to wait until all previous scans have completed
-        * before going further.
-        * Jeff Garzik says this is only within a controller, so we
-        * don't need to wait for port 0, only for later ports.
-        */
-       if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0)
-               async_synchronize_cookie(cookie);
+       int rc = 0;
 
        /* probe */
        if (ap->ops->error_handler) {
@@ -5926,23 +5914,33 @@ static void async_port_probe(void *data, async_cookie_t cookie)
                DPRINTK("ata%u: bus probe begin\n", ap->print_id);
                rc = ata_bus_probe(ap);
                DPRINTK("ata%u: bus probe end\n", ap->print_id);
-
-               if (rc) {
-                       /* FIXME: do something useful here?
-                        * Current libata behavior will
-                        * tear down everything when
-                        * the module is removed
-                        * or the h/w is unplugged.
-                        */
-               }
        }
+       return rc;
+}
+
+
+static void async_port_probe(void *data, async_cookie_t cookie)
+{
+       struct ata_port *ap = data;
+
+       /*
+        * If we're not allowed to scan this host in parallel,
+        * we need to wait until all previous scans have completed
+        * before going further.
+        * Jeff Garzik says this is only within a controller, so we
+        * don't need to wait for port 0, only for later ports.
+        */
+       if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0)
+               async_synchronize_cookie(cookie);
+
+       (void)ata_port_probe(ap);
 
        /* in order to keep device order, we need to synchronize at this point */
        async_synchronize_cookie(cookie);
 
        ata_scsi_scan_host(ap, 1);
-
 }
+
 /**
  *     ata_host_register - register initialized ATA host
  *     @host: ATA host to register
index 5defc74973d751a6283b10ac40bc29f257abbedd..897066761359ff6dce65f469e2323b088f87d416 100644 (file)
@@ -3809,7 +3809,7 @@ int ata_sas_port_init(struct ata_port *ap)
 
        if (!rc) {
                ap->print_id = ata_print_id++;
-               rc = ata_bus_probe(ap);
+               rc = ata_port_probe(ap);
        }
 
        return rc;
index a9be110dbf5175de1f66942c5d21da98ab86b053..773de97988a25143c897df8de7b751ead6e6b696 100644 (file)
@@ -103,6 +103,7 @@ extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
 extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
 extern struct ata_port *ata_port_alloc(struct ata_host *host);
 extern const char *sata_spd_string(unsigned int spd);
+extern int ata_port_probe(struct ata_port *ap);
 
 /* libata-acpi.c */
 #ifdef CONFIG_ATA_ACPI