mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
iio: proximity: srf08: Replace sprintf() with sysfs_emit()
Replace sprintf() function calls with sysfs_emit() and sysfs_emit_at(). While the current code is fine, sysfs_emit() is preferred over sprintf(), and will help modernize the driver. Signed-off-by: Maxwell Doose <m32285159@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
96aa96c029
commit
2450368e2e
|
|
@ -226,7 +226,7 @@ static int srf08_read_raw(struct iio_dev *indio_dev,
|
|||
static ssize_t srf08_show_range_mm_available(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "[0.043 0.043 11.008]\n");
|
||||
return sysfs_emit(buf, "[0.043 0.043 11.008]\n");
|
||||
}
|
||||
|
||||
static IIO_DEVICE_ATTR(sensor_max_range_available, S_IRUGO,
|
||||
|
|
@ -238,8 +238,8 @@ static ssize_t srf08_show_range_mm(struct device *dev,
|
|||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
||||
struct srf08_data *data = iio_priv(indio_dev);
|
||||
|
||||
return sprintf(buf, "%d.%03d\n", data->range_mm / 1000,
|
||||
data->range_mm % 1000);
|
||||
return sysfs_emit(buf, "%d.%03d\n",
|
||||
data->range_mm / 1000, data->range_mm % 1000);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -316,10 +316,10 @@ static ssize_t srf08_show_sensitivity_available(struct device *dev,
|
|||
|
||||
for (i = 0; i < data->chip_info->num_sensitivity_avail; i++)
|
||||
if (data->chip_info->sensitivity_avail[i])
|
||||
len += sprintf(buf + len, "%d ",
|
||||
data->chip_info->sensitivity_avail[i]);
|
||||
len += sysfs_emit_at(buf, len, "%d ",
|
||||
data->chip_info->sensitivity_avail[i]);
|
||||
|
||||
len += sprintf(buf + len, "\n");
|
||||
len += sysfs_emit_at(buf, len, "\n");
|
||||
|
||||
return len;
|
||||
}
|
||||
|
|
@ -332,11 +332,8 @@ static ssize_t srf08_show_sensitivity(struct device *dev,
|
|||
{
|
||||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
||||
struct srf08_data *data = iio_priv(indio_dev);
|
||||
int len;
|
||||
|
||||
len = sprintf(buf, "%d\n", data->sensitivity);
|
||||
|
||||
return len;
|
||||
return sysfs_emit(buf, "%d\n", data->sensitivity);
|
||||
}
|
||||
|
||||
static ssize_t srf08_write_sensitivity(struct srf08_data *data,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user