public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: jaswinder.singh@linaro.org
Cc: linux-kernel@vger.kernel.org, sfr@canb.auug.org.au
Subject: Re: [PATCH] mailbox: mailbox-test: avoid reading iomem twice
Date: Wed, 4 Nov 2015 08:16:50 +0000	[thread overview]
Message-ID: <20151104081650.GH3503@x1> (raw)
In-Reply-To: <1446610026-14959-1-git-send-email-jassisinghbrar@gmail.com>

On Wed, 04 Nov 2015, jaswinder.singh@linaro.org wrote:

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

Nice fix Jassi.

Acked-by: Lee Jones <lee.jones@linaro.org>

> 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,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

      reply	other threads:[~2015-11-04  8:16 UTC|newest]

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

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=20151104081650.GH3503@x1 \
    --to=lee.jones@linaro.org \
    --cc=jaswinder.singh@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