summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2016-10-17 02:06:20 +0200
committerGuenter Roeck <linux@roeck-us.net>2016-12-10 06:54:20 +0100
commit239552f495b91fc8f3fba4b5094233e053d265cb (patch)
tree956132667566b4ea6210e583f5effc2dde1bdccf /drivers/hwmon
parenthwmon: (core) Deprecate hwmon_device_register() (diff)
downloadlinux-239552f495b91fc8f3fba4b5094233e053d265cb.tar.xz
linux-239552f495b91fc8f3fba4b5094233e053d265cb.zip
hwmon: (core) Make is_visible callback truly mandatory
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/hwmon.c6
1 files 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);