public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Michael Thalmeier <michael.thalmeier@hale.at>, jdelvare@suse.de
Cc: lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (lm75) put chip into shutdown mode on shutdown
Date: Thu, 06 Nov 2014 06:17:51 -0800	[thread overview]
Message-ID: <545B830F.2020002@roeck-us.net> (raw)
In-Reply-To: <1415282432-3256-1-git-send-email-michael.thalmeier@hale.at>

On 11/06/2014 06:00 AM, Michael Thalmeier wrote:
> In addition to going into shutdown mode on suspend also go into shutdown mode
> on system shutdown. This way we can save a few mA when the main CPU is powered
> off and the lm75 is still powered but not used any more.
>
You can do this in a more comprehensive way using SIMPLE_DEV_PM_OPS.

Guenter

> Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
> ---
>   drivers/hwmon/lm75.c | 19 +++++++++++++++++--
>   1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
> index 7ec5ccd..d860af9 100644
> --- a/drivers/hwmon/lm75.c
> +++ b/drivers/hwmon/lm75.c
> @@ -433,10 +433,10 @@ static int lm75_detect(struct i2c_client *new_client,
>   }
>
>   #ifdef CONFIG_PM
> -static int lm75_suspend(struct device *dev)
> +
> +static int _lm75_shutdown(struct i2c_client *client)
>   {
>   	int status;
> -	struct i2c_client *client = to_i2c_client(dev);
>   	status = lm75_read_value(client, LM75_REG_CONF);
>   	if (status < 0) {
>   		dev_dbg(&client->dev, "Can't read config? %d\n", status);
> @@ -447,6 +447,18 @@ static int lm75_suspend(struct device *dev)
>   	return 0;
>   }
>
> +static void lm75_shutdown(struct i2c_client *client)
> +{
> +	_lm75_shutdown(client);
> +}
> +
> +static int lm75_suspend(struct device *dev)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +
> +	return _lm75_shutdown(client);
> +}
> +
>   static int lm75_resume(struct device *dev)
>   {
>   	int status;
> @@ -466,8 +478,10 @@ static const struct dev_pm_ops lm75_dev_pm_ops = {
>   	.resume		= lm75_resume,
>   };
>   #define LM75_DEV_PM_OPS (&lm75_dev_pm_ops)
> +#define LM75_SHUTDOWN_OP lm75_shutdown
>   #else
>   #define LM75_DEV_PM_OPS NULL
> +#define LM75_SHUTDOWN_OP NULL
>   #endif /* CONFIG_PM */
>
>   static struct i2c_driver lm75_driver = {
> @@ -478,6 +492,7 @@ static struct i2c_driver lm75_driver = {
>   	},
>   	.probe		= lm75_probe,
>   	.remove		= lm75_remove,
> +	.shutdown	= LM75_SHUTDOWN_OP,
>   	.id_table	= lm75_ids,
>   	.detect		= lm75_detect,
>   	.address_list	= normal_i2c,
>


      reply	other threads:[~2014-11-06 14:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 14:00 [PATCH] hwmon: (lm75) put chip into shutdown mode on shutdown Michael Thalmeier
2014-11-06 14:17 ` Guenter Roeck [this message]

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=545B830F.2020002@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=michael.thalmeier@hale.at \
    /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