Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Russell King <linux@armlinux.org.uk>,
	Mark Brown <broonie@kernel.org>,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Arnd Bergmann <arnd@arndb.de>,
	mfd@lists.linux.dev, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	patches@opensource.cirrus.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/4] mfd: wm831x: Support software nodes for DCDC regulators
Date: Wed, 4 Nov 2026 18:14:29 +0000	[thread overview]
Message-ID: <20261104181429.GE1650678@google.com> (raw)
In-Reply-To: <20261024-samsung-kp-v4-1-e21253295e68@gmail.com>

On Sat, 24 Oct 2026, Dmitry Torokhov wrote:

> Allow passing software nodes to wm831x DCDC regulators via PMIC platform
> data. This is useful for non-DT/non-ACPI platforms that want to
> associate device properties (like DVS GPIOs) with the regulator devices
> using software nodes.
> 
> Add software node pointers to the PMIC platform data and have the MFD
> core assign them to the buckv cells.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/mfd/wm831x-core.c        | 47 ++++++++++++++++++++++++++++++----------
>  include/linux/mfd/wm831x/pdata.h |  2 ++
>  2 files changed, 37 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
> index df8e76e000cc..c4793be419ba 100644
> --- a/drivers/mfd/wm831x-core.c
> +++ b/drivers/mfd/wm831x-core.c
> @@ -14,6 +14,7 @@
>  #include <linux/delay.h>
>  #include <linux/mfd/core.h>
>  #include <linux/slab.h>
> +#include <linux/string.h>
>  #include <linux/err.h>
>  
>  #include <linux/mfd/wm831x/core.h>
> @@ -1449,6 +1450,32 @@ const struct of_device_id wm831x_of_match[] = {
>  };
>  EXPORT_SYMBOL_GPL(wm831x_of_match);
>  
> +static int wm831x_add_devices(struct wm831x *wm831x, int wm831x_num,
> +			      const struct mfd_cell *cells, int num_cells)
> +{
> +	struct wm831x_pdata *pdata = &wm831x->pdata;
> +	int i;
> +
> +	struct mfd_cell *local_cells __free(kfree) =
> +		kmemdup_array(cells, num_cells, sizeof(*cells), GFP_KERNEL);
> +	if (!local_cells)
> +		return -ENOMEM;
> +
> +	for (i = 0; i < num_cells; i++) {
> +		struct mfd_cell *cell = &local_cells[i];
> +
> +		if (strcmp(cell->name, "wm831x-buckv") == 0) {
> +			int id = cell->id - 1;
> +
> +			if (id >= 0 && id < WM831X_MAX_DCDC)
> +				cell->swnode = pdata->dcdc_swnodes[id];
> +		}
> +	}

I can't begin to tell you how much I hate this.

Why are we duplicating massive static const structs just to add a S/W
node?  Is there no other way we can do this statically?

Since pdata is being populated already, why not just pass that on to the
consuming child device (the regulator)?

> +	return mfd_add_devices(wm831x->dev, wm831x_num, local_cells, num_cells,
> +			       NULL, 0, NULL);
> +}

-- 
Lee Jones


  parent reply	other threads:[~2026-11-04 18:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25  5:03 [PATCH v4 0/4] ARM: s3c: crag6410: Convert to software nodes and properties Dmitry Torokhov
2026-10-25  5:03 ` [PATCH v4 1/4] mfd: wm831x: Support software nodes for DCDC regulators Dmitry Torokhov
2026-10-26 10:15   ` Charles Keepax
2026-10-28  9:38   ` Bartosz Golaszewski
2026-11-04 18:14   ` Lee Jones [this message]
2026-10-25  5:03 ` [PATCH v4 2/4] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties Dmitry Torokhov
2026-10-28  9:38   ` Bartosz Golaszewski
2026-10-25  5:03 ` [PATCH v4 3/4] ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs " Dmitry Torokhov
2026-10-25  5:03 ` [PATCH v4 4/4] ARM: s3c: crag6410: convert WM1250 and SPI0 GPIO lookup tables to property entries Dmitry Torokhov
2026-10-26 13:51 ` [PATCH v4 0/4] ARM: s3c: crag6410: Convert to software nodes and properties Arnd Bergmann
2026-10-27  1:07   ` Dmitry Torokhov

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=20261104181429.GE1650678@google.com \
    --to=lee@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=arnd@arndb.de \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzk@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mfd@lists.linux.dev \
    --cc=patches@opensource.cirrus.com \
    --cc=peter.griffin@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox