Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29542
b: refs/heads/master
c: 99ba9e0
h: refs/heads/master
v: v3
  • Loading branch information
Brian King authored and Jeff Garzik committed Jun 23, 2006
1 parent 6aa9da0 commit 0477f0c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba6a13083c1b720a47c05bee7bedbb6ef06c4611
refs/heads/master: 99ba9e093d058f6dff54f475136018e2e281d50f
41 changes: 31 additions & 10 deletions trunk/drivers/scsi/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2373,6 +2373,36 @@ static struct ata_device * __ata_scsi_find_dev(struct ata_port *ap,
return ata_find_dev(ap, scsidev->id);
}

/**
* ata_scsi_dev_enabled - determine if device is enabled
* @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_device *dev)
{
if (unlikely(!ata_dev_enabled(dev)))
return 0;

if (!atapi_enabled || (dev->ap->flags & ATA_FLAG_NO_ATAPI)) {
if (unlikely(dev->class == ATA_DEV_ATAPI)) {
ata_dev_printk(dev, KERN_WARNING,
"WARNING: ATAPI is %s, device ignored.\n",
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
Expand All @@ -2394,18 +2424,9 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
{
struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev);

if (unlikely(!dev || !ata_dev_enabled(dev)))
if (unlikely(!dev || !ata_scsi_dev_enabled(dev)))
return NULL;

if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
if (unlikely(dev->class == ATA_DEV_ATAPI)) {
ata_dev_printk(dev, KERN_WARNING,
"WARNING: ATAPI is %s, device ignored.\n",
atapi_enabled ? "not supported with this driver" : "disabled");
return NULL;
}
}

return dev;
}

Expand Down

0 comments on commit 0477f0c

Please sign in to comment.