* [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h
@ 2010-08-14 20:29 Guennadi Liakhovetski
2010-08-15 1:56 ` Eric Miao
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-14 20:29 UTC (permalink / raw)
To: linux-mmc; +Cc: Ian Molton, Magnus Damm, Eric Miao
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/mmc/host/tmio_mmc.c | 7 ++++---
drivers/mmc/host/tmio_mmc.h | 8 +++-----
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index ee7d0a5..69d98e3 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -164,6 +164,7 @@ tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)
static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
{
struct mmc_data *data = host->data;
+ void *sg_virt;
unsigned short *buf;
unsigned int count;
unsigned long flags;
@@ -173,8 +174,8 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
return;
}
- buf = (unsigned short *)(tmio_mmc_kmap_atomic(host, &flags) +
- host->sg_off);
+ sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr, &flags);
+ buf = (unsigned short *)(sg_virt + host->sg_off);
count = host->sg_ptr->length - host->sg_off;
if (count > data->blksz)
@@ -191,7 +192,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
host->sg_off += count;
- tmio_mmc_kunmap_atomic(host, &flags);
+ tmio_mmc_kunmap_atomic(sg_virt, &flags);
if (host->sg_off == host->sg_ptr->length)
tmio_mmc_next_sg(host);
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 64f7d5d..446f9e9 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -177,19 +177,17 @@ static inline int tmio_mmc_next_sg(struct tmio_mmc_host *host)
return --host->sg_len;
}
-static inline char *tmio_mmc_kmap_atomic(struct tmio_mmc_host *host,
+static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg,
unsigned long *flags)
{
- struct scatterlist *sg = host->sg_ptr;
-
local_irq_save(*flags);
return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset;
}
-static inline void tmio_mmc_kunmap_atomic(struct tmio_mmc_host *host,
+static inline void tmio_mmc_kunmap_atomic(void *virt,
unsigned long *flags)
{
- kunmap_atomic(sg_page(host->sg_ptr), KM_BIO_SRC_IRQ);
+ kunmap_atomic(virt, KM_BIO_SRC_IRQ);
local_irq_restore(*flags);
}
--
1.7.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h
2010-08-14 20:29 [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h Guennadi Liakhovetski
@ 2010-08-15 1:56 ` Eric Miao
2010-08-16 2:44 ` Magnus Damm
2010-08-26 23:04 ` Andrew Morton
2 siblings, 0 replies; 5+ messages in thread
From: Eric Miao @ 2010-08-15 1:56 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-mmc, Ian Molton, Magnus Damm
On Sun, Aug 15, 2010 at 4:29 AM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
If I understand the kunmap_atomic() thing correctly, this looks good to me.
Acked-by: Eric Miao <eric.y.miao@gmail.com>
> ---
> drivers/mmc/host/tmio_mmc.c | 7 ++++---
> drivers/mmc/host/tmio_mmc.h | 8 +++-----
> 2 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> index ee7d0a5..69d98e3 100644
> --- a/drivers/mmc/host/tmio_mmc.c
> +++ b/drivers/mmc/host/tmio_mmc.c
> @@ -164,6 +164,7 @@ tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)
> static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
> {
> struct mmc_data *data = host->data;
> + void *sg_virt;
> unsigned short *buf;
> unsigned int count;
> unsigned long flags;
> @@ -173,8 +174,8 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
> return;
> }
>
> - buf = (unsigned short *)(tmio_mmc_kmap_atomic(host, &flags) +
> - host->sg_off);
> + sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr, &flags);
> + buf = (unsigned short *)(sg_virt + host->sg_off);
>
> count = host->sg_ptr->length - host->sg_off;
> if (count > data->blksz)
> @@ -191,7 +192,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
>
> host->sg_off += count;
>
> - tmio_mmc_kunmap_atomic(host, &flags);
> + tmio_mmc_kunmap_atomic(sg_virt, &flags);
>
> if (host->sg_off == host->sg_ptr->length)
> tmio_mmc_next_sg(host);
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 64f7d5d..446f9e9 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -177,19 +177,17 @@ static inline int tmio_mmc_next_sg(struct tmio_mmc_host *host)
> return --host->sg_len;
> }
>
> -static inline char *tmio_mmc_kmap_atomic(struct tmio_mmc_host *host,
> +static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg,
> unsigned long *flags)
> {
> - struct scatterlist *sg = host->sg_ptr;
> -
> local_irq_save(*flags);
> return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset;
> }
>
> -static inline void tmio_mmc_kunmap_atomic(struct tmio_mmc_host *host,
> +static inline void tmio_mmc_kunmap_atomic(void *virt,
> unsigned long *flags)
> {
> - kunmap_atomic(sg_page(host->sg_ptr), KM_BIO_SRC_IRQ);
> + kunmap_atomic(virt, KM_BIO_SRC_IRQ);
> local_irq_restore(*flags);
> }
>
> --
> 1.7.2
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h
2010-08-14 20:29 [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h Guennadi Liakhovetski
2010-08-15 1:56 ` Eric Miao
@ 2010-08-16 2:44 ` Magnus Damm
2010-08-26 23:04 ` Andrew Morton
2 siblings, 0 replies; 5+ messages in thread
From: Magnus Damm @ 2010-08-16 2:44 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-mmc, Ian Molton, Magnus Damm, Eric Miao
On Sun, Aug 15, 2010 at 5:29 AM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> drivers/mmc/host/tmio_mmc.c | 7 ++++---
> drivers/mmc/host/tmio_mmc.h | 8 +++-----
> 2 files changed, 7 insertions(+), 8 deletions(-)
I just used this patch with latest linux-2.6 git to fix the tmio_mmc
compile error. Some light testing on AP4EVB with insmod and rmmod
(and Runtime PM) worked just fine. Thanks!
Tested-by: Magnus Damm <damm@opensource.se>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h
2010-08-14 20:29 [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h Guennadi Liakhovetski
2010-08-15 1:56 ` Eric Miao
2010-08-16 2:44 ` Magnus Damm
@ 2010-08-26 23:04 ` Andrew Morton
2010-08-27 7:01 ` Guennadi Liakhovetski
2 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2010-08-26 23:04 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-mmc, Ian Molton, Magnus Damm, Eric Miao
On Sat, 14 Aug 2010 22:29:40 +0200 (CEST)
Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
No changelog :(
- what was wrong with the old code?
- how did the patch fix it?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h
2010-08-26 23:04 ` Andrew Morton
@ 2010-08-27 7:01 ` Guennadi Liakhovetski
0 siblings, 0 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-27 7:01 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mmc, Ian Molton, Magnus Damm, Eric Miao
Hi Andrew
On Thu, 26 Aug 2010, Andrew Morton wrote:
> On Sat, 14 Aug 2010 22:29:40 +0200 (CEST)
> Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
>
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
>
> No changelog :(
Sorry, I thought this was one of the cases, where the subject says it all.
> - what was wrong with the old code?
>
> - how did the patch fix it?
How about:
kunmap_atomic() takes the cookie, returned by the kmap_atomic() as its
argument and not the page address, used as an argument to kmap_atomic().
This patch fixes the compile error:
In file included from /opt/src/linux-2.6/drivers/mmc/host/tmio_mmc.c:37:
/opt/src/linux-2.6/drivers/mmc/host/tmio_mmc.h: In function 'tmio_mmc_kunmap_atomic':
/opt/src/linux-2.6/drivers/mmc/host/tmio_mmc.h:192: error: negative width in bit-field '<anonymous>'
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-27 7:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-14 20:29 [PATCH] MMC: fix the use of kunmap_atomic() in tmio_mmc.h Guennadi Liakhovetski
2010-08-15 1:56 ` Eric Miao
2010-08-16 2:44 ` Magnus Damm
2010-08-26 23:04 ` Andrew Morton
2010-08-27 7:01 ` Guennadi Liakhovetski
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.