Skip to content

Commit a41a892

Browse files
committed
hwmon: (lm95245) Make temp2_crit_hyst read-only
The hysteresis register is shared among both temperature sensors. This means changing one also affects the other. To avoid confusion, established way to express this is to make only the first instance writable and keep all other instances as read-only. Otherwise users may be confused that changing the second writable value also affects the first, while it is more obvious that a writable value may affect a different read-only value. Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Jean Delvare <[email protected]>
1 parent 7276d55 commit a41a892

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Documentation/hwmon/lm95245

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ is given within a range of -127 to +127.875 degrees. Remote temperatures are
2424
given within a range of -127 to +255 degrees. Resolution depends on
2525
temperature input and range.
2626

27-
Each sensor has its own critical limit, but the hysteresis is common to all
28-
two channels.
27+
Each sensor has its own critical limit. Additionally, there is a relative
28+
hysteresis value common to both critical limits. To make life easier to
29+
user-space applications, two absolute values are exported, one for each
30+
channel, but these values are of course linked. Only the local hysteresis
31+
can be set from user-space, and the same delta applies to the remote
32+
hysteresis.
2933

3034
The lm95245 driver can change its update interval to a fixed set of values.
3135
It will round up to the next selectable interval. See the datasheet for exact

drivers/hwmon/lm95245.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL,
395395
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_input, NULL, 2);
396396
static SENSOR_DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_limit,
397397
set_limit, 7);
398-
static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_crit_hyst,
399-
set_crit_hyst, 7);
398+
static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IRUGO, show_crit_hyst, NULL, 7);
400399
static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL,
401400
STATUS1_RTCRIT);
402401
static SENSOR_DEVICE_ATTR(temp2_type, S_IWUSR | S_IRUGO, show_type,

0 commit comments

Comments
 (0)