From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Sudeep Holla <sudeep.holla@kernel.org>
Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kernel-team@meta.com, Cristian Marussi <cristian.marussi@arm.com>,
Breno Leitao <leitao@debian.org>
Subject: Re: [PATCH v3 6/9] firmware: arm_scmi: Refactor protocol device creation logic
Date: Mon, 24 Aug 2026 10:49:48 -0700 [thread overview]
Message-ID: <20260824104948.0000454b@oss.qualcomm.com> (raw)
In-Reply-To: <20260813-acpi_scmi_pcc-v3-6-cb6b88b4ebb3@kernel.org>
On Thu, 13 Aug 2026 12:33:01 +0100
Sudeep Holla <sudeep.holla@kernel.org> wrote:
> Move the protocol validation and device creation logic in scmi_probe()
> into a reusable scmi_device_check_create() helper.
>
> The helper centralizes checks for the protocol ID range, implementation
> availability and duplicate activation before invoking
> scmi_create_protocol_devices(). This preserves the existing behavior
> while allowing the logic to be reused by the ACPI path, where protocol
> child fwnodes are absent.
>
> No functional change intended.
>
> Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
A trivial thing and one follow on from earlier. For that just be consistent
with what you choose to do for the earlier comment.
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> ---
> drivers/firmware/arm_scmi/driver.c | 60 ++++++++++++++++++++++----------------
> 1 file changed, 35 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index aad678db0f6e..951ba3df6ba6 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -3244,6 +3244,40 @@ static void scmi_enable_matching_quirks(struct scmi_info *info)
> rev->sub_vendor_id, rev->impl_ver);
> }
>
> +static void scmi_device_check_create(struct fwnode_handle *fwnode, int prot_id,
> + struct scmi_info *info)
> +{
> + int ret;
> + struct device *dev = info->dev;
> + struct scmi_handle *handle = &info->handle;
> +
> + if (!FIELD_FIT(MSG_PROTOCOL_ID_MASK, prot_id)) {
> + dev_err(dev, "Out of range protocol %d\n", prot_id);
> + return;
> + }
> +
> + if (!scmi_is_protocol_implemented(handle, prot_id)) {
> + dev_err(dev, "SCMI protocol %d not implemented\n",
> + prot_id);
Fits on one line. I didn't check if you modify this later in the series
though so if this is churn reduction, fine to leave it as it stands.
> + return;
> + }
> +
> + /*
> + * Save this valid fwnode protocol descriptor amongst
> + * @active_protocols for this SCMI instance.
> + */
> + ret = idr_alloc(&info->active_protocols, fwnode,
> + prot_id, prot_id + 1, GFP_KERNEL);
> + if (ret != prot_id) {
> + dev_err(dev, "SCMI protocol %d already activated. Skip\n",
> + prot_id);
> + return;
> + }
> +
> + fwnode_handle_get(fwnode);
> + scmi_create_protocol_devices(fwnode, info, prot_id, NULL);
If you take the suggest I made earlier to make the hand over of ownership
slightly more obvious by using the return value of fwmonde_handle_get()
then applies here too.
> +}
next prev parent reply other threads:[~2026-08-24 17:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 11:32 [PATCH v3 0/9] firmware: arm_scmi: Refactoring and enablement of ACPI PCC transport Sudeep Holla
2026-08-13 11:32 ` [PATCH v3 1/9] firmware: arm_scmi: Set fwnode for the generated SCMI platform device Sudeep Holla
2026-08-24 16:51 ` Jonathan Cameron
2026-08-13 11:32 ` [PATCH v3 2/9] firmware: arm_scmi: Extend transport driver macro to support ACPI Sudeep Holla
2026-08-24 17:04 ` Jonathan Cameron
2026-08-13 11:32 ` [PATCH v3 3/9] firmware: arm_scmi: Convert OF-only paths to generic fwnode in SCMI core Sudeep Holla
2026-08-24 17:39 ` Jonathan Cameron
2026-08-13 11:32 ` [PATCH v3 4/9] firmware: arm_scmi: Fall back to ACPI HID when "compatible" is absent Sudeep Holla
2026-08-24 17:43 ` Jonathan Cameron
2026-08-13 11:33 ` [PATCH v3 5/9] firmware: arm_scmi: Pass protocol ID to chan_available() transport callback Sudeep Holla
2026-08-24 17:45 ` Jonathan Cameron
2026-08-13 11:33 ` [PATCH v3 6/9] firmware: arm_scmi: Refactor protocol device creation logic Sudeep Holla
2026-08-24 17:49 ` Jonathan Cameron [this message]
2026-08-13 11:33 ` [PATCH v3 7/9] firmware: arm_scmi: Add ACPI PCC transport Sudeep Holla
2026-08-24 20:17 ` Jonathan Cameron
2026-08-13 11:33 ` [PATCH v3 8/9] firmware: arm_scmi: Initialise known ACPI protocol devices and channels Sudeep Holla
2026-08-24 20:21 ` Jonathan Cameron
2026-08-13 11:33 ` [PATCH v3 9/9] firmware: arm_scmi: Validate PCC shared memory signature Sudeep Holla
2026-08-24 20:24 ` Jonathan Cameron
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=20260824104948.0000454b@oss.qualcomm.com \
--to=jonathan.cameron@oss.qualcomm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=sudeep.holla@kernel.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