public inbox for linux-hwmon@vger.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: [4/9] hwmon: gpio-fan: Send around device pointer
Date: Sun, 8 Oct 2017 07:28:29 -0700	[thread overview]
Message-ID: <20171008142829.GA13577@roeck-us.net> (raw)
In-Reply-To: <20170925230911.20824-5-linus.walleij@linaro.org>

On Tue, Sep 26, 2017 at 01:09:06AM +0200, Linus Walleij wrote:
> The driver is storing the struct platform_device *pdev pointer
> but what it is really using and want to pass around is a
> struct device *dev pointer.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/gpio-fan.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
> index cfa8d9b578dd..ad7d8fdf4f81 100644
> --- a/drivers/hwmon/gpio-fan.c
> +++ b/drivers/hwmon/gpio-fan.c
> @@ -58,7 +58,7 @@ struct gpio_fan_platform_data {
>  };
>  
>  struct gpio_fan_data {
> -	struct platform_device	*pdev;
> +	struct device		*dev;
>  	struct device		*hwmon_dev;
>  	/* Cooling device if any */
>  	struct thermal_cooling_device *cdev;
> @@ -85,8 +85,8 @@ static void fan_alarm_notify(struct work_struct *ws)
>  	struct gpio_fan_data *fan_data =
>  		container_of(ws, struct gpio_fan_data, alarm_work);
>  
> -	sysfs_notify(&fan_data->pdev->dev.kobj, NULL, "fan1_alarm");
> -	kobject_uevent(&fan_data->pdev->dev.kobj, KOBJ_CHANGE);
> +	sysfs_notify(&fan_data->dev->kobj, NULL, "fan1_alarm");
> +	kobject_uevent(&fan_data->dev->kobj, KOBJ_CHANGE);
>  }
>  
>  static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id)
> @@ -118,11 +118,11 @@ static int fan_alarm_init(struct gpio_fan_data *fan_data,
>  {
>  	int err;
>  	int alarm_irq;
> -	struct platform_device *pdev = fan_data->pdev;
> +	struct device *dev = fan_data->dev;
>  
>  	fan_data->alarm = alarm;
>  
> -	err = devm_gpio_request(&pdev->dev, alarm->gpio, "GPIO fan alarm");
> +	err = devm_gpio_request(dev, alarm->gpio, "GPIO fan alarm");
>  	if (err)
>  		return err;
>  
> @@ -140,7 +140,7 @@ static int fan_alarm_init(struct gpio_fan_data *fan_data,
>  
>  	INIT_WORK(&fan_data->alarm_work, fan_alarm_notify);
>  	irq_set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH);
> -	err = devm_request_irq(&pdev->dev, alarm_irq, fan_alarm_irq_handler,
> +	err = devm_request_irq(dev, alarm_irq, fan_alarm_irq_handler,
>  			       IRQF_SHARED, "GPIO fan alarm", fan_data);
>  	return err;
>  }
> @@ -191,7 +191,7 @@ static int get_fan_speed_index(struct gpio_fan_data *fan_data)
>  		if (fan_data->speed[i].ctrl_val == ctrl_val)
>  			return i;
>  
> -	dev_warn(&fan_data->pdev->dev,
> +	dev_warn(fan_data->dev,
>  		 "missing speed array entry for GPIO value 0x%x\n", ctrl_val);
>  
>  	return -ENODEV;
> @@ -382,13 +382,13 @@ static const struct attribute_group *gpio_fan_groups[] = {
>  static int fan_ctrl_init(struct gpio_fan_data *fan_data,
>  			 struct gpio_fan_platform_data *pdata)
>  {
> -	struct platform_device *pdev = fan_data->pdev;
> +	struct device *dev = fan_data->dev;
>  	int num_ctrl = pdata->num_ctrl;
>  	unsigned *ctrl = pdata->ctrl;
>  	int i, err;
>  
>  	for (i = 0; i < num_ctrl; i++) {
> -		err = devm_gpio_request(&pdev->dev, ctrl[i],
> +		err = devm_gpio_request(dev, ctrl[i],
>  					"GPIO fan control");
>  		if (err)
>  			return err;
> @@ -588,7 +588,7 @@ static int gpio_fan_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  #endif /* CONFIG_OF_GPIO */
>  
> -	fan_data->pdev = pdev;
> +	fan_data->dev = dev;
>  	platform_set_drvdata(pdev, fan_data);
>  	mutex_init(&fan_data->lock);
>  

  reply	other threads:[~2017-10-08 14:28 UTC|newest]

Thread overview: 22+ 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-09-25 23:09 ` [PATCH 2/9] hwmon: gpio-fan: Use local variable pointers Linus Walleij
2017-10-08 14:26   ` [2/9] " Guenter Roeck
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   ` Guenter Roeck [this message]
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=20171008142829.GA13577@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox