Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1530597
| From | Boyan Vladinov <nayobix@nayobix.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] Staging: iio: adc: fix sysfs files modes in ad7192.c |
| Date | 2016-11-26 07:20 +0100 |
| Message-ID | <sHEv7-2Sx-3@gated-at.bofh.it> (permalink) |
| References | <sHfZL-41w-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Ignore patch version...comments below
Will resend it
On 24.11.2016 19:38, Boyan Vladinov wrote:
> Fixes sysfs entries user/group modes and coding style warnings
> found by checkpatch.pl tool. Also use the IIO_DEVICE_ATTR_[RO|RW] and
> macros to create device attributes
>
> Signed-off-by: Boyan Vladinov <nayobix@nayobix.org>
> ---
> drivers/staging/iio/adc/ad7192.c | 45 +++++++++++++++++++++++-----------------
> 1 file changed, 26 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> index 1fb68c01abd5..630b04d8128f 100644
> --- a/drivers/staging/iio/adc/ad7192.c
> +++ b/drivers/staging/iio/adc/ad7192.c
> @@ -324,8 +324,8 @@ static int ad7192_setup(struct ad7192_state *st,
> }
>
> static ssize_t
> -ad7192_show_scale_available(struct device *dev,
> - struct device_attribute *attr, char *buf)
> +in_v_m_v_scale_available_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> {
> struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> struct ad7192_state *st = iio_priv(indio_dev);
> @@ -340,15 +340,19 @@ ad7192_show_scale_available(struct device *dev,
> return len;
> }
>
> -static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available,
> - in_voltage-voltage_scale_available,
behavior changed after removed `in_voltage-voltage_scale_available`
> - S_IRUGO, ad7192_show_scale_available, NULL, 0);
> +static ssize_t
> +in_voltage_scale_available_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return in_v_m_v_scale_available_show(dev, attr, buf);
> +}
> +
> +static IIO_DEVICE_ATTR_RO(in_v_m_v_scale_available, 0);
>
> -static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
> - ad7192_show_scale_available, NULL, 0);
> +static IIO_DEVICE_ATTR_RO(in_voltage_scale_available, 0);
>
> -static ssize_t ad7192_show_ac_excitation(struct device *dev,
> - struct device_attribute *attr,
> +static ssize_t ac_excitation_en_show(struct device *dev,
> + struct device_attribute *attr,
> char *buf)
> {
> struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> @@ -357,8 +361,8 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev,
> return sprintf(buf, "%d\n", !!(st->mode & AD7192_MODE_ACX));
> }
>
> -static ssize_t ad7192_show_bridge_switch(struct device *dev,
> - struct device_attribute *attr,
> +static ssize_t bridge_switch_en_show(struct device *dev,
> + struct device_attribute *attr,
> char *buf)
> {
> struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> @@ -367,8 +371,8 @@ static ssize_t ad7192_show_bridge_switch(struct device *dev,
> return sprintf(buf, "%d\n", !!(st->gpocon & AD7192_GPOCON_BPDSW));
> }
>
> -static ssize_t ad7192_set(struct device *dev,
> - struct device_attribute *attr,
> +static ssize_t bridge_switch_en_store(struct device *dev,
> + struct device_attribute *attr,
> const char *buf,
> size_t len)
> {
> @@ -412,13 +416,16 @@ static ssize_t ad7192_set(struct device *dev,
> return ret ? ret : len;
> }
>
> -static IIO_DEVICE_ATTR(bridge_switch_en, S_IRUGO | S_IWUSR,
> - ad7192_show_bridge_switch, ad7192_set,
> - AD7192_REG_GPOCON);
> +static ssize_t ac_excitation_en_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t len)
> +{
> + return bridge_switch_en_store(dev, attr, buf, len);
> +}
> +
> +static IIO_DEVICE_ATTR_RW(bridge_switch_en, AD7192_REG_GPOCON);
>
> -static IIO_DEVICE_ATTR(ac_excitation_en, S_IRUGO | S_IWUSR,
> - ad7192_show_ac_excitation, ad7192_set,
> - AD7192_REG_MODE);
> +static IIO_DEVICE_ATTR_RW(ac_excitation_en, AD7192_REG_MODE);
>
> static struct attribute *ad7192_attributes[] = {
> &iio_dev_attr_in_v_m_v_scale_available.dev_attr.attr,
>
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH v2] Staging: iio: adc: fix sysfs files modes in ad7192.c Boyan Vladinov <nayobix@nayobix.org> - 2016-11-26 07:20 +0100
csiph-web