linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next 08/25] iio: adc: at91: Use dev_get_drvdata()
       [not found] <20190423075020.173734-1-wangkefeng.wang@huawei.com>
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-27 12:07   ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Ludovic Desroches,
	Jonathan Cameron, linux-iio

Using dev_get_drvdata directly.

Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++--------
 drivers/iio/adc/at91_adc.c         |  4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index d5ea84cf6460..a3a4ca946308 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -1586,8 +1586,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st)
 static ssize_t at91_adc_get_fifo_state(struct device *dev,
 				       struct device_attribute *attr, char *buf)
 {
-	struct iio_dev *indio_dev =
-			platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 
 	return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan);
@@ -1596,8 +1595,7 @@ static ssize_t at91_adc_get_fifo_state(struct device *dev,
 static ssize_t at91_adc_get_watermark(struct device *dev,
 				      struct device_attribute *attr, char *buf)
 {
-	struct iio_dev *indio_dev =
-			platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 
 	return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);
@@ -1849,8 +1847,7 @@ static int at91_adc_remove(struct platform_device *pdev)
 
 static __maybe_unused int at91_adc_suspend(struct device *dev)
 {
-	struct iio_dev *indio_dev =
-			platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 
 	/*
@@ -1870,8 +1867,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
 
 static __maybe_unused int at91_adc_resume(struct device *dev)
 {
-	struct iio_dev *indio_dev =
-			platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 	int ret;
 
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 596841a3c4db..1aa8af3491fd 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1360,7 +1360,7 @@ static int at91_adc_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int at91_adc_suspend(struct device *dev)
 {
-	struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *idev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(idev);
 
 	pinctrl_pm_select_sleep_state(dev);
@@ -1371,7 +1371,7 @@ static int at91_adc_suspend(struct device *dev)
 
 static int at91_adc_resume(struct device *dev)
 {
-	struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *idev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(idev);
 
 	clk_prepare_enable(st->clk);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH next 08/25] iio: adc: at91: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 08/25] iio: adc: at91: Use dev_get_drvdata() Kefeng Wang
@ 2019-04-27 12:07   ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2019-04-27 12:07 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, Masahiro Yamada, Ludovic Desroches,
	Jonathan Cameron, linux-iio

On Tue, 23 Apr 2019 15:50:03 +0800
Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> Using dev_get_drvdata directly.
> 
> Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: linux-iio@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

A sensible cleanup, thanks.

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++--------
>  drivers/iio/adc/at91_adc.c         |  4 ++--
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index d5ea84cf6460..a3a4ca946308 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -1586,8 +1586,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st)
>  static ssize_t at91_adc_get_fifo_state(struct device *dev,
>  				       struct device_attribute *attr, char *buf)
>  {
> -	struct iio_dev *indio_dev =
> -			platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
>  
>  	return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan);
> @@ -1596,8 +1595,7 @@ static ssize_t at91_adc_get_fifo_state(struct device *dev,
>  static ssize_t at91_adc_get_watermark(struct device *dev,
>  				      struct device_attribute *attr, char *buf)
>  {
> -	struct iio_dev *indio_dev =
> -			platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
>  
>  	return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);
> @@ -1849,8 +1847,7 @@ static int at91_adc_remove(struct platform_device *pdev)
>  
>  static __maybe_unused int at91_adc_suspend(struct device *dev)
>  {
> -	struct iio_dev *indio_dev =
> -			platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
>  
>  	/*
> @@ -1870,8 +1867,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
>  
>  static __maybe_unused int at91_adc_resume(struct device *dev)
>  {
> -	struct iio_dev *indio_dev =
> -			platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
>  	int ret;
>  
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 596841a3c4db..1aa8af3491fd 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -1360,7 +1360,7 @@ static int at91_adc_remove(struct platform_device *pdev)
>  #ifdef CONFIG_PM_SLEEP
>  static int at91_adc_suspend(struct device *dev)
>  {
> -	struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *idev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(idev);
>  
>  	pinctrl_pm_select_sleep_state(dev);
> @@ -1371,7 +1371,7 @@ static int at91_adc_suspend(struct device *dev)
>  
>  static int at91_adc_resume(struct device *dev)
>  {
> -	struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *idev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(idev);
>  
>  	clk_prepare_enable(st->clk);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-27 12:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190423075020.173734-1-wangkefeng.wang@huawei.com>
2019-04-23  7:50 ` [PATCH next 08/25] iio: adc: at91: Use dev_get_drvdata() Kefeng Wang
2019-04-27 12:07   ` Jonathan Cameron

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).