diff options
Diffstat (limited to 'drivers/scsi/libsas/sas_ata.c')
| -rw-r--r-- | drivers/scsi/libsas/sas_ata.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index bc0cecc6ad62..441d88ad99a7 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
| @@ -546,11 +546,12 @@ static struct ata_port_info sata_port_info = { | |||
| 546 | .port_ops = &sas_sata_ops | 546 | .port_ops = &sas_sata_ops |
| 547 | }; | 547 | }; |
| 548 | 548 | ||
| 549 | int sas_ata_init_host_and_port(struct domain_device *found_dev) | 549 | int sas_ata_init(struct domain_device *found_dev) |
| 550 | { | 550 | { |
| 551 | struct sas_ha_struct *ha = found_dev->port->ha; | 551 | struct sas_ha_struct *ha = found_dev->port->ha; |
| 552 | struct Scsi_Host *shost = ha->core.shost; | 552 | struct Scsi_Host *shost = ha->core.shost; |
| 553 | struct ata_port *ap; | 553 | struct ata_port *ap; |
| 554 | int rc; | ||
| 554 | 555 | ||
| 555 | ata_host_init(&found_dev->sata_dev.ata_host, | 556 | ata_host_init(&found_dev->sata_dev.ata_host, |
| 556 | ha->dev, | 557 | ha->dev, |
| @@ -567,8 +568,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev) | |||
| 567 | ap->private_data = found_dev; | 568 | ap->private_data = found_dev; |
| 568 | ap->cbl = ATA_CBL_SATA; | 569 | ap->cbl = ATA_CBL_SATA; |
| 569 | ap->scsi_host = shost; | 570 | ap->scsi_host = shost; |
| 570 | /* publish initialized ata port */ | 571 | rc = ata_sas_port_init(ap); |
| 571 | smp_wmb(); | 572 | if (rc) { |
| 573 | ata_sas_port_destroy(ap); | ||
| 574 | return rc; | ||
| 575 | } | ||
| 572 | found_dev->sata_dev.ap = ap; | 576 | found_dev->sata_dev.ap = ap; |
| 573 | 577 | ||
| 574 | return 0; | 578 | return 0; |
| @@ -648,18 +652,13 @@ static void sas_get_ata_command_set(struct domain_device *dev) | |||
| 648 | void sas_probe_sata(struct asd_sas_port *port) | 652 | void sas_probe_sata(struct asd_sas_port *port) |
| 649 | { | 653 | { |
| 650 | struct domain_device *dev, *n; | 654 | struct domain_device *dev, *n; |
| 651 | int err; | ||
| 652 | 655 | ||
| 653 | mutex_lock(&port->ha->disco_mutex); | 656 | mutex_lock(&port->ha->disco_mutex); |
| 654 | list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node) { | 657 | list_for_each_entry(dev, &port->disco_list, disco_list_node) { |
| 655 | if (!dev_is_sata(dev)) | 658 | if (!dev_is_sata(dev)) |
| 656 | continue; | 659 | continue; |
| 657 | 660 | ||
| 658 | err = sas_ata_init_host_and_port(dev); | 661 | ata_sas_async_probe(dev->sata_dev.ap); |
| 659 | if (err) | ||
| 660 | sas_fail_probe(dev, __func__, err); | ||
| 661 | else | ||
| 662 | ata_sas_async_port_init(dev->sata_dev.ap); | ||
| 663 | } | 662 | } |
| 664 | mutex_unlock(&port->ha->disco_mutex); | 663 | mutex_unlock(&port->ha->disco_mutex); |
| 665 | 664 | ||
| @@ -718,18 +717,6 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie) | |||
| 718 | sas_put_device(dev); | 717 | sas_put_device(dev); |
| 719 | } | 718 | } |
| 720 | 719 | ||
| 721 | static bool sas_ata_dev_eh_valid(struct domain_device *dev) | ||
| 722 | { | ||
| 723 | struct ata_port *ap; | ||
| 724 | |||
| 725 | if (!dev_is_sata(dev)) | ||
| 726 | return false; | ||
| 727 | ap = dev->sata_dev.ap; | ||
| 728 | /* consume fully initialized ata ports */ | ||
| 729 | smp_rmb(); | ||
| 730 | return !!ap; | ||
| 731 | } | ||
| 732 | |||
| 733 | void sas_ata_strategy_handler(struct Scsi_Host *shost) | 720 | void sas_ata_strategy_handler(struct Scsi_Host *shost) |
| 734 | { | 721 | { |
| 735 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | 722 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); |
| @@ -753,7 +740,7 @@ void sas_ata_strategy_handler(struct Scsi_Host *shost) | |||
| 753 | 740 | ||
| 754 | spin_lock(&port->dev_list_lock); | 741 | spin_lock(&port->dev_list_lock); |
| 755 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { | 742 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { |
| 756 | if (!sas_ata_dev_eh_valid(dev)) | 743 | if (!dev_is_sata(dev)) |
| 757 | continue; | 744 | continue; |
| 758 | async_schedule_domain(async_sas_ata_eh, dev, &async); | 745 | async_schedule_domain(async_sas_ata_eh, dev, &async); |
| 759 | } | 746 | } |
