[2/2] pwm: pwm-mxs: Use 'dev' instead of dereferencing it repeatedly
diff mbox series

Message ID 1569318169-12327-2-git-send-email-Anson.Huang@nxp.com
State Rejected
Headers show
Series
  • [1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code
Related show

Commit Message

Anson Huang Sept. 24, 2019, 9:42 a.m. UTC
Add helper variable dev = &pdev->dev to simply the code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/pwm/pwm-mxs.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Thierry Reding Sept. 24, 2019, 10:53 a.m. UTC | #1
On Tue, Sep 24, 2019 at 05:42:49PM +0800, Anson Huang wrote:
> Add helper variable dev = &pdev->dev to simply the code.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
>  drivers/pwm/pwm-mxs.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)

Again, lots of churn, no gain.

Thierry

Patch
diff mbox series

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;
 	}