Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1404706ybn; Wed, 25 Sep 2019 17:53:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuZvqNKAzC0oajwo67jZ1n3JqBV7gEmCwKuhWCqQJ02ZgZJ/nFITeGzYUpELGTdY3F9OG9 X-Received: by 2002:a17:906:4ec2:: with SMTP id i2mr871317ejv.83.1569459195109; Wed, 25 Sep 2019 17:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569459195; cv=none; d=google.com; s=arc-20160816; b=ZkUf50mdrtoHxqUcjR2Tida7TXgKduBfdT+AmVJFD0KbcuBaZUSsi45TRCzrAyxDrm V1wFLI63aIyfgN8N2cQ+a2cuIn+/nFl+V3QxR12ny4ra71TkVH88cfmYaeeKeWmTgGHs OCrFITz2C2n68AixjoCmy3Phwe/MxzCjIvbjISJw1dZNl9nNT9WirZBnfmhaOZnJy/dN Ad+N0WkWwELMM+QhZJRE7rf+1bAwIN38nGdzE8sfWcl+e2vvyG+OXLOHbMH0Nk6k4V5j ceW18brlAG7F5GMIbiCJgkrMaE2f3QFi7JlKO1F8r5CaTWYmpRWovFqSQ1YYhzfDW4Kt XL2Q== 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=J1lyw1V8+OC9IRDn5FG2fBvAzwhMRAkFfg7zM9zubIg=; b=oaYZ0ycX9X1331box+uQoGiLupYkxKPRUdbievYe7KZl8PVFvHH+LaRJtio7qpGJHL qP+1DuASUStEJBGNPno7U+4PUJK0Y3tP2rhS6dbusVgc0dn8gdg+ra4W/IMb2a7f5z/k 5KRIizlo2FlebIyRX9Xh9M/g8AApX7F5iINKrReboST4T+MMfS2eh9vCAFg2dRXd3TmK r17JrnTj6A+yRnfUUFIV/QHOBuZUbBmxZDwXRZKidkCXoD8ObOzFI/1exp9sI+ge5QTB hHV8xPz3GNoi78j0wcQcfIdl4levRHgijMYr83nSCrcKNMq6vSthpK60i2Fz6G0GqmnN YOOw== 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 b19si233108ejj.83.2019.09.25.17.52.51; Wed, 25 Sep 2019 17:53:15 -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 S1729637AbfIXJCp (ORCPT + 99 others); Tue, 24 Sep 2019 05:02:45 -0400 Received: from inva020.nxp.com ([92.121.34.13]:35774 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbfIXJCp (ORCPT ); Tue, 24 Sep 2019 05:02:45 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5F3151A00D4; Tue, 24 Sep 2019 11:02:43 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3048E1A0169; Tue, 24 Sep 2019 11:02:39 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id BB501402ED; Tue, 24 Sep 2019 17:02:33 +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-imx-tpm: Use 'dev' instead of dereferencing it repeatedly Date: Tue, 24 Sep 2019 17:01:07 +0800 Message-Id: <1569315667-1525-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-imx-tpm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c index e8385c1..4385801 100644 --- a/drivers/pwm/pwm-imx-tpm.c +++ b/drivers/pwm/pwm-imx-tpm.c @@ -337,11 +337,12 @@ static const struct pwm_ops imx_tpm_pwm_ops = { static int pwm_imx_tpm_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct imx_tpm_pwm_chip *tpm; int ret; u32 val; - tpm = devm_kzalloc(&pdev->dev, sizeof(*tpm), GFP_KERNEL); + tpm = devm_kzalloc(dev, sizeof(*tpm), GFP_KERNEL); if (!tpm) return -ENOMEM; @@ -351,23 +352,23 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev) if (IS_ERR(tpm->base)) return PTR_ERR(tpm->base); - tpm->clk = devm_clk_get(&pdev->dev, NULL); + tpm->clk = devm_clk_get(dev, NULL); if (IS_ERR(tpm->clk)) { ret = PTR_ERR(tpm->clk); if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, + dev_err(dev, "failed to get PWM clock: %d\n", ret); return ret; } ret = clk_prepare_enable(tpm->clk); if (ret) { - dev_err(&pdev->dev, + dev_err(dev, "failed to prepare or enable clock: %d\n", ret); return ret; } - tpm->chip.dev = &pdev->dev; + tpm->chip.dev = dev; tpm->chip.ops = &imx_tpm_pwm_ops; tpm->chip.base = -1; tpm->chip.of_xlate = of_pwm_xlate_with_flags; @@ -381,7 +382,7 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev) ret = pwmchip_add(&tpm->chip); if (ret) { - dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret); + dev_err(dev, "failed to add PWM chip: %d\n", ret); clk_disable_unprepare(tpm->clk); } -- 2.7.4