Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1416117ybn; Wed, 25 Sep 2019 18:05:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqysCpVU5UssV/n1+Bv19oJjZTl3230NnteJq3snUBAtR+VWc1liqQnu8VZQjRMyMRWtFFzn X-Received: by 2002:a17:906:6d1:: with SMTP id v17mr923315ejb.74.1569459952988; Wed, 25 Sep 2019 18:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569459952; cv=none; d=google.com; s=arc-20160816; b=GJHh9EwOmn54ncu2+bqaSBnLRH2SaTXRjNjVUM+dryUJx31n7GSwRjBMPPxCI1ZrWM g8KmPHfRsYDWw+W2JtzGbZeWpw26lmGtL3WAEhHQsfD99Sv8pHU3soDMsN1v4qlRmueJ bpKvT8GbiTX1mFL1RzHjtIljJtJIfv5HnuLRW5E9mBgz8uUUMBp8EV6gBtob9Dnvd6rA EvIVP4WOoGrYf0b+Hx5I7akDUuHhNNfOWV2Bysr7VvxVmkEMYtDUsmPoj29TSDAwdRSw zD9FhPYovCCICp0g9mTFIiKecZnmKGj5hBSl9cHGGjrZyKZ7aDAizmqLPJ2ggcGxjIx0 8JgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=MSzDm9aPjpnl2CBXXRFRTwnisp8QYiN0LGtmWbeiEy0=; b=XlMOcyizE9UpBiwVeeSHWTmLPRNnxRBXYP1i/VIDp/Y2x9UCvfDMzkVvmRQSWy83ve XPyNl1bboSxxoUWTIXADnltvbGhPkGUqx8mcLzLiemKDA4NRSCnfB9UBmH/yTSS26SuY PnvcflBwrW8Qd0uVGkHDoV37OQhh/sqX9/Aej/svWK/bvoBgHTwa46zubPyBa+7SjCea Ku/prsB3c/lBSM1kcxgHhj9aRH6gWdqnIQ2Ut5TfkBPX4uIriJIxWlC0+jJkvolChE1G w2JopDfFwNPc0uMRYfVi9qPU7V2zlWlUSr3W2F0N0DhXx4jdRzUSYjR3MM3Igiv6V74/ cc7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b35si400762edb.204.2019.09.25.18.05.29; Wed, 25 Sep 2019 18:05:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393892AbfIXJqZ convert rfc822-to-8bit (ORCPT + 99 others); Tue, 24 Sep 2019 05:46:25 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:30518 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725884AbfIXJqY (ORCPT ); Tue, 24 Sep 2019 05:46:24 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-32-bDsbnQiNOe68NbhcH2sO_g-1; Tue, 24 Sep 2019 10:46:21 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 24 Sep 2019 10:46:21 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 24 Sep 2019 10:46:21 +0100 From: David Laight To: 'Anson Huang' , "thierry.reding@gmail.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux-pwm@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" CC: "Linux-imx@nxp.com" Subject: RE: [PATCH] pwm: pwm-imx27: Use 'dev' instead of dereferencing it repeatedly Thread-Topic: [PATCH] pwm: pwm-imx27: Use 'dev' instead of dereferencing it repeatedly Thread-Index: AQHVcra7p8HS4HCHSk+GwFkUo51L56c6k17Q Date: Tue, 24 Sep 2019 09:46:20 +0000 Message-ID: <6cfb1595992b46dc884731555e6f0334@AcuMS.aculab.com> References: <1569315593-769-1-git-send-email-Anson.Huang@nxp.com> In-Reply-To: <1569315593-769-1-git-send-email-Anson.Huang@nxp.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: bDsbnQiNOe68NbhcH2sO_g-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang > Sent: 24 September 2019 10:00 > Add helper variable dev = &pdev->dev to simply the code. > > Signed-off-by: Anson Huang > --- > drivers/pwm/pwm-imx27.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c > index 434a351..3afee29 100644 > --- a/drivers/pwm/pwm-imx27.c > +++ b/drivers/pwm/pwm-imx27.c > @@ -290,27 +290,28 @@ MODULE_DEVICE_TABLE(of, pwm_imx27_dt_ids); > > static int pwm_imx27_probe(struct platform_device *pdev) > { > + struct device *dev = &pdev->dev; > struct pwm_imx27_chip *imx; > > - imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL); > + imx = devm_kzalloc(dev, sizeof(*imx), GFP_KERNEL); > if (imx == NULL) > return -ENOMEM; > > platform_set_drvdata(pdev, imx); > > - imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); > + imx->clk_ipg = devm_clk_get(dev, "ipg"); > if (IS_ERR(imx->clk_ipg)) { > - dev_err(&pdev->dev, "getting ipg clock failed with %ld\n", > + dev_err(dev, "getting ipg clock failed with %ld\n", > PTR_ERR(imx->clk_ipg)); > return PTR_ERR(imx->clk_ipg); > } > > - imx->clk_per = devm_clk_get(&pdev->dev, "per"); > + imx->clk_per = devm_clk_get(dev, "per"); > if (IS_ERR(imx->clk_per)) { > int ret = PTR_ERR(imx->clk_per); > > if (ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, > + dev_err(dev, > "failed to get peripheral clock: %d\n", > ret); Hopefully the compiler will optimise this back otherwise you've added another local variable which may cause spilling to stack. For a setup function it probably doesn't matter, but in general it might have a small negative performance impact. In any case this doesn't shorten any lines enough to remove line-wrap and using &pdev->dev is really one less variable to mentally track when reading the code. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)