diff mbox series

iio: adc: at91-sama5d2_adc: use sysfs_emit() to instead of scnprintf()

Message ID 202212011142333790361@zte.com.cn (mailing list archive)
State Accepted
Headers show
Series iio: adc: at91-sama5d2_adc: use sysfs_emit() to instead of scnprintf() | expand

Commit Message

ye.xingchen@zte.com.cn Dec. 1, 2022, 3:42 a.m. UTC
From: ye xingchen <ye.xingchen@zte.com.cn>

Replace the open-code with sysfs_emit() to simplify the code.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron Dec. 4, 2022, 3:46 p.m. UTC | #1
On Thu, 1 Dec 2022 11:42:33 +0800 (CST)
<ye.xingchen@zte.com.cn> wrote:

> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Replace the open-code with sysfs_emit() to simplify the code.
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Applied. 

Thanks,

Jonathan

> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index ed4f8501bda8..50d02e5fc6fc 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -2181,7 +2181,7 @@ static ssize_t at91_adc_get_fifo_state(struct device *dev,
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
> 
> -	return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan);
> +	return sysfs_emit(buf, "%d\n", !!st->dma_st.dma_chan);
>  }
> 
>  static ssize_t at91_adc_get_watermark(struct device *dev,
> @@ -2190,7 +2190,7 @@ static ssize_t at91_adc_get_watermark(struct device *dev,
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
> 
> -	return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);
> +	return sysfs_emit(buf, "%d\n", st->dma_st.watermark);
>  }
> 
>  static IIO_DEVICE_ATTR(hwfifo_enabled, 0444,
diff mbox series

Patch

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index ed4f8501bda8..50d02e5fc6fc 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -2181,7 +2181,7 @@  static ssize_t at91_adc_get_fifo_state(struct device *dev,
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);

-	return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan);
+	return sysfs_emit(buf, "%d\n", !!st->dma_st.dma_chan);
 }

 static ssize_t at91_adc_get_watermark(struct device *dev,
@@ -2190,7 +2190,7 @@  static ssize_t at91_adc_get_watermark(struct device *dev,
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);

-	return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);
+	return sysfs_emit(buf, "%d\n", st->dma_st.watermark);
 }

 static IIO_DEVICE_ATTR(hwfifo_enabled, 0444,