Several drivers simply return 0444 in their is_visible callback. Add a helper in hwmon core for this use case to avoid code duplication. Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx> --- drivers/hwmon/hwmon.c | 7 +++++++ include/linux/hwmon.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 9c35c4d03..7c26e241e 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -108,6 +108,13 @@ static const struct attribute_group hwmon_dev_attr_group = { .is_visible = hwmon_dev_attr_is_visible, }; +umode_t hwmon_visible_0444(const void *drvdata, enum hwmon_sensor_types type, + u32 attr, int channel) +{ + return 0444; +} +EXPORT_SYMBOL_GPL(hwmon_visible_0444); + static const struct attribute_group *hwmon_dev_attr_groups[] = { &hwmon_dev_attr_group, NULL diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 5c6a421ad..ce38051b6 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h @@ -422,6 +422,8 @@ struct hwmon_ops { u32 attr, int channel, long val); }; +umode_t hwmon_visible_0444(const void *drvdata, enum hwmon_sensor_types type, + u32 attr, int channel); /** * struct hwmon_channel_info - Channel information * @type: Channel type. -- 2.47.0