Skip to content

Commit

Permalink
iio:common: removed unused functions outside st_sensors library
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Denis CIOCCA authored and Jonathan Cameron committed Feb 2, 2013
1 parent 9dbf091 commit 4d2e4fc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 46 deletions.
70 changes: 28 additions & 42 deletions drivers/iio/common/st_sensors/st_sensors_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,46 +38,6 @@ static int st_sensors_write_data_with_mask(struct iio_dev *indio_dev,
return err;
}

int st_sensors_get_sampling_frequency_avl(struct iio_dev *indio_dev, char *buf)
{
int i, len = 0;
struct st_sensor_data *sdata = iio_priv(indio_dev);

mutex_lock(&indio_dev->mlock);
for (i = 0; i < ST_SENSORS_ODR_LIST_MAX; i++) {
if (sdata->sensor->odr.odr_avl[i].hz == 0)
break;

len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
sdata->sensor->odr.odr_avl[i].hz);
}
mutex_unlock(&indio_dev->mlock);
buf[len - 1] = '\n';

return len;
}
EXPORT_SYMBOL(st_sensors_get_sampling_frequency_avl);

int st_sensors_get_scale_avl(struct iio_dev *indio_dev, char *buf)
{
int i, len = 0;
struct st_sensor_data *sdata = iio_priv(indio_dev);

mutex_lock(&indio_dev->mlock);
for (i = 0; i < ST_SENSORS_FULLSCALE_AVL_MAX; i++) {
if (sdata->sensor->fs.fs_avl[i].num == 0)
break;

len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ",
sdata->sensor->fs.fs_avl[i].gain);
}
mutex_unlock(&indio_dev->mlock);
buf[len - 1] = '\n';

return len;
}
EXPORT_SYMBOL(st_sensors_get_scale_avl);

static int st_sensors_match_odr(struct st_sensors *sensor,
unsigned int odr, struct st_sensor_odr_avl *odr_out)
{
Expand Down Expand Up @@ -440,18 +400,44 @@ EXPORT_SYMBOL(st_sensors_sysfs_set_sampling_frequency);
ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
struct device_attribute *attr, char *buf)
{
int i, len = 0;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct st_sensor_data *sdata = iio_priv(indio_dev);

mutex_lock(&indio_dev->mlock);
for (i = 0; i < ST_SENSORS_ODR_LIST_MAX; i++) {
if (sdata->sensor->odr.odr_avl[i].hz == 0)
break;

len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
sdata->sensor->odr.odr_avl[i].hz);
}
mutex_unlock(&indio_dev->mlock);
buf[len - 1] = '\n';

return st_sensors_get_sampling_frequency_avl(indio_dev, buf);
return len;
}
EXPORT_SYMBOL(st_sensors_sysfs_sampling_frequency_avail);

ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
struct device_attribute *attr, char *buf)
{
int i, len = 0;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct st_sensor_data *sdata = iio_priv(indio_dev);

mutex_lock(&indio_dev->mlock);
for (i = 0; i < ST_SENSORS_FULLSCALE_AVL_MAX; i++) {
if (sdata->sensor->fs.fs_avl[i].num == 0)
break;

len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ",
sdata->sensor->fs.fs_avl[i].gain);
}
mutex_unlock(&indio_dev->mlock);
buf[len - 1] = '\n';

return st_sensors_get_scale_avl(indio_dev, buf);
return len;
}
EXPORT_SYMBOL(st_sensors_sysfs_scale_avail);

Expand Down
4 changes: 0 additions & 4 deletions include/linux/iio/common/st_sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,6 @@ int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);

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

int st_sensors_get_sampling_frequency_avl(struct iio_dev *indio_dev, char *buf);

int st_sensors_get_scale_avl(struct iio_dev *indio_dev, char *buf);

int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr);

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

0 comments on commit 4d2e4fc

Please sign in to comment.