diff mbox

[2/8] iio: adc: ti_am335x_adc: use SIMPLE_DEV_PM_OPS helper macro

Message ID 20160531170013.2649-3-afd@ti.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Andrew Davis May 31, 2016, 5 p.m. UTC
Replace ifdefs with SIMPLE_DEV_PM_OPS helper macro.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/iio/adc/ti_am335x_adc.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Comments

Jonathan Cameron June 3, 2016, 12:16 p.m. UTC | #1
On 31/05/16 18:00, Andrew F. Davis wrote:
> Replace ifdefs with SIMPLE_DEV_PM_OPS helper macro.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
Applied to the togreg branch of iio.git - initially pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/adc/ti_am335x_adc.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index c1e0553..18af71d 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -531,8 +531,7 @@ static int tiadc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM
> -static int tiadc_suspend(struct device *dev)
> +static int __maybe_unused tiadc_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct tiadc_device *adc_dev = iio_priv(indio_dev);
> @@ -550,7 +549,7 @@ static int tiadc_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int tiadc_resume(struct device *dev)
> +static int __maybe_unused tiadc_resume(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct tiadc_device *adc_dev = iio_priv(indio_dev);
> @@ -567,14 +566,7 @@ static int tiadc_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static const struct dev_pm_ops tiadc_pm_ops = {
> -	.suspend = tiadc_suspend,
> -	.resume = tiadc_resume,
> -};
> -#define TIADC_PM_OPS (&tiadc_pm_ops)
> -#else
> -#define TIADC_PM_OPS NULL
> -#endif
> +static SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
>  
>  static const struct of_device_id ti_adc_dt_ids[] = {
>  	{ .compatible = "ti,am3359-adc", },
> @@ -585,7 +577,7 @@ MODULE_DEVICE_TABLE(of, ti_adc_dt_ids);
>  static struct platform_driver tiadc_driver = {
>  	.driver = {
>  		.name   = "TI-am335x-adc",
> -		.pm	= TIADC_PM_OPS,
> +		.pm	= &tiadc_pm_ops,
>  		.of_match_table = ti_adc_dt_ids,
>  	},
>  	.probe	= tiadc_probe,
> 

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

Patch

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index c1e0553..18af71d 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -531,8 +531,7 @@  static int tiadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int tiadc_suspend(struct device *dev)
+static int __maybe_unused tiadc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
@@ -550,7 +549,7 @@  static int tiadc_suspend(struct device *dev)
 	return 0;
 }
 
-static int tiadc_resume(struct device *dev)
+static int __maybe_unused tiadc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
@@ -567,14 +566,7 @@  static int tiadc_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops tiadc_pm_ops = {
-	.suspend = tiadc_suspend,
-	.resume = tiadc_resume,
-};
-#define TIADC_PM_OPS (&tiadc_pm_ops)
-#else
-#define TIADC_PM_OPS NULL
-#endif
+static SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
 
 static const struct of_device_id ti_adc_dt_ids[] = {
 	{ .compatible = "ti,am3359-adc", },
@@ -585,7 +577,7 @@  MODULE_DEVICE_TABLE(of, ti_adc_dt_ids);
 static struct platform_driver tiadc_driver = {
 	.driver = {
 		.name   = "TI-am335x-adc",
-		.pm	= TIADC_PM_OPS,
+		.pm	= &tiadc_pm_ops,
 		.of_match_table = ti_adc_dt_ids,
 	},
 	.probe	= tiadc_probe,