]> git.baikalelectronics.ru Git - kernel.git/commit
hwmon: (pmbus) Improve initialization of 'currpage' and 'currphase'
authorGuenter Roeck <linux@roeck-us.net>
Thu, 7 May 2020 17:21:33 +0000 (10:21 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 22 May 2020 13:28:38 +0000 (06:28 -0700)
commit8005f9f5287e72577ed6a11d6c1da9c500ca14cf
tree76c0c7024896f76f988752b188689c6dfa44078e
parente135c43b7652e29381388048e9b797561688505f
hwmon: (pmbus) Improve initialization of 'currpage' and 'currphase'

The 'currpage' and 'currphase' variables in struct pmbus_data are used by
the PMBus core to determine if the phase or page value has changed. Both
are initialized with values which are never expected to be set in the code
to ensure that the first page/phase write operation is actually performed.

This is not well explained and occasionally causes confusion. Change the
type of both variables to s16 and initialize with -1 to ensure that the
initial value never matches a requested value, and clarify that this
value means "unknown/unset".

Cc: Alex Qiu <xqiu@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/pmbus_core.c