diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 96 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 2 |
2 files changed, 52 insertions, 46 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index fecca4223f8e..f178a450ec08 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/workqueue.h> | 56 | #include <linux/workqueue.h> |
57 | #include <linux/scatterlist.h> | 57 | #include <linux/scatterlist.h> |
58 | #include <linux/io.h> | 58 | #include <linux/io.h> |
59 | #include <linux/async.h> | ||
59 | #include <scsi/scsi.h> | 60 | #include <scsi/scsi.h> |
60 | #include <scsi/scsi_cmnd.h> | 61 | #include <scsi/scsi_cmnd.h> |
61 | #include <scsi/scsi_host.h> | 62 | #include <scsi/scsi_host.h> |
@@ -5909,6 +5910,54 @@ void ata_host_init(struct ata_host *host, struct device *dev, | |||
5909 | host->ops = ops; | 5910 | host->ops = ops; |
5910 | } | 5911 | } |
5911 | 5912 | ||
5913 | |||
5914 | static void async_port_probe(void *data, async_cookie_t cookie) | ||
5915 | { | ||
5916 | int rc; | ||
5917 | struct ata_port *ap = data; | ||
5918 | /* probe */ | ||
5919 | if (ap->ops->error_handler) { | ||
5920 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
5921 | unsigned long flags; | ||
5922 | |||
5923 | ata_port_probe(ap); | ||
5924 | |||
5925 | /* kick EH for boot probing */ | ||
5926 | spin_lock_irqsave(ap->lock, flags); | ||
5927 | |||
5928 | ehi->probe_mask |= ATA_ALL_DEVICES; | ||
5929 | ehi->action |= ATA_EH_RESET | ATA_EH_LPM; | ||
5930 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | ||
5931 | |||
5932 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; | ||
5933 | ap->pflags |= ATA_PFLAG_LOADING; | ||
5934 | ata_port_schedule_eh(ap); | ||
5935 | |||
5936 | spin_unlock_irqrestore(ap->lock, flags); | ||
5937 | |||
5938 | /* wait for EH to finish */ | ||
5939 | ata_port_wait_eh(ap); | ||
5940 | } else { | ||
5941 | DPRINTK("ata%u: bus probe begin\n", ap->print_id); | ||
5942 | rc = ata_bus_probe(ap); | ||
5943 | DPRINTK("ata%u: bus probe end\n", ap->print_id); | ||
5944 | |||
5945 | if (rc) { | ||
5946 | /* FIXME: do something useful here? | ||
5947 | * Current libata behavior will | ||
5948 | * tear down everything when | ||
5949 | * the module is removed | ||
5950 | * or the h/w is unplugged. | ||
5951 | */ | ||
5952 | } | ||
5953 | } | ||
5954 | |||
5955 | /* in order to keep device order, we need to synchronize at this point */ | ||
5956 | async_synchronize_cookie(cookie); | ||
5957 | |||
5958 | ata_scsi_scan_host(ap, 1); | ||
5959 | |||
5960 | } | ||
5912 | /** | 5961 | /** |
5913 | * ata_host_register - register initialized ATA host | 5962 | * ata_host_register - register initialized ATA host |
5914 | * @host: ATA host to register | 5963 | * @host: ATA host to register |
@@ -5988,52 +6037,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
5988 | DPRINTK("probe begin\n"); | 6037 | DPRINTK("probe begin\n"); |
5989 | for (i = 0; i < host->n_ports; i++) { | 6038 | for (i = 0; i < host->n_ports; i++) { |
5990 | struct ata_port *ap = host->ports[i]; | 6039 | struct ata_port *ap = host->ports[i]; |
5991 | 6040 | async_schedule(async_port_probe, ap); | |
5992 | /* probe */ | ||
5993 | if (ap->ops->error_handler) { | ||
5994 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
5995 | unsigned long flags; | ||
5996 | |||
5997 | ata_port_probe(ap); | ||
5998 | |||
5999 | /* kick EH for boot probing */ | ||
6000 | spin_lock_irqsave(ap->lock, flags); | ||
6001 | |||
6002 | ehi->probe_mask |= ATA_ALL_DEVICES; | ||
6003 | ehi->action |= ATA_EH_RESET | ATA_EH_LPM; | ||
6004 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | ||
6005 | |||
6006 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; | ||
6007 | ap->pflags |= ATA_PFLAG_LOADING; | ||
6008 | ata_port_schedule_eh(ap); | ||
6009 | |||
6010 | spin_unlock_irqrestore(ap->lock, flags); | ||
6011 | |||
6012 | /* wait for EH to finish */ | ||
6013 | ata_port_wait_eh(ap); | ||
6014 | } else { | ||
6015 | DPRINTK("ata%u: bus probe begin\n", ap->print_id); | ||
6016 | rc = ata_bus_probe(ap); | ||
6017 | DPRINTK("ata%u: bus probe end\n", ap->print_id); | ||
6018 | |||
6019 | if (rc) { | ||
6020 | /* FIXME: do something useful here? | ||
6021 | * Current libata behavior will | ||
6022 | * tear down everything when | ||
6023 | * the module is removed | ||
6024 | * or the h/w is unplugged. | ||
6025 | */ | ||
6026 | } | ||
6027 | } | ||
6028 | } | ||
6029 | |||
6030 | /* probes are done, now scan each port's disk(s) */ | ||
6031 | DPRINTK("host probe begin\n"); | ||
6032 | for (i = 0; i < host->n_ports; i++) { | ||
6033 | struct ata_port *ap = host->ports[i]; | ||
6034 | |||
6035 | ata_scsi_scan_host(ap, 1); | ||
6036 | } | 6041 | } |
6042 | DPRINTK("probe end\n"); | ||
6037 | 6043 | ||
6038 | return 0; | 6044 | return 0; |
6039 | } | 6045 | } |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 4040d8b53216..9e92107691f2 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3369,7 +3369,7 @@ static void ata_scsi_remove_dev(struct ata_device *dev) | |||
3369 | 3369 | ||
3370 | if (sdev) { | 3370 | if (sdev) { |
3371 | ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n", | 3371 | ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n", |
3372 | sdev->sdev_gendev.bus_id); | 3372 | dev_name(&sdev->sdev_gendev)); |
3373 | 3373 | ||
3374 | scsi_remove_device(sdev); | 3374 | scsi_remove_device(sdev); |
3375 | scsi_device_put(sdev); | 3375 | scsi_device_put(sdev); |