Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751544AbdF1IsM convert rfc822-to-8bit (ORCPT ); Wed, 28 Jun 2017 04:48:12 -0400 Received: from smtp-out4.electric.net ([192.162.216.186]:54554 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751500AbdF1Ir5 (ORCPT ); Wed, 28 Jun 2017 04:47:57 -0400 From: David Laight To: "'Al Cooper'" , "linux-kernel@vger.kernel.org" CC: Greg Kroah-Hartman , Rob Herring , Mark Rutland , Felipe Balbi , yuan linyu , "Florian Fainelli" , "open list:USB SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "bcm-kernel-feedback-list@broadcom.com" Subject: RE: [PATCH 4/8] usb: bdc: Small code cleanup Thread-Topic: [PATCH 4/8] usb: bdc: Small code cleanup Thread-Index: AQHS73LeTZeMAZhjJEqkI5sdpyP6UKI59Odg Date: Wed, 28 Jun 2017 08:47:34 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD002C93C@AcuExch.aculab.com> References: <1498587806-24781-1-git-send-email-alcooperx@gmail.com> <1498587806-24781-5-git-send-email-alcooperx@gmail.com> In-Reply-To: <1498587806-24781-5-git-send-email-alcooperx@gmail.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1456 Lines: 42 From: Al Cooper > Sent: 27 June 2017 19:23 > Signed-off-by: Al Cooper > --- > drivers/usb/gadget/udc/bdc/bdc_core.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c > index 3bd82d2..621328f 100644 > --- a/drivers/usb/gadget/udc/bdc/bdc_core.c > +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c > @@ -488,28 +488,29 @@ static int bdc_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, bdc); > bdc->irq = irq; > bdc->dev = dev; > - dev_dbg(bdc->dev, "bdc->regs: %p irq=%d\n", bdc->regs, bdc->irq); > + dev_dbg(dev, "bdc->regs: %p irq=%d\n", bdc->regs, bdc->irq); The compiler will use the value without re-reading it. In the other places it makes very little difference. The changed code might require one less memory read, but if the extra 'live' local variable causes gcc to save registers to stack all bets are off. The more explicit bdc->dev is probably more readable. > > temp = bdc_readl(bdc->regs, BDC_BDCSC); > if ((temp & BDC_P64) && > !dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64))) { > - dev_dbg(bdc->dev, "Using 64-bit address\n"); > + dev_dbg(dev, "Using 64-bit address\n"); > } else { > - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); That just wrong... Or was wrong before. ... David