hwmon: (max31827) Make code cleaner
authorDaniel Matyas <daniel.matyas@analog.com>
Tue, 19 Sep 2023 09:34:49 +0000 (12:34 +0300)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 28 Oct 2023 16:21:36 +0000 (09:21 -0700)
commit9ca6696718cc3f8ca94172d834567f35500f21bf
tree4d919640e4eca1669cd95e046689a5438319d9cf
parentb344041db783c4cb1e1944a1d5eae6651af72483
hwmon: (max31827) Make code cleaner

Used enums and while loops to replace switch for selecting and getting
update interval from conversion rate bits.

Divided the write_alarm_val function into 2 functions. The new function
is more generic: it can be used not only for alarm writes, but for any
kind of writes which require the device to be in shutdown mode.

Signed-off-by: Daniel Matyas <daniel.matyas@analog.com>
Link: https://lore.kernel.org/r/20230919093456.10592-1-daniel.matyas@analog.com
[groeck: Reverted error return value change (EOPNOTSUPP -> EINVAL)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max31827.c