Re: [PATCH] hmc5843: Convert to dev pm ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/18/11 11:42, shubhrajyoti@xxxxxx wrote:
> From: Shubhrajyoti D <a0393217@xxxxxxxxxxxx>
> 
I'm not that familiar with the power management stuff, but
looks fine to me...
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti@xxxxxx>
Acked-by: Jonathan Cameron <jic23@xxxxxxxxx>
> ---
>  drivers/staging/iio/magnetometer/hmc5843.c |   16 +++++++++++-----
>  1 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
> index 5168917..2650f21 100644
> --- a/drivers/staging/iio/magnetometer/hmc5843.c
> +++ b/drivers/staging/iio/magnetometer/hmc5843.c
> @@ -583,20 +583,25 @@ static int hmc5843_remove(struct i2c_client *client)
>  	kfree(i2c_get_clientdata(client));
>  	return 0;
>  }
> -
> -static int hmc5843_suspend(struct i2c_client *client, pm_message_t mesg)
> +#ifdef CONFIG_PM
> +static int hmc5843_suspend(struct device *dev)
>  {
> +	struct i2c_client *client = to_i2c_client(dev);
>  	hmc5843_configure(client, MODE_SLEEP);
>  	return 0;
>  }
>  
> -static int hmc5843_resume(struct i2c_client *client)
> +static int hmc5843_resume(struct device *dev)
>  {
> +	struct i2c_client *client = to_i2c_client(dev);
>  	struct hmc5843_data *data = i2c_get_clientdata(client);
>  	hmc5843_configure(client, data->operating_mode);
>  	return 0;
>  }
>  
> +static SIMPLE_DEV_PM_OPS(hmc5843_pm, hmc5843_suspend, hmc5843_resume);
> +#endif
> +
>  static const struct i2c_device_id hmc5843_id[] = {
>  	{ "hmc5843", 0 },
>  	{ }
> @@ -605,14 +610,15 @@ static const struct i2c_device_id hmc5843_id[] = {
>  static struct i2c_driver hmc5843_driver = {
>  	.driver = {
>  		.name	= "hmc5843",
> +#ifdef CONFIG_PM
> +		.pm	= &hmc5843_pm,
> +#endif
>  	},
>  	.id_table	= hmc5843_id,
>  	.probe		= hmc5843_probe,
>  	.remove		= hmc5843_remove,
>  	.detect		= hmc5843_detect,
>  	.address_list	= normal_i2c,
> -	.suspend	= hmc5843_suspend,
> -	.resume		= hmc5843_resume,
>  };
>  
>  static int __init hmc5843_init(void)

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux