Skip to contentSkip to conversation

pata_arasan_cf: declare/use 'qc' and 'ap' variables in arasan_cf_dma_start()

PATCH In review Sergei Shtylyov 3 participants 4 messages Oct 25, 2012 – Oct 26, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pata_arasan_cf: declare/use 'qc' and 'ap' variables in arasan_cf_dma_start()

'acdev->qc' and 'acdev->qc->ap' expressions are used multiple times in this function, so it makes sense to use the local variables for them.

---
The patch is atop of the 'upstream' branch of libata-dev.git...

 drivers/ata/pata_arasan_cf.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ata/pata_arasan_cf.c +4 -2
Index: libata-dev/drivers/ata/pata_arasan_cf.c
===================================================================
@@ -668,13 +668,15 @@ void arasan_cf_error_handler(struct ata_
 
 static void arasan_cf_dma_start(struct arasan_cf_dev *acdev)
 {
+	struct ata_queued_cmd *qc = acdev->qc;
+	struct ata_port *ap = qc->ap;
 	u32 xfer_ctr = readl(acdev->vbase + XFER_CTR) & ~XFER_DIR_MASK;
-	u32 write = acdev->qc->tf.flags & ATA_TFLAG_WRITE;
+	u32 write = qc->tf.flags & ATA_TFLAG_WRITE;
 
 	xfer_ctr |= write ? XFER_WRITE : XFER_READ;
 	writel(xfer_ctr, acdev->vbase + XFER_CTR);
 
-	acdev->qc->ap->ops->sff_exec_command(acdev->qc->ap, &acdev->qc->tf);
+	ap->ops->sff_exec_command(ap, &qc->tf);
 	ata_sff_queue_work(&acdev->work);
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Sergei Shtylyov

'acdev->qc' and 'acdev->qc->ap' expressions are used multiple times in this function, so it makes sense to use the local variables for them.

Quoted 28 lines

---
The patch is atop of the 'upstream' branch of libata-dev.git...

 drivers/ata/pata_arasan_cf.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: libata-dev/drivers/ata/pata_arasan_cf.c
===================================================================

drivers/ata/pata_arasan_cf.c +4 -2
@@ -668,13 +668,15 @@ void arasan_cf_error_handler(struct ata_
 
 static void arasan_cf_dma_start(struct arasan_cf_dev *acdev)
 {
+       struct ata_queued_cmd *qc = acdev->qc;
+       struct ata_port *ap = qc->ap;
        u32 xfer_ctr = readl(acdev->vbase + XFER_CTR) & ~XFER_DIR_MASK;
-       u32 write = acdev->qc->tf.flags & ATA_TFLAG_WRITE;
+       u32 write = qc->tf.flags & ATA_TFLAG_WRITE;
 
        xfer_ctr |= write ? XFER_WRITE : XFER_READ;
        writel(xfer_ctr, acdev->vbase + XFER_CTR);
 
-       acdev->qc->ap->ops->sff_exec_command(acdev->qc->ap, &acdev->qc->tf);
+       ap->ops->sff_exec_command(ap, &qc->tf);
        ata_sff_queue_work(&acdev->work);
 }
 
#2 lore raw

Hello.

Quoted 6 lines · viresh kumar
Quoted 4 lines

'acdev->qc' and 'acdev->qc->ap' expressions are used multiple times in this function, so it makes sense to use the local variables for them.

Another idea came to me afterwards...

Quoted 20 lines
Quoted 20 lines

---
The patch is atop of the 'upstream' branch of libata-dev.git...

 drivers/ata/pata_arasan_cf.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: libata-dev/drivers/ata/pata_arasan_cf.c
===================================================================

drivers/ata/pata_arasan_cf.c +3 -1
@@ -668,13 +668,15 @@ void arasan_cf_error_handler(struct ata_
 
 static void arasan_cf_dma_start(struct arasan_cf_dev *acdev)
 {
+       struct ata_queued_cmd *qc = acdev->qc;
+       struct ata_port *ap = qc->ap;
        u32 xfer_ctr = readl(acdev->vbase + XFER_CTR) & ~XFER_DIR_MASK;
-       u32 write = acdev->qc->tf.flags & ATA_TFLAG_WRITE;
+       u32 write = qc->tf.flags & ATA_TFLAG_WRITE;
 
Quoted 5 lines

drivers/ata/pata_arasan_cf.c void arasan_cf_error_handler(struct ata_ · line 679

Quoted 5 lines
drivers/ata/pata_arasan_cf.c +1 -1
        xfer_ctr |= write ? XFER_WRITE : XFER_READ;
        writel(xfer_ctr, acdev->vbase + XFER_CTR);
 
-       acdev->qc->ap->ops->sff_exec_command(acdev->qc->ap, &acdev->qc->tf);
+       ap->ops->sff_exec_command(ap, &qc->tf);

Perhaps it was also worth declaring:

	struct ata_taskfile *tf = &qc->tf;

I'll submit the next version of patch next week, probably...

MBR, Sergei

#3 lore raw
Quoted 5 lines · Sergei Shtylyov

Perhaps it was also worth declaring:

        struct ata_taskfile *tf = &qc->tf;

I'll submit the next version of patch next week, probably...

Looks fine. Add my acked-by in advance :)