All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, Nishanth Menon <nm@ti.com>,
	Simon Guinot <simon.guinot@sequanux.org>,
	Jamie Lentin <jm@lentin.co.uk>
Subject: Re: [2/9] hwmon: gpio-fan: Use local variable pointers
Date: Sun, 8 Oct 2017 07:26:37 -0700	[thread overview]
Message-ID: <20171008142637.GA32017@roeck-us.net> (raw)
In-Reply-To: <20170925230911.20824-3-linus.walleij@linaro.org>

On Tue, Sep 26, 2017 at 01:09:04AM +0200, Linus Walleij wrote:
> Create local struct device *dev and device_node *np pointers to
> make the code easier to read.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied to hwmon-next.

Thanks,
Guenter

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

  reply	other threads:[~2017-10-08 15:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 23:09 [PATCH 0/9] GPIO controlled fans refactoring Linus Walleij
2017-09-25 23:09 ` [PATCH 1/9] hwmon: gpio-fan: Move DT bindings to the right place Linus Walleij
2017-10-05 20:31   ` Rob Herring
2017-10-08 14:21   ` [1/9] " Guenter Roeck
2017-10-08 14:21     ` Guenter Roeck
2017-09-25 23:09 ` [PATCH 2/9] hwmon: gpio-fan: Use local variable pointers Linus Walleij
2017-10-08 14:26   ` Guenter Roeck [this message]
2017-09-25 23:09 ` [PATCH 3/9] hwmon: gpio-fan: Localize platform data Linus Walleij
2017-09-25 23:09 ` [PATCH 4/9] hwmon: gpio-fan: Send around device pointer Linus Walleij
2017-10-08 14:28   ` [4/9] " Guenter Roeck
2017-09-25 23:09 ` [PATCH 5/9] hwmon: gpio-fan: Mandate OF_GPIO and cut pdata path Linus Walleij
2017-10-08 14:29   ` [5/9] " Guenter Roeck
2017-09-25 23:09 ` [PATCH 6/9] hwmon: gpio-fan: Get rid of platform data struct Linus Walleij
2017-10-08 14:32   ` [6/9] " Guenter Roeck
2017-09-25 23:09 ` [PATCH 7/9] hwmon: gpio-fan: Get rid of the gpio alarm struct Linus Walleij
2017-10-08 14:33   ` [7/9] " Guenter Roeck
2017-09-25 23:09 ` [PATCH 8/9] hwmon: gpio-fan: Rename GPIO line state variables Linus Walleij
2017-10-08 14:35   ` [8/9] " Guenter Roeck
2017-09-25 23:09 ` [PATCH 9/9] hwmon: gpio-fan: Convert to use GPIO descriptors Linus Walleij
2017-10-08 14:39   ` [9/9] " Guenter Roeck
2017-10-08 23:05     ` Linus Walleij
2017-10-08 16:20   ` Guenter Roeck
2017-10-08 23:12     ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171008142637.GA32017@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.com \
    --cc=jm@lentin.co.uk \
    --cc=linus.walleij@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=simon.guinot@sequanux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.