Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212011142333790361@zte.com.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

ye xingchen and committed by
Jonathan Cameron
7ae26795 58c26300

+2 -2
+2 -2
drivers/iio/adc/at91-sama5d2_adc.c
··· 2181 2181 struct iio_dev *indio_dev = dev_to_iio_dev(dev); 2182 2182 struct at91_adc_state *st = iio_priv(indio_dev); 2183 2183 2184 - return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan); 2184 + return sysfs_emit(buf, "%d\n", !!st->dma_st.dma_chan); 2185 2185 } 2186 2186 2187 2187 static ssize_t at91_adc_get_watermark(struct device *dev, ··· 2190 2190 struct iio_dev *indio_dev = dev_to_iio_dev(dev); 2191 2191 struct at91_adc_state *st = iio_priv(indio_dev); 2192 2192 2193 - return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark); 2193 + return sysfs_emit(buf, "%d\n", st->dma_st.watermark); 2194 2194 } 2195 2195 2196 2196 static IIO_DEVICE_ATTR(hwfifo_enabled, 0444,