]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[libata] minor fixes, new helpers
authorJeff Garzik <jgarzik@pobox.com>
Mon, 14 Nov 2005 19:14:16 +0000 (14:14 -0500)
committerJeff Garzik <jgarzik@pobox.com>
Mon, 14 Nov 2005 19:14:16 +0000 (14:14 -0500)
- in ata_dev_identify(), don't assume that all devices are either
  ATA or ATAPI.  In the future, this code will see port multipliers
  and other devices.
- make a debugging printk less verbose
- add new helper ata_qc_reinit()
- add new helper BPRINTK() and port flag ATA_FLAG_DEBUGMSG, for
  fine-grained debugging use.

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

index 1ccaf467d516a943077caa4765adb3c93a40927a..3855bfa8e8d4465a88a2be80383241eec0873bd3 100644 (file)
@@ -1263,7 +1263,7 @@ retry:
        }
 
        /* ATAPI-specific feature tests */
-       else {
+       else if (dev->class == ATA_DEV_ATAPI) {
                if (ata_id_is_ata(dev->id))             /* sanity check */
                        goto err_out_nosup;
 
@@ -2399,7 +2399,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
        if (qc->flags & ATA_QCFLAG_SINGLE)
                assert(qc->n_elem == 1);
 
-       DPRINTK("unmapping %u sg elements\n", qc->n_elem);
+       VPRINTK("unmapping %u sg elements\n", qc->n_elem);
 
        /* if we padded the buffer out to 32-bit bound, and data
         * xfer direction is from-device, we must copy from the
@@ -3432,16 +3432,11 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
 
        qc = ata_qc_new(ap);
        if (qc) {
-               qc->__sg = NULL;
-               qc->flags = 0;
                qc->scsicmd = NULL;
                qc->ap = ap;
                qc->dev = dev;
-               qc->cursect = qc->cursg = qc->cursg_ofs = 0;
-               qc->nsect = 0;
-               qc->nbytes = qc->curbytes = 0;
 
-               ata_tf_init(ap, &qc->tf, dev->devno);
+               ata_qc_reinit(qc);
        }
 
        return qc;
index ad5996183ec2fcfa83c0c0068f7774cb0112f3e3..f2dbb684ce9e4fce7e76ed09399ebf68cbe2c068 100644 (file)
@@ -59,6 +59,8 @@
 #define VPRINTK(fmt, args...)
 #endif /* ATA_DEBUG */
 
+#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
+
 #ifdef ATA_NDEBUG
 #define assert(expr)
 #else
@@ -119,6 +121,7 @@ enum {
        ATA_FLAG_PIO_DMA        = (1 << 8), /* PIO cmds via DMA */
        ATA_FLAG_NOINTR         = (1 << 9), /* FIXME: Remove this once
                                             * proper HSM is in place. */
+       ATA_FLAG_DEBUGMSG       = (1 << 10),
 
        ATA_QCFLAG_ACTIVE       = (1 << 1), /* cmd not yet ack'd to scsi lyer */
        ATA_QCFLAG_SG           = (1 << 3), /* have s/g table? */
@@ -659,6 +662,17 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns
                tf->device = ATA_DEVICE_OBS | ATA_DEV1;
 }
 
+static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
+{
+       qc->__sg = NULL;
+       qc->flags = 0;
+       qc->cursect = qc->cursg = qc->cursg_ofs = 0;
+       qc->nsect = 0;
+       qc->nbytes = qc->curbytes = 0;
+
+       ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
+}
+
 
 /**
  *     ata_irq_on - Enable interrupts on a port.