From patchwork Mon Sep 25 23:09:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9970625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C58B5603F2 for ; Mon, 25 Sep 2017 23:09:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B551428D0A for ; Mon, 25 Sep 2017 23:09:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA18A28D16; Mon, 25 Sep 2017 23:09:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FEB528D0F for ; Mon, 25 Sep 2017 23:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754050AbdIYXJh (ORCPT ); Mon, 25 Sep 2017 19:09:37 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:50832 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753950AbdIYXJg (ORCPT ); Mon, 25 Sep 2017 19:09:36 -0400 Received: by mail-pg0-f42.google.com with SMTP id p5so4867935pgn.7 for ; Mon, 25 Sep 2017 16:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/J6cUtS1q8EUFRppX58zQxWdHEUBtSipfx4cqBc5N1E=; b=TH/9kzz/Bl7tvokc3kn7wVTUuXDIHRYoDAaBeIMQb038Tc8kz1IgyCkIMqinzL52VJ FNBZ+ZMaG71rmBbOCgkXyEmvMA+Ho35KBvZ8GbZVQST5W1OCv6zjH5klR6LGxqV/plQd HDjlJtd+Bro+Mhoapa6MipqWMCSSfjsNhAru0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/J6cUtS1q8EUFRppX58zQxWdHEUBtSipfx4cqBc5N1E=; b=d7D/gk2euWM8bUkGjrG6l5WvRqsAG3gdZVAUK6pxL0qiqqZxPAKllP5Lgsh+BpvzTR DCGYHr6x1IfG1fACtyPrHAnd/JNFNiAkgpztm81u4ezyVCBs51D3REH6+nzkLyMfGrEB SEp/TMQlplxBWbgR/8TMelv6W4l3RKWW2L9c+nwX71PZWsF36Sbv83ZE+4qECylTCdvL wipSKnbGaZZU7oFLaVFs9Rp2FjxQF7AEbyzvroDbQ27Fl7Hn1U0u7IfJCzrKx9ZFw34s e7BUzZOndlOj1Cqi+bpHv1NhQXWWzU+K/s6XRp2vFZ2PGWRAe2Kj6xLuWPehfP5LNhTh 2CmQ== X-Gm-Message-State: AHPjjUjdfCvhr1lSwLfFlOTtPx7S8Lpng9m19GKwtVdsDf23+zLJ7lRf tzafk4xvRWaUDtQzj15brPbCMA== X-Google-Smtp-Source: AOwi7QAvErCfnfSTK+sCptfrajIxrJs86F4YZf2s84xSyO9gNdLmou//bTdNFplJJsAs3Qy+meO9Tw== X-Received: by 10.84.241.78 with SMTP id u14mr8985819plm.212.1506380976284; Mon, 25 Sep 2017 16:09:36 -0700 (PDT) Received: from localhost.localdomain ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id a7sm12284532pgc.40.2017.09.25.16.09.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 16:09:35 -0700 (PDT) From: Linus Walleij To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Nishanth Menon , Simon Guinot , Jamie Lentin , Linus Walleij Subject: [PATCH 2/9] hwmon: gpio-fan: Use local variable pointers Date: Tue, 26 Sep 2017 01:09:04 +0200 Message-Id: <20170925230911.20824-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170925230911.20824-1-linus.walleij@linaro.org> References: <20170925230911.20824-1-linus.walleij@linaro.org> Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Create local struct device *dev and device_node *np pointers to make the code easier to read. Signed-off-by: Linus Walleij --- drivers/hwmon/gpio-fan.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 9c355b9d31c5..f29cee9398ef 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -541,22 +541,24 @@ static int gpio_fan_probe(struct platform_device *pdev) { int err; struct gpio_fan_data *fan_data; - struct gpio_fan_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct gpio_fan_platform_data *pdata = dev_get_platdata(dev); - fan_data = devm_kzalloc(&pdev->dev, sizeof(struct gpio_fan_data), + fan_data = devm_kzalloc(dev, sizeof(struct gpio_fan_data), GFP_KERNEL); if (!fan_data) return -ENOMEM; #ifdef CONFIG_OF_GPIO if (!pdata) { - pdata = devm_kzalloc(&pdev->dev, + pdata = devm_kzalloc(dev, sizeof(struct gpio_fan_platform_data), GFP_KERNEL); if (!pdata) return -ENOMEM; - err = gpio_fan_get_of_pdata(&pdev->dev, pdata); + err = gpio_fan_get_of_pdata(dev, pdata); if (err) return err; } @@ -587,14 +589,14 @@ static int gpio_fan_probe(struct platform_device *pdev) /* Make this driver part of hwmon class. */ fan_data->hwmon_dev = - devm_hwmon_device_register_with_groups(&pdev->dev, + devm_hwmon_device_register_with_groups(dev, "gpio_fan", fan_data, gpio_fan_groups); if (IS_ERR(fan_data->hwmon_dev)) return PTR_ERR(fan_data->hwmon_dev); #ifdef CONFIG_OF_GPIO /* Optional cooling device register for Device tree platforms */ - fan_data->cdev = thermal_of_cooling_device_register(pdev->dev.of_node, + fan_data->cdev = thermal_of_cooling_device_register(np, "gpio-fan", fan_data, &gpio_fan_cool_ops); @@ -604,7 +606,7 @@ static int gpio_fan_probe(struct platform_device *pdev) &gpio_fan_cool_ops); #endif /* CONFIG_OF_GPIO */ - dev_info(&pdev->dev, "GPIO fan initialized\n"); + dev_info(dev, "GPIO fan initialized\n"); return 0; }