Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1716504ybn; Thu, 26 Sep 2019 00:46:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwh0U9TCwdyjx2LKp0LHK7q+emID5IA4xuXEj9H6e+3xUNY8MAIxuUS3x4OZjqvRqnOUVMm X-Received: by 2002:a17:906:16cd:: with SMTP id t13mr1864553ejd.153.1569483995349; Thu, 26 Sep 2019 00:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569483995; cv=none; d=google.com; s=arc-20160816; b=XN3mBkS5Vzfazka2IvVj1O+zYlRGZVSt9AHCc/zRUZr1E+in6ryvkkSQkb+Et8Hja4 3DwOtdLePh8nL78jw9Yow7/32e0sSXr1GlCSXdyehNG/0Okgpx8ALNY9ET3KM+l8QXCh 6IgLf3pFBWwZk6Ri7F9ErNhjK6Za9h0pEDnnUzC9qNbTkUMxwjlLAHNpOmuMpaGZ+jB+ BMN7Per+GBP0Amh5vaW1fyed+OA5f3uRKoCb2UTwawNvVsz7OT3fHyO95rHgzHkdwUlC MQPwTP6DkBYwGc3H2+a7Ztn0OSB60ouRMWnKHbv58Lp7Cz7W7zRwrPVjkvZEjm9mzvsl 35Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=D7WbIS6hGenUFSKjeLb80Zo+kYuc/uWjPYDupxGznBc=; b=m91Xr5Jnho3EpBFMX+/oPeNhcREoVQm5PS4WHN2GLKVtFxNoU1pDppzwAapSxafm7e xMapHag1z4FBUoLO5VwHca91UwVwNQUc+jk3hM8EBrr6ahxpnZxP1epJFQlQswk1EDoB n1UTs7ZAZoYY2lE0g4uBNbc9+s8180xYq9dHXaNG6t+p00W86gLmAr7VXtngxE6HT1ZT UVTZw6oBIC0OVBUKXQj3a0RZ56LghMLqLBcRjYmemjGNAQ8g6kDI1qqk25YhV9VnV1UX lOrPFNyqrQcpKvx7U1TG7YDJ6WBmXcypcAEUs+tQtOZReUdws+ihYQC6IQb7f+/62fsy G4Mg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s7si840960edd.290.2019.09.26.00.46.12; Thu, 26 Sep 2019 00:46:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729609AbfIXJCA (ORCPT + 99 others); Tue, 24 Sep 2019 05:02:00 -0400 Received: from inva021.nxp.com ([92.121.34.21]:49584 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbfIXJB7 (ORCPT ); Tue, 24 Sep 2019 05:01:59 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C0AD1200857; Tue, 24 Sep 2019 11:01:56 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 8EF1620077E; Tue, 24 Sep 2019 11:01:52 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 22B6A4029F; Tue, 24 Sep 2019 17:01:47 +0800 (SGT) From: Anson Huang To: 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: [PATCH] pwm: pwm-imx27: Use 'dev' instead of dereferencing it repeatedly Date: Tue, 24 Sep 2019 16:59:53 +0800 Message-Id: <1569315593-769-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); @@ -318,7 +319,7 @@ static int pwm_imx27_probe(struct platform_device *pdev) } imx->chip.ops = &pwm_imx27_ops; - imx->chip.dev = &pdev->dev; + imx->chip.dev = dev; imx->chip.base = -1; imx->chip.npwm = 1; -- 2.7.4