public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: jaswinder.singh@linaro.org
To: linux-kernel@vger.kernel.org
Cc: lee.jones@linaro.org, sfr@canb.auug.org.au,
	Jassi Brar <jaswinder.singh@linaro.org>
Subject: [PATCH] mailbox: mailbox-test: avoid reading iomem twice
Date: Wed,  4 Nov 2015 09:37:06 +0530	[thread overview]
Message-ID: <1446610026-14959-1-git-send-email-jassisinghbrar@gmail.com> (raw)

From: Jassi Brar <jaswinder.singh@linaro.org>

Don't pass mmio region as source to print_hex_dump() and then
again to memcpy_fromio(). Do it once and give print_hex_dump()
the buffer we just read the data in.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
---
 drivers/mailbox/mailbox-test.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index f82dc89..684ae17 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -221,11 +221,10 @@ static void mbox_test_receive_message(struct mbox_client *client, void *message)
 
 	spin_lock_irqsave(&tdev->lock, flags);
 	if (tdev->mmio) {
+		memcpy_fromio(tdev->rx_buffer, tdev->mmio, MBOX_MAX_MSG_LEN);
 		print_hex_dump(KERN_INFO, "Client: Received [MMIO]: ",
 			       DUMP_PREFIX_ADDRESS, MBOX_BYTES_PER_LINE, 1,
-			       __io_virt(tdev->mmio), MBOX_MAX_MSG_LEN, true);
-		memcpy_fromio(tdev->rx_buffer, tdev->mmio, MBOX_MAX_MSG_LEN);
-
+			       tdev->rx_buffer, MBOX_MAX_MSG_LEN, true);
 	} else if (message) {
 		print_hex_dump(KERN_INFO, "Client: Received [API]: ",
 			       DUMP_PREFIX_ADDRESS, MBOX_BYTES_PER_LINE, 1,
-- 
1.9.1


             reply	other threads:[~2015-11-04  4:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04  4:07 jaswinder.singh [this message]
2015-11-04  8:16 ` [PATCH] mailbox: mailbox-test: avoid reading iomem twice Lee Jones

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=1446610026-14959-1-git-send-email-jassisinghbrar@gmail.com \
    --to=jaswinder.singh@linaro.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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