[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220425152453.GA4166687@roeck-us.net>
Date: Mon, 25 Apr 2022 08:24:53 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Zev Weiss <zev@...ilderbeest.net>
Cc: Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
Renze Nicolai <renze@...lus.nl>,
Oleksandr Natalenko <oleksandr@...alenko.name>,
openbmc@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/6] hwmon: (nct6775) Convert register access to
regmap API
On Tue, Mar 08, 2022 at 04:50:43PM -0800, Zev Weiss wrote:
> This replaces the nct6775_data->{read,write}_value function pointers
> with a regmap.
>
> The major difference is that the regmap access functions may fail, and
> hence require checking at each call site. While the existing WMI
> register-access code had potential failure paths, they were masked by
> the fact that the read_value() function returned the register value
> directly, and hence squashed errors undetectably by simply returning
> zero, and while the write_value() functions were capable of reporting
> errors, all callers ignored them.
>
> This improves the robustness of the existing code, and also prepares
> the driver for an i2c version to be added soon, for which register
> accesses are much more likely to actually fail.
>
> The conversion of the register-access call sites is largely mechanical
> (reading a register now returns the value via an out-param pointer,
> and returned errors must be checked for and propagated to callers),
> though the nct6775_write_fan_div() function is refactored slightly to
> avoid duplicating nearly identical (and now lengthier) code in each
> switch case.
>
> Signed-off-by: Zev Weiss <zev@...ilderbeest.net>
> ---
> drivers/hwmon/nct6775.c | 977 +++++++++++++++++++++++++++-------------
Needs "select REGMAP" in Kconfig.
Guenter
Powered by blists - more mailing lists