From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932278AbbKDIQ6 (ORCPT ); Wed, 4 Nov 2015 03:16:58 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:34541 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755737AbbKDIQz (ORCPT ); Wed, 4 Nov 2015 03:16:55 -0500 Date: Wed, 4 Nov 2015 08:16:50 +0000 From: Lee Jones 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 Message-ID: <20151104081650.GH3503@x1> References: <1446610026-14959-1-git-send-email-jassisinghbrar@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1446610026-14959-1-git-send-email-jassisinghbrar@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 04 Nov 2015, jaswinder.singh@linaro.org wrote: > From: Jassi Brar > > 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 > --- > drivers/mailbox/mailbox-test.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) Nice fix Jassi. Acked-by: Lee Jones > 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