All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mvsdio: fix handling of partial word at the end of PIO transfer
@ 2009-07-10 18:19 Nicolas Pitre
  2009-07-31  9:44 ` Pierre Ossman
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Pitre @ 2009-07-10 18:19 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: lkml

Standard data flow for MMC/SD/SDIO cards requires that the mvsdio 
controller be set for big endian operation.  This is causing problems 
with buffers which length is not a multiple of 4 bytes as the last 
partial word doesn't get shifted all the way and stored properly in 
memory.  Let's compensate for this.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
CC: stable@kernel.org
---
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index b56d72f..34e2348 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -384,7 +384,7 @@ static irqreturn_t mvsd_irq(int irq, void *dev)
 				u16 val[2] = {0, 0};
 				val[0] = mvsd_read(MVSD_FIFO);
 				val[1] = mvsd_read(MVSD_FIFO);
-				memcpy(p, &val, s);
+				memcpy(p, ((void *)&val) + 4 - s, s);
 				s = 0;
 				intr_status = mvsd_read(MVSD_NOR_INTR_STATUS);
 			}
@@ -423,7 +423,7 @@ static irqreturn_t mvsd_irq(int irq, void *dev)
 		if (s < 4) {
 			if (s && (intr_status & MVSD_NOR_TX_AVAIL)) {
 				u16 val[2] = {0, 0};
-				memcpy(&val, p, s);
+				memcpy(((void *)&val) + 4 - s, p, s);
 				mvsd_write(MVSD_FIFO, val[0]);
 				mvsd_write(MVSD_FIFO, val[1]);
 				s = 0;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mvsdio: fix handling of partial word at the end of PIO transfer
  2009-07-10 18:19 [PATCH] mvsdio: fix handling of partial word at the end of PIO transfer Nicolas Pitre
@ 2009-07-31  9:44 ` Pierre Ossman
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre Ossman @ 2009-07-31  9:44 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: lkml

[-- Attachment #1: Type: text/plain, Size: 729 bytes --]

On Fri, 10 Jul 2009 14:19:42 -0400 (EDT)
Nicolas Pitre <nico@cam.org> wrote:

> Standard data flow for MMC/SD/SDIO cards requires that the mvsdio 
> controller be set for big endian operation.  This is causing problems 
> with buffers which length is not a multiple of 4 bytes as the last 
> partial word doesn't get shifted all the way and stored properly in 
> memory.  Let's compensate for this.
> 
> Signed-off-by: Nicolas Pitre <nico@marvell.com>
> CC: stable@kernel.org
> ---

Queued.

-- 
     -- Pierre Ossman

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-31  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10 18:19 [PATCH] mvsdio: fix handling of partial word at the end of PIO transfer Nicolas Pitre
2009-07-31  9:44 ` Pierre Ossman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.