aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-03-31 11:38:18 -0500
committerJeff Garzik <jeff@garzik.org>2006-04-01 12:33:45 -0500
commite1211e3fa7fd05ff0d4f597fd37e40de8acc6784 (patch)
tree672018d7facf99ad4d45b09e2e2980accebdfe38 /drivers/scsi
parent9974e7cc6c8b8ea796c92cdf28db93e4579a4000 (diff)
[PATCH] libata: implement ata_dev_enabled and disabled()
This patch renames ata_dev_present() to ata_dev_enabled() and adds ata_dev_disabled(). This is to discern the state where a device is present but disabled from not-present state. This disctinction is necessary when configuring transfer mode because device selection timing must not be violated even if a device fails to configure. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libata-core.c24
-rw-r--r--drivers/scsi/libata-scsi.c4
-rw-r--r--drivers/scsi/sata_mv.c2
-rw-r--r--drivers/scsi/sata_sil.c2
4 files changed, 16 insertions, 16 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 559abe4ea4e9..c10c550da38b 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -411,7 +411,7 @@ static const char *sata_spd_string(unsigned int spd)
411 411
412static void ata_dev_disable(struct ata_port *ap, struct ata_device *dev) 412static void ata_dev_disable(struct ata_port *ap, struct ata_device *dev)
413{ 413{
414 if (ata_dev_present(dev)) { 414 if (ata_dev_enabled(dev)) {
415 printk(KERN_WARNING "ata%u: dev %u disabled\n", 415 printk(KERN_WARNING "ata%u: dev %u disabled\n",
416 ap->id, dev->devno); 416 ap->id, dev->devno);
417 dev->class++; 417 dev->class++;
@@ -1222,7 +1222,7 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev,
1222 unsigned int xfer_mask; 1222 unsigned int xfer_mask;
1223 int i, rc; 1223 int i, rc;
1224 1224
1225 if (!ata_dev_present(dev)) { 1225 if (!ata_dev_enabled(dev)) {
1226 DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n", 1226 DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n",
1227 ap->id, dev->devno); 1227 ap->id, dev->devno);
1228 return 0; 1228 return 0;
@@ -1401,7 +1401,7 @@ static int ata_bus_probe(struct ata_port *ap)
1401 1401
1402 dev->class = classes[i]; 1402 dev->class = classes[i];
1403 1403
1404 if (!ata_dev_present(dev)) 1404 if (!ata_dev_enabled(dev))
1405 continue; 1405 continue;
1406 1406
1407 WARN_ON(dev->id != NULL); 1407 WARN_ON(dev->id != NULL);
@@ -1565,7 +1565,7 @@ void sata_phy_reset(struct ata_port *ap)
1565struct ata_device *ata_dev_pair(struct ata_port *ap, struct ata_device *adev) 1565struct ata_device *ata_dev_pair(struct ata_port *ap, struct ata_device *adev)
1566{ 1566{
1567 struct ata_device *pair = &ap->device[1 - adev->devno]; 1567 struct ata_device *pair = &ap->device[1 - adev->devno];
1568 if (!ata_dev_present(pair)) 1568 if (!ata_dev_enabled(pair))
1569 return NULL; 1569 return NULL;
1570 return pair; 1570 return pair;
1571} 1571}
@@ -1778,7 +1778,7 @@ static int ata_host_set_pio(struct ata_port *ap)
1778 for (i = 0; i < ATA_MAX_DEVICES; i++) { 1778 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1779 struct ata_device *dev = &ap->device[i]; 1779 struct ata_device *dev = &ap->device[i];
1780 1780
1781 if (!ata_dev_present(dev)) 1781 if (!ata_dev_enabled(dev))
1782 continue; 1782 continue;
1783 1783
1784 if (!dev->pio_mode) { 1784 if (!dev->pio_mode) {
@@ -1802,7 +1802,7 @@ static void ata_host_set_dma(struct ata_port *ap)
1802 for (i = 0; i < ATA_MAX_DEVICES; i++) { 1802 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1803 struct ata_device *dev = &ap->device[i]; 1803 struct ata_device *dev = &ap->device[i];
1804 1804
1805 if (!ata_dev_present(dev) || !dev->dma_mode) 1805 if (!ata_dev_enabled(dev) || !dev->dma_mode)
1806 continue; 1806 continue;
1807 1807
1808 dev->xfer_mode = dev->dma_mode; 1808 dev->xfer_mode = dev->dma_mode;
@@ -1830,7 +1830,7 @@ static void ata_set_mode(struct ata_port *ap)
1830 struct ata_device *dev = &ap->device[i]; 1830 struct ata_device *dev = &ap->device[i];
1831 unsigned int pio_mask, dma_mask; 1831 unsigned int pio_mask, dma_mask;
1832 1832
1833 if (!ata_dev_present(dev)) 1833 if (!ata_dev_enabled(dev))
1834 continue; 1834 continue;
1835 1835
1836 ata_dev_xfermask(ap, dev); 1836 ata_dev_xfermask(ap, dev);
@@ -1858,7 +1858,7 @@ static void ata_set_mode(struct ata_port *ap)
1858 for (i = 0; i < ATA_MAX_DEVICES; i++) { 1858 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1859 struct ata_device *dev = &ap->device[i]; 1859 struct ata_device *dev = &ap->device[i];
1860 1860
1861 if (!ata_dev_present(dev)) 1861 if (!ata_dev_enabled(dev))
1862 continue; 1862 continue;
1863 1863
1864 rc = ata_dev_set_mode(ap, dev); 1864 rc = ata_dev_set_mode(ap, dev);
@@ -2550,7 +2550,7 @@ int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev,
2550 u16 *id; 2550 u16 *id;
2551 int rc; 2551 int rc;
2552 2552
2553 if (!ata_dev_present(dev)) 2553 if (!ata_dev_enabled(dev))
2554 return -ENODEV; 2554 return -ENODEV;
2555 2555
2556 class = dev->class; 2556 class = dev->class;
@@ -2679,7 +2679,7 @@ static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev)
2679 /* FIXME: Use port-wide xfermask for now */ 2679 /* FIXME: Use port-wide xfermask for now */
2680 for (i = 0; i < ATA_MAX_DEVICES; i++) { 2680 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2681 struct ata_device *d = &ap->device[i]; 2681 struct ata_device *d = &ap->device[i];
2682 if (!ata_dev_present(d)) 2682 if (!ata_dev_enabled(d))
2683 continue; 2683 continue;
2684 xfer_mask &= ata_pack_xfermask(d->pio_mask, d->mwdma_mask, 2684 xfer_mask &= ata_pack_xfermask(d->pio_mask, d->mwdma_mask,
2685 d->udma_mask); 2685 d->udma_mask);
@@ -4299,7 +4299,7 @@ int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
4299 ap->flags &= ~ATA_FLAG_SUSPENDED; 4299 ap->flags &= ~ATA_FLAG_SUSPENDED;
4300 ata_set_mode(ap); 4300 ata_set_mode(ap);
4301 } 4301 }
4302 if (!ata_dev_present(dev)) 4302 if (!ata_dev_enabled(dev))
4303 return 0; 4303 return 0;
4304 if (dev->class == ATA_DEV_ATA) 4304 if (dev->class == ATA_DEV_ATA)
4305 ata_start_drive(ap, dev); 4305 ata_start_drive(ap, dev);
@@ -4317,7 +4317,7 @@ int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
4317 */ 4317 */
4318int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t state) 4318int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t state)
4319{ 4319{
4320 if (!ata_dev_present(dev)) 4320 if (!ata_dev_enabled(dev))
4321 return 0; 4321 return 0;
4322 if (dev->class == ATA_DEV_ATA) 4322 if (dev->class == ATA_DEV_ATA)
4323 ata_flush_cache(ap, dev); 4323 ata_flush_cache(ap, dev);
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 53f5b0d9161c..c1a4b29a9ae1 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2349,7 +2349,7 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
2349 (scsidev->lun != 0))) 2349 (scsidev->lun != 0)))
2350 return NULL; 2350 return NULL;
2351 2351
2352 if (unlikely(!ata_dev_present(dev))) 2352 if (unlikely(!ata_dev_enabled(dev)))
2353 return NULL; 2353 return NULL;
2354 2354
2355 if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) { 2355 if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
@@ -2743,7 +2743,7 @@ void ata_scsi_scan_host(struct ata_port *ap)
2743 for (i = 0; i < ATA_MAX_DEVICES; i++) { 2743 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2744 dev = &ap->device[i]; 2744 dev = &ap->device[i];
2745 2745
2746 if (ata_dev_present(dev)) 2746 if (ata_dev_enabled(dev))
2747 scsi_scan_target(&ap->host->shost_gendev, 0, i, 0, 0); 2747 scsi_scan_target(&ap->host->shost_gendev, 0, i, 0, 0);
2748 } 2748 }
2749} 2749}
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index fa901fd65085..0f7d334aadcc 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -1991,7 +1991,7 @@ comreset_retry:
1991 tf.nsect = readb((void __iomem *) ap->ioaddr.nsect_addr); 1991 tf.nsect = readb((void __iomem *) ap->ioaddr.nsect_addr);
1992 1992
1993 dev->class = ata_dev_classify(&tf); 1993 dev->class = ata_dev_classify(&tf);
1994 if (!ata_dev_present(dev)) { 1994 if (!ata_dev_enabled(dev)) {
1995 VPRINTK("Port disabled post-sig: No device present.\n"); 1995 VPRINTK("Port disabled post-sig: No device present.\n");
1996 ata_port_disable(ap); 1996 ata_port_disable(ap);
1997 } 1997 }
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index 18c296c56899..d6c7086a5379 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -264,7 +264,7 @@ static void sil_post_set_mode (struct ata_port *ap)
264 264
265 for (i = 0; i < 2; i++) { 265 for (i = 0; i < 2; i++) {
266 dev = &ap->device[i]; 266 dev = &ap->device[i];
267 if (!ata_dev_present(dev)) 267 if (!ata_dev_enabled(dev))
268 dev_mode[i] = 0; /* PIO0/1/2 */ 268 dev_mode[i] = 0; /* PIO0/1/2 */
269 else if (dev->flags & ATA_DFLAG_PIO) 269 else if (dev->flags & ATA_DFLAG_PIO)
270 dev_mode[i] = 1; /* PIO3/4 */ 270 dev_mode[i] = 1; /* PIO3/4 */