Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1724519ybn; Thu, 26 Sep 2019 00:58:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqx86zpVErltFsSp36AILN/szJ5m+Q4PHwGETF956gvvnsLcFWXNsQM9rTNn4qgAm6AUoZ+q X-Received: by 2002:a17:907:211c:: with SMTP id qn28mr1923895ejb.244.1569484683215; Thu, 26 Sep 2019 00:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569484683; cv=none; d=google.com; s=arc-20160816; b=QU5jMFjpjNoPclhgHdi/ryo+59mOd4iPYIF+Zb7JdgAr7jw0t3XxmAWF/Yx2nIZ5xg PA85qDdWXeWt57Bewbxh2fwvr7pjoZVi5LrVlOpcRc5Ti9qdrWBmt2XOK4121smBX3UI WC0E1HfstdGkuamYCNcho8AHQxFrt2LTZIAuS0gSf6Va4KSqCTK/KLwv0lVHGzQHeduR 8xBC43y5ac3AIKiinGl+uAFLSGi6c6X0a31ROB66ht+ifJ4l01JY4LnaUQXXCc9ZTDV7 JCGeh+5Du03Sd0rYNr3wbM468oFUAzSz4TG7ioEChqI0ZdH9II+mLoHj5LXnxH7vl/hT gQ3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=m2L0mP4t07yT8XWQQuKtY4GXnx64NeM95Sy5gbn/SrU=; b=fKayodql+jcaEOdk/LBK+wq5slV6tfJAOs7DccMEHLIDjzkmmibMnw0JOfIqpYFuQG nzNJ5V053z9Tzwl+XxaDZeMinp72BQtFqDyE0JuFnAzKDpdZM148DEChtmWCC8GO27/e p8sXEq9pabsHX4wn+3Prvmdmyy2pUBnJrZyvjRnMNLVKMaa4lwUGy5sUkKf99PYbG8fD zjq/qBIp82aWqnRzDK78qahjzP8U6m5+5s2B/E4RndYHa38YSOXO3aU9WRSYcQICkKyw 0rbnV+01VPupoYy1v9jEugpfU9qnwu+pwLmv3Q2KUbsVM8kjKiDuA6drCtx9IVbFi7wW a+1A== 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 u6si787826eds.173.2019.09.26.00.57.40; Thu, 26 Sep 2019 00:58:03 -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 S2504380AbfIXJoa (ORCPT + 99 others); Tue, 24 Sep 2019 05:44:30 -0400 Received: from inva021.nxp.com ([92.121.34.21]:58972 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbfIXJo2 (ORCPT ); Tue, 24 Sep 2019 05:44:28 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 80D2A2002C6; Tue, 24 Sep 2019 11:44:26 +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 4F15A2000DE; Tue, 24 Sep 2019 11:44:22 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id D7BF3402ED; Tue, 24 Sep 2019 17:44:16 +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 2/2] pwm: pwm-mxs: Use 'dev' instead of dereferencing it repeatedly Date: Tue, 24 Sep 2019 17:42:49 +0800 Message-Id: <1569318169-12327-2-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1569318169-12327-1-git-send-email-Anson.Huang@nxp.com> References: <1569318169-12327-1-git-send-email-Anson.Huang@nxp.com> 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-mxs.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c index b14376b..6255ffc 100644 --- a/drivers/pwm/pwm-mxs.c +++ b/drivers/pwm/pwm-mxs.c @@ -124,11 +124,12 @@ static const struct pwm_ops mxs_pwm_ops = { static int mxs_pwm_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 mxs_pwm_chip *mxs; int ret; - mxs = devm_kzalloc(&pdev->dev, sizeof(*mxs), GFP_KERNEL); + mxs = devm_kzalloc(dev, sizeof(*mxs), GFP_KERNEL); if (!mxs) return -ENOMEM; @@ -136,23 +137,23 @@ static int mxs_pwm_probe(struct platform_device *pdev) if (IS_ERR(mxs->base)) return PTR_ERR(mxs->base); - mxs->clk = devm_clk_get(&pdev->dev, NULL); + mxs->clk = devm_clk_get(dev, NULL); if (IS_ERR(mxs->clk)) return PTR_ERR(mxs->clk); - mxs->chip.dev = &pdev->dev; + mxs->chip.dev = dev; mxs->chip.ops = &mxs_pwm_ops; mxs->chip.base = -1; ret = of_property_read_u32(np, "fsl,pwm-number", &mxs->chip.npwm); if (ret < 0) { - dev_err(&pdev->dev, "failed to get pwm number: %d\n", ret); + dev_err(dev, "failed to get pwm number: %d\n", ret); return ret; } ret = pwmchip_add(&mxs->chip); if (ret < 0) { - dev_err(&pdev->dev, "failed to add pwm chip %d\n", ret); + dev_err(dev, "failed to add pwm chip %d\n", ret); return ret; } -- 2.7.4