Skip to content

Commit

Permalink
iio: ina2xx-adc: sysfs_emit()
Browse files Browse the repository at this point in the history
sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `in_allow_async_readout` device
attribute of the ina2xx-adc driver.

Signed-off-by: Lars-Peter Clausen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
larsclausen authored and jic23 committed Jan 23, 2022
1 parent 2fd5212 commit e9d4397
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/adc/ina2xx-adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ static ssize_t ina2xx_allow_async_readout_show(struct device *dev,
{
struct ina2xx_chip_info *chip = iio_priv(dev_to_iio_dev(dev));

return sprintf(buf, "%d\n", chip->allow_async_readout);
return sysfs_emit(buf, "%d\n", chip->allow_async_readout);
}

static ssize_t ina2xx_allow_async_readout_store(struct device *dev,
Expand Down

0 comments on commit e9d4397

Please sign in to comment.