Separate out parts of ata_scsi_find_dev to be reused in future SAS/SATA patches. Signed-off-by: Brian King <brking@xxxxxxxxxx> --- libata-dev-bjking1/drivers/scsi/libata-scsi.c | 40 ++++++++++++++++++++------ 1 files changed, 31 insertions(+), 9 deletions(-) diff -puN drivers/scsi/libata-scsi.c~libata_scsi_enabled drivers/scsi/libata-scsi.c --- libata-dev/drivers/scsi/libata-scsi.c~libata_scsi_enabled 2006-04-13 14:45:58.000000000 -0500 +++ libata-dev-bjking1/drivers/scsi/libata-scsi.c 2006-04-13 14:45:58.000000000 -0500 @@ -2175,6 +2175,36 @@ static unsigned int atapi_xlat(struct at } /** + * ata_scsi_dev_enabled - determine if device is enabled + * @ap: ATA port to which the device is attached + * @dev: ATA device + * + * Determine if commands should be sent to the specified device. + * + * LOCKING: + * spin_lock_irqsave(host_set lock) + * + * RETURNS: + * 0 if commands are not allowed / 1 if commands are allowed + */ + +static int ata_scsi_dev_enabled(struct ata_port *ap, struct ata_device *dev) +{ + if (unlikely(!ata_dev_enabled(dev))) + return 0; + + if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) { + if (unlikely(dev->class == ATA_DEV_ATAPI)) { + printk(KERN_WARNING "ata%u(%u): WARNING: ATAPI is %s, device ignored.\n", + ap->id, dev->devno, atapi_enabled ? "not supported with this driver" : "disabled"); + return 0; + } + } + + return 1; +} + +/** * ata_scsi_find_dev - lookup ata_device from scsi_cmnd * @ap: ATA port to which the device is attached * @scsidev: SCSI device from which we derive the ATA device @@ -2206,17 +2236,9 @@ ata_scsi_find_dev(struct ata_port *ap, c (scsidev->lun != 0))) return NULL; - if (unlikely(!ata_dev_enabled(dev))) + if (unlikely(!ata_scsi_dev_enabled(ap, dev))) return NULL; - if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) { - if (unlikely(dev->class == ATA_DEV_ATAPI)) { - printk(KERN_WARNING "ata%u(%u): WARNING: ATAPI is %s, device ignored.\n", - ap->id, dev->devno, atapi_enabled ? "not supported with this driver" : "disabled"); - return NULL; - } - } - return dev; } _ - : send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html