On Sat, 2021-03-20 at 08:14 +0100, Lars-Peter Clausen wrote: > Update DAC drivers powerdown attribute show callback to use the new > sysfs_emit() function. > > sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it > knows about the sysfs buffer specifics and has some built-in sanity checks. Thanks. unrelated trivia: > diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c [] > @@ -255,7 +255,7 @@ static ssize_t ad5360_read_dac_powerdown(struct device *dev, > struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct ad5360_state *st = iio_priv(indio_dev); > > - return sprintf(buf, "%d\n", (bool)(st->ctrl & AD5360_SF_CTRL_PWR_DOWN)); > + return sysfs_emit(buf, "%d\n", (bool)(st->ctrl & AD5360_SF_CTRL_PWR_DOWN)); rather than cast to bool, perhaps standardize to use !!(val & test) > diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c [] > @@ -117,8 +117,8 @@ static ssize_t ad5624r_read_dac_powerdown(struct iio_dev *indio_dev, > { > struct ad5624r_state *st = iio_priv(indio_dev); > > - return sprintf(buf, "%d\n", > - !!(st->pwr_down_mask & (1 << chan->channel))); > + return sysfs_emit(buf, "%d\n", > + !!(st->pwr_down_mask & (1 << chan->channel))); like this and below... > diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c [] > @@ -57,7 +57,7 @@ static ssize_t ad5686_read_dac_powerdown(struct iio_dev *indio_dev, > { > struct ad5686_state *st = iio_priv(indio_dev); > > - return sprintf(buf, "%d\n", !!(st->pwr_down_mask & > + return sysfs_emit(buf, "%d\n", !!(st->pwr_down_mask & > (0x3 << (chan->channel * 2)))); > } etc... and it might be nicer to rewrap alignments like return sysfs_emit(buf, "%d\n", !!(st->pwr_down_mask & (0x3 << (chan->channel * 2))));