aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian King <brking@us.ibm.com>2006-06-12 15:54:17 -0400
committerJeff Garzik <jeff@garzik.org>2006-06-22 23:46:45 -0400
commit99ba9e093d058f6dff54f475136018e2e281d50f (patch)
tree8e69fbee21e413dc0f452cf3fb9bf3c383265c49
parentba6a13083c1b720a47c05bee7bedbb6ef06c4611 (diff)
[PATCH] libata: Add ata_scsi_dev_disabled
Separate out parts of ata_scsi_find_dev to be reused in future SAS/SATA patches. Acked-by: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/scsi/libata-scsi.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index d86abed62007..93d18a74c401 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2374,6 +2374,36 @@ static struct ata_device * __ata_scsi_find_dev(struct ata_port *ap,
2374} 2374}
2375 2375
2376/** 2376/**
2377 * ata_scsi_dev_enabled - determine if device is enabled
2378 * @dev: ATA device
2379 *
2380 * Determine if commands should be sent to the specified device.
2381 *
2382 * LOCKING:
2383 * spin_lock_irqsave(host_set lock)
2384 *
2385 * RETURNS:
2386 * 0 if commands are not allowed / 1 if commands are allowed
2387 */
2388
2389static int ata_scsi_dev_enabled(struct ata_device *dev)
2390{
2391 if (unlikely(!ata_dev_enabled(dev)))
2392 return 0;
2393
2394 if (!atapi_enabled || (dev->ap->flags & ATA_FLAG_NO_ATAPI)) {
2395 if (unlikely(dev->class == ATA_DEV_ATAPI)) {
2396 ata_dev_printk(dev, KERN_WARNING,
2397 "WARNING: ATAPI is %s, device ignored.\n",
2398 atapi_enabled ? "not supported with this driver" : "disabled");
2399 return 0;
2400 }
2401 }
2402
2403 return 1;
2404}
2405
2406/**
2377 * ata_scsi_find_dev - lookup ata_device from scsi_cmnd 2407 * ata_scsi_find_dev - lookup ata_device from scsi_cmnd
2378 * @ap: ATA port to which the device is attached 2408 * @ap: ATA port to which the device is attached
2379 * @scsidev: SCSI device from which we derive the ATA device 2409 * @scsidev: SCSI device from which we derive the ATA device
@@ -2394,18 +2424,9 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
2394{ 2424{
2395 struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev); 2425 struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev);
2396 2426
2397 if (unlikely(!dev || !ata_dev_enabled(dev))) 2427 if (unlikely(!dev || !ata_scsi_dev_enabled(dev)))
2398 return NULL; 2428 return NULL;
2399 2429
2400 if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
2401 if (unlikely(dev->class == ATA_DEV_ATAPI)) {
2402 ata_dev_printk(dev, KERN_WARNING,
2403 "WARNING: ATAPI is %s, device ignored.\n",
2404 atapi_enabled ? "not supported with this driver" : "disabled");
2405 return NULL;
2406 }
2407 }
2408
2409 return dev; 2430 return dev;
2410} 2431}
2411 2432