From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 2/5] iio: pressure: bmp280: Use IIO_DEVICE_ATTR_RO macro
Date: Tue, 17 Mar 2020 12:18:10 +0200 [thread overview]
Message-ID: <20200317101813.30829-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20200317101813.30829-1-andriy.shevchenko@linux.intel.com>
Use the IIO_DEVICE_ATTR_RO macro to create the device attributes.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/iio/pressure/bmp280-core.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index 5e229b95308e..25be3ff1a6ab 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -588,7 +588,7 @@ static ssize_t bmp280_show_avail(char *buf, const int *vals, const int n)
return len;
}
-static ssize_t bmp280_show_temp_oversampling_avail(struct device *dev,
+static ssize_t in_temp_oversampling_ratio_available_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct bmp280_data *data = iio_priv(dev_to_iio_dev(dev));
@@ -596,8 +596,9 @@ static ssize_t bmp280_show_temp_oversampling_avail(struct device *dev,
return bmp280_show_avail(buf, data->chip_info->oversampling_temp_avail,
data->chip_info->num_oversampling_temp_avail);
}
+static IIO_DEVICE_ATTR_RO(in_temp_oversampling_ratio_available, 0);
-static ssize_t bmp280_show_press_oversampling_avail(struct device *dev,
+static ssize_t in_pressure_oversampling_ratio_available_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct bmp280_data *data = iio_priv(dev_to_iio_dev(dev));
@@ -605,17 +606,12 @@ static ssize_t bmp280_show_press_oversampling_avail(struct device *dev,
return bmp280_show_avail(buf, data->chip_info->oversampling_press_avail,
data->chip_info->num_oversampling_press_avail);
}
-
-static IIO_DEVICE_ATTR(in_temp_oversampling_ratio_available,
- S_IRUGO, bmp280_show_temp_oversampling_avail, NULL, 0);
-
-static IIO_DEVICE_ATTR(in_pressure_oversampling_ratio_available,
- S_IRUGO, bmp280_show_press_oversampling_avail, NULL, 0);
+static IIO_DEVICE_ATTR_RO(in_pressure_oversampling_ratio_available, 0);
static struct attribute *bmp280_attributes[] = {
&iio_dev_attr_in_temp_oversampling_ratio_available.dev_attr.attr,
&iio_dev_attr_in_pressure_oversampling_ratio_available.dev_attr.attr,
- NULL,
+ NULL
};
static const struct attribute_group bmp280_attrs_group = {
--
2.25.1
next prev parent reply other threads:[~2020-03-17 10:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-17 10:18 [PATCH v1 1/5] iio: pressure: bmp280: Tolerate IRQ before registering Andy Shevchenko
2020-03-17 10:18 ` Andy Shevchenko [this message]
2020-03-22 17:16 ` [PATCH v1 2/5] iio: pressure: bmp280: Use IIO_DEVICE_ATTR_RO macro Jonathan Cameron
2020-03-22 21:17 ` Andy Shevchenko
2020-03-23 9:38 ` Jonathan Cameron
2020-03-17 10:18 ` [PATCH v1 3/5] iio: pressure: bmp280: Explicitly mark GPIO optional Andy Shevchenko
2020-03-17 10:18 ` [PATCH v1 4/5] iio: pressure: bmp280: Drop unneeded explicit castings Andy Shevchenko
2020-03-22 17:21 ` Jonathan Cameron
2020-03-22 21:20 ` Andy Shevchenko
2020-03-17 10:18 ` [PATCH v1 5/5] iio: pressure: bmp280: Join string literals back Andy Shevchenko
2020-03-22 17:12 ` [PATCH v1 1/5] iio: pressure: bmp280: Tolerate IRQ before registering Jonathan Cameron
2020-03-22 21:15 ` Andy Shevchenko
2020-03-23 9:40 ` Jonathan Cameron
2020-03-23 10:08 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200317101813.30829-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).