mirror of https://gitee.com/openkylin/linux.git
staging:iio:accel:sca3000 replace non standard revision attr with dev_info on probe
There seems little point in being able to query the part revision number via sysfs. Hence just put it in the kernel logs during probe incase anyone ever wants to know. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
6831c17236
commit
7ab9fa0052
|
@ -411,26 +411,23 @@ static int sca3000_read_ctrl_reg(struct sca3000_state *st,
|
||||||
/**
|
/**
|
||||||
* sca3000_show_rev() - sysfs interface to read the chip revision number
|
* sca3000_show_rev() - sysfs interface to read the chip revision number
|
||||||
**/
|
**/
|
||||||
static ssize_t sca3000_show_rev(struct device *dev,
|
static int sca3000_print_rev(struct iio_dev *indio_dev)
|
||||||
struct device_attribute *attr,
|
|
||||||
char *buf)
|
|
||||||
{
|
{
|
||||||
int len = 0, ret;
|
int ret;
|
||||||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
|
||||||
struct sca3000_state *st = iio_priv(indio_dev);
|
struct sca3000_state *st = iio_priv(indio_dev);
|
||||||
|
|
||||||
mutex_lock(&st->lock);
|
mutex_lock(&st->lock);
|
||||||
ret = sca3000_read_data_short(st, SCA3000_REG_REVID_ADDR, 1);
|
ret = sca3000_read_data_short(st, SCA3000_REG_REVID_ADDR, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
len += sprintf(buf + len,
|
dev_info(&indio_dev->dev,
|
||||||
"major=%lu, minor=%lu\n",
|
"sca3000 revision major=%lu, minor=%lu\n",
|
||||||
st->rx[0] & SCA3000_REG_REVID_MAJOR_MASK,
|
st->rx[0] & SCA3000_REG_REVID_MAJOR_MASK,
|
||||||
st->rx[0] & SCA3000_REG_REVID_MINOR_MASK);
|
st->rx[0] & SCA3000_REG_REVID_MINOR_MASK);
|
||||||
error_ret:
|
error_ret:
|
||||||
mutex_unlock(&st->lock);
|
mutex_unlock(&st->lock);
|
||||||
|
|
||||||
return ret ? ret : len;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
|
@ -457,9 +454,6 @@ sca3000_show_available_3db_freqs(struct device *dev,
|
||||||
static IIO_DEVICE_ATTR(in_accel_filter_low_pass_3db_frequency_available,
|
static IIO_DEVICE_ATTR(in_accel_filter_low_pass_3db_frequency_available,
|
||||||
S_IRUGO, sca3000_show_available_3db_freqs,
|
S_IRUGO, sca3000_show_available_3db_freqs,
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
/* More standard attributes */
|
|
||||||
|
|
||||||
static IIO_DEVICE_ATTR(revision, S_IRUGO, sca3000_show_rev, NULL, 0);
|
|
||||||
|
|
||||||
static const struct iio_event_spec sca3000_event = {
|
static const struct iio_event_spec sca3000_event = {
|
||||||
.type = IIO_EV_TYPE_MAG,
|
.type = IIO_EV_TYPE_MAG,
|
||||||
|
@ -921,7 +915,6 @@ static int sca3000_write_event_value(struct iio_dev *indio_dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct attribute *sca3000_attributes[] = {
|
static struct attribute *sca3000_attributes[] = {
|
||||||
&iio_dev_attr_revision.dev_attr.attr,
|
|
||||||
&iio_dev_attr_in_accel_filter_low_pass_3db_frequency_available.dev_attr.attr,
|
&iio_dev_attr_in_accel_filter_low_pass_3db_frequency_available.dev_attr.attr,
|
||||||
&iio_dev_attr_sampling_frequency_available.dev_attr.attr,
|
&iio_dev_attr_sampling_frequency_available.dev_attr.attr,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1465,6 +1458,11 @@ static int sca3000_probe(struct spi_device *spi)
|
||||||
ret = sca3000_clean_setup(st);
|
ret = sca3000_clean_setup(st);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_free_irq;
|
goto error_free_irq;
|
||||||
|
|
||||||
|
ret = sca3000_print_rev(indio_dev);
|
||||||
|
if (ret)
|
||||||
|
goto error_free_irq;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_free_irq:
|
error_free_irq:
|
||||||
|
|
Loading…
Reference in New Issue