]> git.hungrycats.org Git - linux/commitdiff
[libata] replace ATA_QCFLAG_ATAPI with inline helper
authorJeff Garzik <jgarzik@redhat.com>
Sun, 16 May 2004 21:41:56 +0000 (17:41 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Sun, 16 May 2004 21:41:56 +0000 (17:41 -0400)
Detection of an ATAPI taskfile is possible using a simple test
on existing information, so there is no need to cache this value
in a separate flag (ATA_QCFLAG_ATAPI).  Instead, create and use
a new helper function is_atapi_taskfile().

drivers/scsi/libata-core.c
drivers/scsi/libata-scsi.c
include/linux/ata.h
include/linux/libata.h

index f734a0c23c65b2371200116d6a5cc680f3b01451..b7efb16dcfb664fa2660340746dab8b427fdba45 100644 (file)
@@ -2321,7 +2321,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
 
        if (cmd) {
                if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ))) {
-                       if (qc->flags & ATA_QCFLAG_ATAPI)
+                       if (is_atapi_taskfile(&qc->tf))
                                cmd->result = SAM_STAT_CHECK_CONDITION;
                        else
                                ata_to_sense_error(qc);
index f5a1cd723a958a2fb399917886a5da1f8a44e71d..6bba4dee83e2fc1cf0f3482b0d4d34cfab5fb280 100644 (file)
@@ -951,8 +951,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
 {
        struct scsi_cmnd *cmd = qc->scsicmd;
 
-       qc->flags |= ATA_QCFLAG_ATAPI;
-
        qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
        if (cmd->sc_data_direction == SCSI_DATA_WRITE) {
                qc->tf.flags |= ATA_TFLAG_WRITE;
index 919509f32327d6a591d56e32a8ece5bca95ed394..38ccb84c039ebdb5c9b811e35a3dd14f0ef6f90b 100644 (file)
@@ -218,4 +218,10 @@ struct ata_taskfile {
          ((u64) dev->id[(n) + 1] << 16) |      \
          ((u64) dev->id[(n) + 0]) )
 
+static inline int is_atapi_taskfile(struct ata_taskfile *tf)
+{
+       return (tf->protocol == ATA_PROT_ATAPI) ||
+              (tf->protocol == ATA_PROT_ATAPI_DMA);
+}
+
 #endif /* __LINUX_ATA_H__ */
index 388d149cf2029270233c212581e63cd0b2c8fad5..18c90a0c1cfdbda1afaed70d608764c93d07a214 100644 (file)
@@ -111,7 +111,6 @@ enum {
 
        ATA_QCFLAG_ACTIVE       = (1 << 1), /* cmd not yet ack'd to scsi lyer */
        ATA_QCFLAG_DMA          = (1 << 2), /* data delivered via DMA */
-       ATA_QCFLAG_ATAPI        = (1 << 3), /* is ATAPI packet command? */
        ATA_QCFLAG_SG           = (1 << 4), /* have s/g table? */
 
        /* various lengths of time */