From: Guenter Roeck <linux@roeck-us.net>
To: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Cc: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 5/7] hwmon: (core) Make is_visible callback truly mandatory
Date: Sun, 20 Nov 2016 09:36:26 -0800 [thread overview]
Message-ID: <1479663388-2000-5-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1479663388-2000-1-git-send-email-linux@roeck-us.net>
The is_visible callback provides the sysfs attribute mode and is thus
truly mandatory as documented. Check it once at registration and remove
other checks for its existence.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/hwmon.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 971c9eb78e6a..a0b5becf91fa 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -559,7 +559,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
hdev = &hwdev->dev;
- if (chip && chip->ops->is_visible) {
+ if (chip) {
struct attribute **attrs;
int ngroups = 2;
@@ -605,7 +605,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
if (err)
goto free_hwmon;
- if (chip && chip->ops->is_visible && chip->ops->read &&
+ if (chip && chip->ops->read &&
chip->info[0]->type == hwmon_chip &&
(chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) {
const struct hwmon_channel_info **info = chip->info;
@@ -673,7 +673,7 @@ hwmon_device_register_with_info(struct device *dev, const char *name,
const struct hwmon_chip_info *chip,
const struct attribute_group **groups)
{
- if (chip && (!chip->ops || !chip->info))
+ if (chip && (!chip->ops || !chip->ops->is_visible || !chip->info))
return ERR_PTR(-EINVAL);
return __hwmon_device_register(dev, name, drvdata, chip, groups);
--
2.5.0
next prev parent reply other threads:[~2016-11-20 17:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-20 17:36 [PATCH 1/7] hwmon: (core) Clarify when read and write callbacks are mandatory Guenter Roeck
2016-11-20 17:36 ` [PATCH 2/7] hwmon: (core) Add support for string attributes to new API Guenter Roeck
2016-11-20 17:36 ` [PATCH 3/7] hwmon: (core) Clarify use of chip attributes Guenter Roeck
2016-11-20 17:36 ` [PATCH 4/7] hwmon: (core) Deprecate hwmon_device_register() Guenter Roeck
2016-11-20 17:36 ` Guenter Roeck [this message]
2016-11-20 17:36 ` [PATCH 6/7] hwmon: (core) Explain why at least two attribute groups are allocated Guenter Roeck
2016-11-20 17:36 ` [PATCH 7/7] hwmon: (core) Rename groups parameter in API to extra_groups Guenter Roeck
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=1479663388-2000-5-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.