linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: linux-ide@vger.kernel.org, tj@kernel.org
Cc: linux-sh@vger.kernel.org
Subject: [PATCH 1/3] sata_rcar: kill superfluous code in sata_rcar_bmdma_fill_sg()
Date: Mon, 27 May 2013 22:43:23 +0000	[thread overview]
Message-ID: <201305280243.23983.sergei.shtylyov@cogentembedded.com> (raw)
In-Reply-To: <201305280238.17867.sergei.shtylyov@cogentembedded.com>

I've modified sata_rcar_bmdma_fill_sg() to take care of splitting long scatter/
gather segments due to the descriptor table transfer counter being only 28 bits
wide (bit 1 to bit 28) but that was in vain as even if 'sata_rcar_sht' specified
a correct 'dma_boundary' field, the DMA and block layers would have split the
S/G segments on the necassary boundaries. Since the driver uses ATA_BMDMA_SHT()
to initilaize 'sata_rcar_sht', the boundary is much smaller, only 0xFFFF, so the
code I've added is even more useless, and it's better to just remove it.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/ata/sata_rcar.c |   24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

Index: libata/drivers/ata/sata_rcar.c
=================================--- libata.orig/drivers/ata/sata_rcar.c
+++ libata/drivers/ata/sata_rcar.c
@@ -474,11 +474,10 @@ static void sata_rcar_bmdma_fill_sg(stru
 	struct ata_port *ap = qc->ap;
 	struct ata_bmdma_prd *prd = ap->bmdma_prd;
 	struct scatterlist *sg;
-	unsigned int si, pi;
+	unsigned int si;
 
-	pi = 0;
 	for_each_sg(qc->sg, sg, qc->n_elem, si) {
-		u32 addr, sg_len, len;
+		u32 addr, sg_len;
 
 		/*
 		 * Note: h/w doesn't support 64-bit, so we unconditionally
@@ -487,24 +486,13 @@ static void sata_rcar_bmdma_fill_sg(stru
 		addr = (u32)sg_dma_address(sg);
 		sg_len = sg_dma_len(sg);
 
-		/* H/w transfer count is only 29 bits long, let's be careful */
-		while (sg_len) {
-			len = sg_len;
-			if (len > 0x1ffffffe)
-				len = 0x1ffffffe;
-
-			prd[pi].addr = cpu_to_le32(addr);
-			prd[pi].flags_len = cpu_to_le32(len);
-			VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
-
-			pi++;
-			sg_len -= len;
-			addr += len;
-		}
+		prd[si].addr = cpu_to_le32(addr);
+		prd[si].flags_len = cpu_to_le32(sg_len);
+		VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len);
 	}
 
 	/* end-of-table flag */
-	prd[pi - 1].addr |= cpu_to_le32(SATA_RCAR_DTEND);
+	prd[si - 1].addr |= cpu_to_le32(SATA_RCAR_DTEND);
 }
 
 static void sata_rcar_qc_prep(struct ata_queued_cmd *qc)

  reply	other threads:[~2013-05-27 22:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27 22:38 [PATCH 0/3] Optimize R-Car SATA driver Sergei Shtylyov
2013-05-27 22:43 ` Sergei Shtylyov [this message]
2013-05-27 22:45 ` [PATCH 2/3] sata_rcar: correct 'sata_rcar_sht' Sergei Shtylyov
2013-05-27 22:46 ` [PATCH 3/3] sata_rcar: add 'base' local variable to some functions Sergei Shtylyov
2013-05-28  0:20 ` [PATCH 0/3] Optimize R-Car SATA driver Tejun Heo
2013-05-28 11:53   ` Sergei Shtylyov
2013-05-28 11:58     ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201305280243.23983.sergei.shtylyov@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).