public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Zev Weiss <zev@bewilderbeest.net>
Cc: Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, Renze Nicolai <renze@rnplus.nl>,
	Oleksandr Natalenko <oleksandr@natalenko.name>,
	openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/6] hwmon: (nct6775) Convert register access to regmap API
Date: Mon, 25 Apr 2022 08:24:53 -0700	[thread overview]
Message-ID: <20220425152453.GA4166687@roeck-us.net> (raw)
In-Reply-To: <20220309005047.5107-3-zev@bewilderbeest.net>

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@bewilderbeest.net>
> ---
>  drivers/hwmon/nct6775.c | 977 +++++++++++++++++++++++++++-------------

Needs "select REGMAP" in Kconfig.

Guenter

  reply	other threads:[~2022-04-25 15:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09  0:50 [PATCH v2 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
2022-03-09  0:50 ` [PATCH v2 1/6] dt-bindings: hwmon: Add nuvoton,nct6775 Zev Weiss
2022-04-25 15:07   ` Guenter Roeck
2022-04-26  1:23     ` Zev Weiss
2022-03-09  0:50 ` [PATCH v2 2/6] hwmon: (nct6775) Convert register access to regmap API Zev Weiss
2022-04-25 15:24   ` Guenter Roeck [this message]
2022-03-09  0:50 ` [PATCH v2 3/6] hwmon: (nct6775) Rearrange attr-group initialization Zev Weiss
2022-03-09  0:50 ` [PATCH v2 4/6] hwmon: (nct6775) Add read-only mode Zev Weiss
2022-03-09  0:50 ` [PATCH v2 5/6] hwmon: (nct6775) Split core and platform driver Zev Weiss
2022-04-25 15:23   ` Guenter Roeck
2022-03-09  0:50 ` [PATCH v2 6/6] hwmon: (nct6775) Add i2c driver Zev Weiss
2022-04-25 15:37   ` Guenter Roeck
2022-03-09  8:12 ` [PATCH v2 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Paul Menzel
2022-03-09 11:16   ` Zev Weiss
2022-03-10 19:13 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220425152453.GA4166687@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr@natalenko.name \
    --cc=openbmc@lists.ozlabs.org \
    --cc=renze@rnplus.nl \
    --cc=zev@bewilderbeest.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox