All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Paul Louvel <paul.louvel@bootlin.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v3 3/6] watchdog: w83627hf_wdt: Move register offsets into driver data
Date: Tue, 6 Oct 2026 14:25:09 +0000	[thread overview]
Message-ID: <asUExcRccUEkam6l@google.com> (raw)
In-Reply-To: <20261004-w83627hf_wdt-improvements-v3-3-8e27b518595e@bootlin.com>

On Sun, Oct 04, 2026 at 02:12:51PM +0200, Paul Louvel wrote:
> @@ -491,6 +481,21 @@ static int wdt_probe(struct platform_device *pdev)
>  	wdd->min_timeout = 1;
>  	wdd->max_timeout = 255;
>  
> +	data->reg.timeout = W83627HF_WDT_TIMEOUT;
> +	data->reg.control = W83627HF_WDT_CONTROL;
> +	data->reg.csr = W836X7HF_WDT_CSR;
> +
> +	if (chip == nct6102 || chip == nct6116 || chip == nct6126) {
> +		data->reg.timeout = NCT6102D_WDT_TIMEOUT;
> +		data->reg.control = NCT6102D_WDT_CONTROL;
> +		data->reg.csr = NCT6102D_WDT_CSR;
> +	}
> +
> +	if (chip == w83697hf || chip == w83697ug) {
> +		data->reg.timeout = W83697HF_WDT_TIMEOUT;
> +		data->reg.control = W83697HF_WDT_CONTROL;
> +	}
> +

A switch statement would be cleaner here.

Also, there are only 3 distinct register configurations: default, nct61xx,
and w83697xx.  Rather than storing and copying mutable integer fields in
every driver data instance, consider defining static const register tables
and holding a pointer to them, e.g.:

    struct w83627hf_regs {
	u8 timeout;
	u8 control;
	u8 csr;
    };

    static const struct w83627hf_regs w83627hf_default_regs = {
	.timeout = W83627HF_WDT_TIMEOUT,
	.control = W83627HF_WDT_CONTROL,
	.csr = W836X7HF_WDT_CSR,
    };

    ...

    struct w83627hf_data {
	...
	const struct w83627hf_regs *regs;
    };

  reply	other threads:[~2026-10-06 14:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04 12:12 [PATCH v3 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Paul Louvel
2026-10-04 12:12 ` [PATCH v3 1/6] watchdog: w83627hf_wdt: Replace magic numbers with descriptive macros Paul Louvel
2026-10-06 14:24   ` Tzung-Bi Shih
2026-10-04 12:12 ` [PATCH v3 2/6] watchdog: w83627hf_wdt: Convert to platform driver model Paul Louvel
2026-10-06 14:24   ` Tzung-Bi Shih
2026-10-07 17:05   ` kernel test robot
2026-10-04 12:12 ` [PATCH v3 3/6] watchdog: w83627hf_wdt: Move register offsets into driver data Paul Louvel
2026-10-06 14:25   ` Tzung-Bi Shih [this message]
2026-10-09 14:12     ` Paul Louvel
2026-10-04 12:12 ` [PATCH v3 4/6] watchdog: w83627hf_wdt: Store Super I/O configurations in platform data Paul Louvel
2026-10-04 12:21   ` sashiko-bot
2026-10-06 14:25   ` Tzung-Bi Shih
2026-10-04 12:12 ` [PATCH v3 5/6] watchdog: w83627hf_wdt: Add minute mode counting Paul Louvel
2026-10-04 12:12 ` [PATCH v3 6/6] watchdog: w83627hf_wdt: Report all initialization failures in probe Paul Louvel
2026-10-06 14:25   ` Tzung-Bi Shih
2026-10-09 14:16     ` Paul Louvel

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=asUExcRccUEkam6l@google.com \
    --to=tzungbi@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=paul.louvel@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wim@linux-watchdog.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.