Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp7557253ybn; Mon, 30 Sep 2019 16:08:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFs0jUWEgHxconsTpRfhYHun8D6eD1f95wBpECQLz3sj8Nq6VKZ6D8Hqc3Q0PdktJ5XJXP X-Received: by 2002:a05:6402:750:: with SMTP id p16mr22513323edy.188.1569884929292; Mon, 30 Sep 2019 16:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569884929; cv=none; d=google.com; s=arc-20160816; b=T7IISRQXJM+97Ho9smEDtM4LeY/rdu3BWAOBW1Ekxit/CWwaqu8oIdajTj1khQrsw0 9bj1LsWfOl6DphcFrVxUyZ3H8CjhG9C5+Qcp9CNk2jJJ+ZJAIh12ttsKn1G+y+wzElkP UhFTbc8hgcI6jrXu0AZKcDOFanlRpFICOoARVw0qEzZn6dBwd244hQVbcLTdWbLfcxti 1oyoJZBodmQvKefDpdIhxnfYEEPz66HETGTBX0Tm8NVfoVXpxHqNY0a1udtzsx9PPmA6 rVGz/rNROYuMPFJq/M8leKpWf9E5LUwEcHvQylkLucuuFA5chomnzCe9VyysXY3h7T6s oWtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=E983INdsI8HZd9F5u40UdgLm7nSL3Xu0oq9O20W1ovM=; b=0aCK1yCYYHl1evU7AOcJjE6sdvmfn9ikJnVAL7WFDqVXmTvawHZAdwP/nT8FJZGwxE kbibGD3fdMQnEkrrKfUOWfh6LVwHTdpsJ/jMZQ2KCBkqXNyIKjKiaZcmS2cpejGmftzM TEMW9xI66IdJb87XXS3dOUlXoob23JmdHcxUGS5JBqhc+rx4bVx7dg2hgFuPywH+VAUv Wr+twKNsWJIatpkcMe1QM2Er8NiAXDGDlW1BfzQZt3sbfGSfySH2hoRMW+TUmSMiHB2e cdrUt92zhiv/zTmnky6yHBVLjP88CTN5c84JXpU9TDWlXqguGVwT03AVy537fuZPMiAp eewg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kUxflo+b; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si8204995ejo.355.2019.09.30.16.08.24; Mon, 30 Sep 2019 16:08:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kUxflo+b; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731893AbfI3XIK (ORCPT + 99 others); Mon, 30 Sep 2019 19:08:10 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41814 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727118AbfI3XIK (ORCPT ); Mon, 30 Sep 2019 19:08:10 -0400 Received: by mail-pl1-f194.google.com with SMTP id t10so4489656plr.8; Mon, 30 Sep 2019 16:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=E983INdsI8HZd9F5u40UdgLm7nSL3Xu0oq9O20W1ovM=; b=kUxflo+b7fwRhsVnvWrqhLriEDr+8P3bt3ZJ7+7TvQ977IbX9ezpTONvrjMfgoPvXl ST5g15fZVfiSJ6iLENHd9jfIuDCdXmJCwXdhq/viVlmHDYqMSPMbkW6YEjDONXNd6HHn UxXDM8YcsNfrT51FZKj7KeEclbCoQfbxKFdafiP4R2/l1k6p5dCJMpNxuhqNd30A6wWS Reultuy1M8+f3cJXC676OgDEvVD3IXHxlo+0H88J+9hvHi1u+AJcbvgTHTFQS5DMDany VwzaScZqVP+mD7SnBLgoln4JOstO7ayxm2/T9j7fTRutj5+nxQ3f93v40pNzpNq4UjTp Vw/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=E983INdsI8HZd9F5u40UdgLm7nSL3Xu0oq9O20W1ovM=; b=L3bYXUteZX+Q+grWvmP8tckix8B1V8SK1FwXpiuc3VWy6ga8/57rGKmMpbeC5O1Z9B utRavDv8e36GSj7wdcdcKm3ToApq7TgOg+VpbhDQOHns8hkVenSvherb5RWuccFtPFJy whhbvm26eXNGctj1xghj7zTR4pYvopyCqF7S2Br7cAzqSjoS9esqPyh5hlID2iuPM1I1 HUMQKg+o0ZyV6Zp7A4OVGCkE3O9GNO2uG8lbU+YiPRs2sG873G2zW7JnJRtpar08QKya 0r5decfovHkGMoNoom+WAdFjJAgvQ8IeBH8MLEN6ws9VXojNnVXSYapDBuhPFHzeGgYm Tb8Q== X-Gm-Message-State: APjAAAXPFf55+iLiRMjl9kpWTCw0cy7CNCQ4uELJcTZy0Q2HyFYguhd8 HhARDfKSCXt3AAi7fXzBTfw= X-Received: by 2002:a17:902:8d81:: with SMTP id v1mr3737145plo.124.1569884888852; Mon, 30 Sep 2019 16:08:08 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id 64sm15434442pfx.31.2019.09.30.16.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 16:08:08 -0700 (PDT) Date: Mon, 30 Sep 2019 16:08:06 -0700 From: Dmitry Torokhov To: Anson Huang Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, swboyd@chromium.org, mojha@codeaurora.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linux-imx@nxp.com Subject: Re: [PATCH] input: touchscreen: imx6ul_tsc: Use 'dev' instead of dereferencing it repeatedly Message-ID: <20190930230806.GX237523@dtor-ws> References: <1569315731-2387-1-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1569315731-2387-1-git-send-email-Anson.Huang@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 24, 2019 at 05:02:11PM +0800, Anson Huang wrote: > Add helper variable dev = &pdev->dev to simply the code. Do we get any code savings from this? > > Signed-off-by: Anson Huang > --- > drivers/input/touchscreen/imx6ul_tsc.c | 37 +++++++++++++++++----------------- > 1 file changed, 19 insertions(+), 18 deletions(-) > > diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c > index 9ed2588..4555aa9 100644 > --- a/drivers/input/touchscreen/imx6ul_tsc.c > +++ b/drivers/input/touchscreen/imx6ul_tsc.c > @@ -361,7 +361,8 @@ static void imx6ul_tsc_close(struct input_dev *input_dev) > > static int imx6ul_tsc_probe(struct platform_device *pdev) > { > - struct device_node *np = pdev->dev.of_node; > + struct device *dev = &pdev->dev; > + struct device_node *np = dev->of_node; > struct imx6ul_tsc *tsc; > struct input_dev *input_dev; > int err; > @@ -369,11 +370,11 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) > int adc_irq; > u32 average_samples; > > - tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL); > + tsc = devm_kzalloc(dev, sizeof(*tsc), GFP_KERNEL); > if (!tsc) > return -ENOMEM; > > - input_dev = devm_input_allocate_device(&pdev->dev); > + input_dev = devm_input_allocate_device(dev); > if (!input_dev) > return -ENOMEM; > > @@ -389,14 +390,14 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) > > input_set_drvdata(input_dev, tsc); > > - tsc->dev = &pdev->dev; > + tsc->dev = dev; > tsc->input = input_dev; > init_completion(&tsc->completion); > > - tsc->xnur_gpio = devm_gpiod_get(&pdev->dev, "xnur", GPIOD_IN); > + tsc->xnur_gpio = devm_gpiod_get(dev, "xnur", GPIOD_IN); > if (IS_ERR(tsc->xnur_gpio)) { > err = PTR_ERR(tsc->xnur_gpio); > - dev_err(&pdev->dev, > + dev_err(dev, > "failed to request GPIO tsc_X- (xnur): %d\n", err); > return err; > } > @@ -404,28 +405,28 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) > tsc->tsc_regs = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(tsc->tsc_regs)) { > err = PTR_ERR(tsc->tsc_regs); > - dev_err(&pdev->dev, "failed to remap tsc memory: %d\n", err); > + dev_err(dev, "failed to remap tsc memory: %d\n", err); > return err; > } > > tsc->adc_regs = devm_platform_ioremap_resource(pdev, 1); > if (IS_ERR(tsc->adc_regs)) { > err = PTR_ERR(tsc->adc_regs); > - dev_err(&pdev->dev, "failed to remap adc memory: %d\n", err); > + dev_err(dev, "failed to remap adc memory: %d\n", err); > return err; > } > > - tsc->tsc_clk = devm_clk_get(&pdev->dev, "tsc"); > + tsc->tsc_clk = devm_clk_get(dev, "tsc"); > if (IS_ERR(tsc->tsc_clk)) { > err = PTR_ERR(tsc->tsc_clk); > - dev_err(&pdev->dev, "failed getting tsc clock: %d\n", err); > + dev_err(dev, "failed getting tsc clock: %d\n", err); > return err; > } > > - tsc->adc_clk = devm_clk_get(&pdev->dev, "adc"); > + tsc->adc_clk = devm_clk_get(dev, "adc"); > if (IS_ERR(tsc->adc_clk)) { > err = PTR_ERR(tsc->adc_clk); > - dev_err(&pdev->dev, "failed getting adc clock: %d\n", err); > + dev_err(dev, "failed getting adc clock: %d\n", err); > return err; > } > > @@ -439,18 +440,18 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) > > err = devm_request_threaded_irq(tsc->dev, tsc_irq, > NULL, tsc_irq_fn, IRQF_ONESHOT, > - dev_name(&pdev->dev), tsc); > + dev_name(dev), tsc); > if (err) { > - dev_err(&pdev->dev, > + dev_err(dev, > "failed requesting tsc irq %d: %d\n", > tsc_irq, err); > return err; > } > > err = devm_request_irq(tsc->dev, adc_irq, adc_irq_fn, 0, > - dev_name(&pdev->dev), tsc); > + dev_name(dev), tsc); > if (err) { > - dev_err(&pdev->dev, > + dev_err(dev, > "failed requesting adc irq %d: %d\n", > adc_irq, err); > return err; > @@ -484,7 +485,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) > tsc->average_select = ilog2(average_samples) - 2; > break; > default: > - dev_err(&pdev->dev, > + dev_err(dev, > "touchscreen-average-samples (%u) must be 1, 4, 8, 16 or 32\n", > average_samples); > return -EINVAL; > @@ -492,7 +493,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) > > err = input_register_device(tsc->input); > if (err) { > - dev_err(&pdev->dev, > + dev_err(dev, > "failed to register input device: %d\n", err); > return err; > } > -- > 2.7.4 > -- Dmitry