Commit 238c9cf9ea88bbbb9fd0f60c2cc9511c10b4585c

Authored by James Bottomley
Committed by Jeff Garzik
1 parent eb0e85e36b

libata: plumb sas port scan into standard libata paths

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).

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

Showing 3 changed files with 24 additions and 25 deletions Side-by-side Diff

drivers/ata/libata-core.c
... ... @@ -5887,22 +5887,10 @@
5887 5887 host->ops = ops;
5888 5888 }
5889 5889  
5890   -
5891   -static void async_port_probe(void *data, async_cookie_t cookie)
  5890 +int ata_port_probe(struct ata_port *ap)
5892 5891 {
5893   - int rc;
5894   - struct ata_port *ap = data;
  5892 + int rc = 0;
5895 5893  
5896   - /*
5897   - * If we're not allowed to scan this host in parallel,
5898   - * we need to wait until all previous scans have completed
5899   - * before going further.
5900   - * Jeff Garzik says this is only within a controller, so we
5901   - * don't need to wait for port 0, only for later ports.
5902   - */
5903   - if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0)
5904   - async_synchronize_cookie(cookie);
5905   -
5906 5894 /* probe */
5907 5895 if (ap->ops->error_handler) {
5908 5896 struct ata_eh_info *ehi = &ap->link.eh_info;
5909 5897  
5910 5898  
5911 5899  
5912 5900  
... ... @@ -5927,23 +5915,33 @@
5927 5915 DPRINTK("ata%u: bus probe begin\n", ap->print_id);
5928 5916 rc = ata_bus_probe(ap);
5929 5917 DPRINTK("ata%u: bus probe end\n", ap->print_id);
5930   -
5931   - if (rc) {
5932   - /* FIXME: do something useful here?
5933   - * Current libata behavior will
5934   - * tear down everything when
5935   - * the module is removed
5936   - * or the h/w is unplugged.
5937   - */
5938   - }
5939 5918 }
  5919 + return rc;
  5920 +}
5940 5921  
  5922 +
  5923 +static void async_port_probe(void *data, async_cookie_t cookie)
  5924 +{
  5925 + struct ata_port *ap = data;
  5926 +
  5927 + /*
  5928 + * If we're not allowed to scan this host in parallel,
  5929 + * we need to wait until all previous scans have completed
  5930 + * before going further.
  5931 + * Jeff Garzik says this is only within a controller, so we
  5932 + * don't need to wait for port 0, only for later ports.
  5933 + */
  5934 + if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0)
  5935 + async_synchronize_cookie(cookie);
  5936 +
  5937 + (void)ata_port_probe(ap);
  5938 +
5941 5939 /* in order to keep device order, we need to synchronize at this point */
5942 5940 async_synchronize_cookie(cookie);
5943 5941  
5944 5942 ata_scsi_scan_host(ap, 1);
5945   -
5946 5943 }
  5944 +
5947 5945 /**
5948 5946 * ata_host_register - register initialized ATA host
5949 5947 * @host: ATA host to register
drivers/ata/libata-scsi.c
... ... @@ -3821,7 +3821,7 @@
3821 3821  
3822 3822 if (!rc) {
3823 3823 ap->print_id = ata_print_id++;
3824   - rc = ata_bus_probe(ap);
  3824 + rc = ata_port_probe(ap);
3825 3825 }
3826 3826  
3827 3827 return rc;
drivers/ata/libata.h
... ... @@ -103,6 +103,7 @@
103 103 extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
104 104 extern struct ata_port *ata_port_alloc(struct ata_host *host);
105 105 extern const char *sata_spd_string(unsigned int spd);
  106 +extern int ata_port_probe(struct ata_port *ap);
106 107  
107 108 /* libata-acpi.c */
108 109 #ifdef CONFIG_ATA_ACPI