Commit 1f723867e650e5e021445eea34fddeffca9c4faa

Authored by James Bottomley
1 parent a0b990c62c

[SCSI] 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).

Cc: Tejun Heo <tj@kernel.org>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

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

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