linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci: Remove redundant ADMA page boundary warnings
@ 2014-12-22 12:23 Andrew Gabbasov
  2014-12-30 10:58 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Gabbasov @ 2014-12-22 12:23 UTC (permalink / raw)
  To: linux-mmc

The bounce buffer, used for misaligned bytes for ADMA access,
resides wholly within the (align_sz)-aligned word, just by construction.
The page addresses are aligned to (align_sz), either for 4 or 8 bytes
alignment, so that the aligned word resides wholly within a single page
and can't cross the page boundary. So, the bounce buffer can't cross
the page boundary too. That's why the warnings are never hit, and can
be safely removed.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
---
 drivers/mmc/host/sdhci.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index cbb245b..9dc2770 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -533,8 +533,6 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
 		if (offset) {
 			if (data->flags & MMC_DATA_WRITE) {
 				buffer = sdhci_kmap_atomic(sg, &flags);
-				WARN_ON(((long)buffer & (PAGE_SIZE - 1)) >
-					(PAGE_SIZE - offset));
 				memcpy(align, buffer, offset);
 				sdhci_kunmap_atomic(buffer, &flags);
 			}
@@ -641,8 +639,6 @@ static void sdhci_adma_table_post(struct sdhci_host *host,
 				       (sg_dma_address(sg) & host->align_mask);
 
 				buffer = sdhci_kmap_atomic(sg, &flags);
-				WARN_ON(((long)buffer & (PAGE_SIZE - 1)) >
-					(PAGE_SIZE - size));
 				memcpy(buffer, align, size);
 				sdhci_kunmap_atomic(buffer, &flags);
 
-- 
2.1.0


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

* Re: [PATCH] mmc: sdhci: Remove redundant ADMA page boundary warnings
  2014-12-22 12:23 [PATCH] mmc: sdhci: Remove redundant ADMA page boundary warnings Andrew Gabbasov
@ 2014-12-30 10:58 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2014-12-30 10:58 UTC (permalink / raw)
  To: Andrew Gabbasov; +Cc: linux-mmc

On 22 December 2014 at 13:23, Andrew Gabbasov
<andrew_gabbasov@mentor.com> wrote:
> The bounce buffer, used for misaligned bytes for ADMA access,
> resides wholly within the (align_sz)-aligned word, just by construction.
> The page addresses are aligned to (align_sz), either for 4 or 8 bytes
> alignment, so that the aligned word resides wholly within a single page
> and can't cross the page boundary. So, the bounce buffer can't cross
> the page boundary too. That's why the warnings are never hit, and can
> be safely removed.
>
> Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index cbb245b..9dc2770 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -533,8 +533,6 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
>                 if (offset) {
>                         if (data->flags & MMC_DATA_WRITE) {
>                                 buffer = sdhci_kmap_atomic(sg, &flags);
> -                               WARN_ON(((long)buffer & (PAGE_SIZE - 1)) >
> -                                       (PAGE_SIZE - offset));
>                                 memcpy(align, buffer, offset);
>                                 sdhci_kunmap_atomic(buffer, &flags);
>                         }
> @@ -641,8 +639,6 @@ static void sdhci_adma_table_post(struct sdhci_host *host,
>                                        (sg_dma_address(sg) & host->align_mask);
>
>                                 buffer = sdhci_kmap_atomic(sg, &flags);
> -                               WARN_ON(((long)buffer & (PAGE_SIZE - 1)) >
> -                                       (PAGE_SIZE - size));
>                                 memcpy(buffer, align, size);
>                                 sdhci_kunmap_atomic(buffer, &flags);
>
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2014-12-30 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-22 12:23 [PATCH] mmc: sdhci: Remove redundant ADMA page boundary warnings Andrew Gabbasov
2014-12-30 10:58 ` Ulf Hansson

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).