@@ -145,6 +145,17 @@ static const struct class hwmon_class = {
145145
146146static DEFINE_IDA (hwmon_ida );
147147
148+ static umode_t hwmon_is_visible (const struct hwmon_ops * ops ,
149+ const void * drvdata ,
150+ enum hwmon_sensor_types type ,
151+ u32 attr , int channel )
152+ {
153+ if (ops -> visible )
154+ return ops -> visible ;
155+
156+ return ops -> is_visible (drvdata , type , attr , channel );
157+ }
158+
148159/* Thermal zone handling */
149160
150161/*
@@ -267,8 +278,8 @@ static int hwmon_thermal_register_sensors(struct device *dev)
267278 int err ;
268279
269280 if (!(info [i ]-> config [j ] & HWMON_T_INPUT ) ||
270- !chip -> ops -> is_visible ( drvdata , hwmon_temp ,
271- hwmon_temp_input , j ))
281+ !hwmon_is_visible ( chip -> ops , drvdata , hwmon_temp ,
282+ hwmon_temp_input , j ))
272283 continue ;
273284
274285 err = hwmon_thermal_add_sensor (dev , j );
@@ -506,7 +517,7 @@ static struct attribute *hwmon_genattr(const void *drvdata,
506517 const char * name ;
507518 bool is_string = is_string_attr (type , attr );
508519
509- mode = ops -> is_visible ( drvdata , type , attr , index );
520+ mode = hwmon_is_visible ( ops , drvdata , type , attr , index );
510521 if (!mode )
511522 return ERR_PTR (- ENOENT );
512523
@@ -1033,7 +1044,7 @@ hwmon_device_register_with_info(struct device *dev, const char *name,
10331044 if (!dev || !name || !chip )
10341045 return ERR_PTR (- EINVAL );
10351046
1036- if (!chip -> ops || !chip -> ops -> is_visible || !chip -> info )
1047+ if (!chip -> ops || !( chip -> ops -> visible || chip -> ops -> is_visible ) || !chip -> info )
10371048 return ERR_PTR (- EINVAL );
10381049
10391050 return __hwmon_device_register (dev , name , drvdata , chip , extra_groups );
0 commit comments