LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: shubhrajyoti@ti.com
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] bh1780gli : Convert to dev pm ops
Date: Mon, 24 Jan 2011 16:38:11 -0800	[thread overview]
Message-ID: <87tygx3jik.fsf@ti.com> (raw)
In-Reply-To: <1295346162-6800-1-git-send-email-shubhrajyoti@ti.com> (shubhrajyoti@ti.com's message of "Tue, 18 Jan 2011 15:52:42 +0530")

shubhrajyoti@ti.com writes:

> From: Shubhrajyoti Datta <shubhrajyoti@ti.com>
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti@ti.com>
> ---
>  drivers/misc/bh1780gli.c |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
> index d5f3a3f..07224ae 100644
> --- a/drivers/misc/bh1780gli.c
> +++ b/drivers/misc/bh1780gli.c
> @@ -196,10 +196,11 @@ static int __devexit bh1780_remove(struct i2c_client *client)
>  }
>  
>  #ifdef CONFIG_PM
> -static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
> +static int bh1780_suspend(struct device *dev)
>  {
>  	struct bh1780_data *ddata;
>  	int state, ret;
> +	struct i2c_client *client = to_i2c_client(dev);
>  
>  	ddata = i2c_get_clientdata(client);
>  	state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL");
> @@ -217,14 +218,14 @@ static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
>  	return 0;
>  }
>  
> -static int bh1780_resume(struct i2c_client *client)
> +static int bh1780_resume(struct device *dev)
>  {
>  	struct bh1780_data *ddata;
>  	int state, ret;
> +	struct i2c_client *client = to_i2c_client(dev);
>  
>  	ddata = i2c_get_clientdata(client);
>  	state = ddata->power_state;
> -
>  	ret = bh1780_write(ddata, BH1780_REG_CONTROL, state,
>  				"CONTROL");
>  
> @@ -233,9 +234,7 @@ static int bh1780_resume(struct i2c_client *client)
>  
>  	return 0;
>  }
> -#else
> -#define bh1780_suspend NULL
> -#define bh1780_resume NULL
> +static SIMPLE_DEV_PM_OPS(bh1780_pm, bh1780_suspend, bh1780_resume);

Rather, keep the #else here with a NULL pm_ops ptr so you don't need the
#ifdef below.

Kevin

>  #endif /* CONFIG_PM */
>  
>  static const struct i2c_device_id bh1780_id[] = {
> @@ -247,11 +246,12 @@ static struct i2c_driver bh1780_driver = {
>  	.probe		= bh1780_probe,
>  	.remove		= bh1780_remove,
>  	.id_table	= bh1780_id,
> -	.suspend	= bh1780_suspend,
> -	.resume		= bh1780_resume,
>  	.driver = {
> -		.name = "bh1780"
> -	},
> +		.name = "bh1780",
> +#ifdef CONFIG_PM
> +		.pm	= &bh1780_pm,
> +#endif
> +},
>  };
>  
>  static int __init bh1780_init(void)

  reply	other threads:[~2011-01-25  0:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18 10:22 shubhrajyoti
2011-01-25  0:38 ` Kevin Hilman [this message]
2011-02-28 11:50   ` Shubhrajyoti
2011-02-28 11:44 shubhrajyoti

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=87tygx3jik.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shubhrajyoti@ti.com \
    --subject='Re: [PATCH] bh1780gli : Convert to dev pm ops' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).