Skip to content

Commit 4d2e4fc

Browse files
ciocca-djic23
authored andcommitted
iio:common: removed unused functions outside st_sensors library
This patch remove st_sensors_get_sampling_frequency_avl and st_sensors_get_scale_avl functions used only in st_sensors_sysfs_sampling_frequency_avail and st_sensors_sysfs_scale_avail sysfs functions. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 9dbf091 commit 4d2e4fc

2 files changed

Lines changed: 28 additions & 46 deletions

File tree

‎drivers/iio/common/st_sensors/st_sensors_core.c‎

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,46 +38,6 @@ static int st_sensors_write_data_with_mask(struct iio_dev *indio_dev,
3838
return err;
3939
}
4040

41-
int st_sensors_get_sampling_frequency_avl(struct iio_dev *indio_dev, char *buf)
42-
{
43-
int i, len = 0;
44-
struct st_sensor_data *sdata = iio_priv(indio_dev);
45-
46-
mutex_lock(&indio_dev->mlock);
47-
for (i = 0; i < ST_SENSORS_ODR_LIST_MAX; i++) {
48-
if (sdata->sensor->odr.odr_avl[i].hz == 0)
49-
break;
50-
51-
len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
52-
sdata->sensor->odr.odr_avl[i].hz);
53-
}
54-
mutex_unlock(&indio_dev->mlock);
55-
buf[len - 1] = '\n';
56-
57-
return len;
58-
}
59-
EXPORT_SYMBOL(st_sensors_get_sampling_frequency_avl);
60-
61-
int st_sensors_get_scale_avl(struct iio_dev *indio_dev, char *buf)
62-
{
63-
int i, len = 0;
64-
struct st_sensor_data *sdata = iio_priv(indio_dev);
65-
66-
mutex_lock(&indio_dev->mlock);
67-
for (i = 0; i < ST_SENSORS_FULLSCALE_AVL_MAX; i++) {
68-
if (sdata->sensor->fs.fs_avl[i].num == 0)
69-
break;
70-
71-
len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ",
72-
sdata->sensor->fs.fs_avl[i].gain);
73-
}
74-
mutex_unlock(&indio_dev->mlock);
75-
buf[len - 1] = '\n';
76-
77-
return len;
78-
}
79-
EXPORT_SYMBOL(st_sensors_get_scale_avl);
80-
8141
static int st_sensors_match_odr(struct st_sensors *sensor,
8242
unsigned int odr, struct st_sensor_odr_avl *odr_out)
8343
{
@@ -440,18 +400,44 @@ EXPORT_SYMBOL(st_sensors_sysfs_set_sampling_frequency);
440400
ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
441401
struct device_attribute *attr, char *buf)
442402
{
403+
int i, len = 0;
443404
struct iio_dev *indio_dev = dev_get_drvdata(dev);
405+
struct st_sensor_data *sdata = iio_priv(indio_dev);
406+
407+
mutex_lock(&indio_dev->mlock);
408+
for (i = 0; i < ST_SENSORS_ODR_LIST_MAX; i++) {
409+
if (sdata->sensor->odr.odr_avl[i].hz == 0)
410+
break;
411+
412+
len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
413+
sdata->sensor->odr.odr_avl[i].hz);
414+
}
415+
mutex_unlock(&indio_dev->mlock);
416+
buf[len - 1] = '\n';
444417

445-
return st_sensors_get_sampling_frequency_avl(indio_dev, buf);
418+
return len;
446419
}
447420
EXPORT_SYMBOL(st_sensors_sysfs_sampling_frequency_avail);
448421

449422
ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
450423
struct device_attribute *attr, char *buf)
451424
{
425+
int i, len = 0;
452426
struct iio_dev *indio_dev = dev_get_drvdata(dev);
427+
struct st_sensor_data *sdata = iio_priv(indio_dev);
428+
429+
mutex_lock(&indio_dev->mlock);
430+
for (i = 0; i < ST_SENSORS_FULLSCALE_AVL_MAX; i++) {
431+
if (sdata->sensor->fs.fs_avl[i].num == 0)
432+
break;
433+
434+
len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ",
435+
sdata->sensor->fs.fs_avl[i].gain);
436+
}
437+
mutex_unlock(&indio_dev->mlock);
438+
buf[len - 1] = '\n';
453439

454-
return st_sensors_get_scale_avl(indio_dev, buf);
440+
return len;
455441
}
456442
EXPORT_SYMBOL(st_sensors_sysfs_scale_avail);
457443

‎include/linux/iio/common/st_sensors.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,6 @@ int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);
243243

244244
int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable);
245245

246-
int st_sensors_get_sampling_frequency_avl(struct iio_dev *indio_dev, char *buf);
247-
248-
int st_sensors_get_scale_avl(struct iio_dev *indio_dev, char *buf);
249-
250246
int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr);
251247

252248
int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable);

0 commit comments

Comments
 (0)