All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Michal Simek <michal.simek@amd.com>
Cc: Peng Fan <peng.fan@nxp.com>, Tom Rini <trini@konsulko.com>,
	u-boot@lists.denx.de,
	Vincent Guittot <vincent.guittot@linaro.org>,
	arm-scmi@vger.kernel.org, Linus Walleij <linusw@kernel.org>
Subject: Re: [PATCH 1/2] firmware: scmi: Fix setting the function
Date: Fri, 27 Mar 2026 16:12:43 +0300	[thread overview]
Message-ID: <acaCS0DdVEilbygK@stanley.mountain> (raw)
In-Reply-To: <93019930-f082-445c-a3c4-90024aadbf60@amd.com>

On Fri, Mar 27, 2026 at 12:45:00PM +0100, Michal Simek wrote:
> 
> 
> On 3/26/26 13:08, Dan Carpenter wrote:
> > Set BIT(10) when the function needs to be set, otherwise the setting is
> > ignored.
> > 
> > Fixes: 1048331f5d3c ("scmi: pinctrl: add pinctrl driver for SCMI")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> >   drivers/firmware/scmi/pinctrl.c | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/firmware/scmi/pinctrl.c b/drivers/firmware/scmi/pinctrl.c
> > index 47f7a8ad9b81..e670538c87f9 100644
> > --- a/drivers/firmware/scmi/pinctrl.c
> > +++ b/drivers/firmware/scmi/pinctrl.c
> > @@ -259,6 +259,8 @@ static int scmi_pinctrl_settings_configure_helper(struct udevice *dev,
> >   	in->attr = 0;
> >   	in->attr |= FIELD_PREP(GENMASK(9, 2), num_configs);
> >   	in->attr |= FIELD_PREP(GENMASK(1, 0), select_type);
> > +	if (function_id != SCMI_PINCTRL_FUNCTION_NONE)
> > +		in->attr |= BIT(10);
> 
> hm shouldn't be macros to use for holding that value instead?
> 
> As I see GENMASK above is the same case.
> 

I think adding macros here would make the code less readable...  If we
were going to re-use them then, sure.  But really, the code is shoving
the num_configs into bits 2-9, there isn't any special meaning beyond
that.

> >   	memcpy(in->configs, configs, num_configs * sizeof(u32) * 2);
> 
> Another magic here.

Sure, I'll send this patch on Monday.

regards,
dan carpenter

diff --git a/drivers/firmware/scmi/pinctrl.c b/drivers/firmware/scmi/pinctrl.c
index e670538c87f9..2ae02ffc81b8 100644
--- a/drivers/firmware/scmi/pinctrl.c
+++ b/drivers/firmware/scmi/pinctrl.c
@@ -245,7 +245,9 @@ static int scmi_pinctrl_settings_configure_helper(struct udevice *dev,
 		.out_msg = (u8 *)&out,
 		.out_msg_sz = sizeof(out),
 	};
-	size_t in_sz = sizeof(*in) + (num_configs * sizeof(u32) * 2);
+	/* configs are type/value pairs of size u32 */
+	size_t config_size = (num_configs * sizeof(u32) * 2);
+	size_t in_sz = sizeof(*in) + config_size;
 	int ret;
 
 	in = kzalloc(in_sz, GFP_KERNEL);
@@ -261,7 +263,7 @@ static int scmi_pinctrl_settings_configure_helper(struct udevice *dev,
 	in->attr |= FIELD_PREP(GENMASK(1, 0), select_type);
 	if (function_id != SCMI_PINCTRL_FUNCTION_NONE)
 		in->attr |= BIT(10);
-	memcpy(in->configs, configs, num_configs * sizeof(u32) * 2);
+	memcpy(in->configs, configs, config_size);
 
 	ret = devm_scmi_process_msg(dev, &msg);
 	if (ret)


  reply	other threads:[~2026-03-27 13:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 12:08 [PATCH 0/2] u-boot: pinctrl: scmi: Use standard pin muxing format Dan Carpenter
2026-03-26 12:08 ` [PATCH 1/2] firmware: scmi: Fix setting the function Dan Carpenter
2026-03-27 11:45   ` Michal Simek
2026-03-27 13:12     ` Dan Carpenter [this message]
2026-03-26 12:08 ` [PATCH 2/2] pinctrl: scmi: Use standard device tree pin muxing format Dan Carpenter
2026-03-26 12:18   ` Linus Walleij
2026-04-09 12:55 ` [PATCH 0/2] u-boot: pinctrl: scmi: Use standard " Peng Fan (OSS)

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=acaCS0DdVEilbygK@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=arm-scmi@vger.kernel.org \
    --cc=linusw@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=peng.fan@nxp.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vincent.guittot@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 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.