From: Cristian Marussi <cristian.marussi@arm.com>
To: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Cc: Cristian Marussi <cristian.marussi@arm.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
linux-doc@vger.kernel.org, sudeep.holla@kernel.org,
james.quinlan@broadcom.com, f.fainelli@gmail.com,
vincent.guittot@linaro.org, etienne.carriere@st.com,
peng.fan@oss.nxp.com, michal.simek@amd.com, d-gole@ti.com,
elif.topuz@arm.com, lukasz.luba@arm.com, philip.radford@arm.com,
david@kernel.org, souvik.chakravarty@arm.com, leitao@kernel.org,
kas@kernel.org, puranjay@kernel.org, usama.arif@linux.dev,
kernel-team@meta.com
Subject: Re: [PATCH v14 03/32] firmware: arm_scmi: Refactor __scmi_event_handler_get_ops helper
Date: Thu, 5 Nov 2026 17:38:20 +0000 [thread overview]
Message-ID: <auy_DP2okO9o7Yee@pluto> (raw)
In-Reply-To: <20261019134657.0000624a@oss.qualcomm.com>
On Mon, Oct 19, 2026 at 01:46:57PM -0700, Jonathan Cameron wrote:
> On Fri, 16 Oct 2026 19:55:24 +0100
> Cristian Marussi <cristian.marussi@arm.com> wrote:
>
> > Refactor the __scmi_event_handler_get_ops notification helper to simplify
> > its logic and make use of guards for locking.
> >
> > Mostly no functional change, in the sense that while the functionality
> > remained the same, a richer set of errors is returned where before was
> > always a -EINVAL.
>
> Maybe mention why scmi_allocate_event_handler() is now wrapped in
> an scmi_allocate_pending_event_handler()
>
> I like the change but beyond logical division of activities it
> isn't immediately obvious why that split exists.
I'll do.
>
> One really minor thing inline that I don't care that much about.
>
> Anyhow, both trivial so
> Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
>
> >
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> > drivers/firmware/arm_scmi/notify.c | 73 +++++++++++++++++++-----------
> > 1 file changed, 46 insertions(+), 27 deletions(-)
> >
> > diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
> > index 7d1bb424a723..2bc2e03df639 100644
> > --- a/drivers/firmware/arm_scmi/notify.c
> > +++ b/drivers/firmware/arm_scmi/notify.c
> > @@ -890,7 +890,6 @@ void scmi_deregister_protocol_events(const struct scmi_handle *handle,
> >
> > /**
> > * scmi_allocate_event_handler() - Allocate Event handler
> > - * @ni: A reference to the notification instance to use
> > * @evt_key: 32bit key uniquely bind to the event identified by the tuple
> > * (proto_id, evt_id, src_id)
> > *
> > @@ -903,8 +902,7 @@ void scmi_deregister_protocol_events(const struct scmi_handle *handle,
> > * Context: Assumes to be called with @pending_mtx already acquired.
> > * Return: the freshly allocated structure on Success
> > */
> > -static struct scmi_event_handler *
> > -scmi_allocate_event_handler(struct scmi_notify_instance *ni, u32 evt_key)
> > +static struct scmi_event_handler *scmi_allocate_event_handler(u32 evt_key)
> > {
> > struct scmi_event_handler *hndl;
> >
> > @@ -914,8 +912,20 @@ scmi_allocate_event_handler(struct scmi_notify_instance *ni, u32 evt_key)
> > hndl->key = evt_key;
> > BLOCKING_INIT_NOTIFIER_HEAD(&hndl->chain);
> > refcount_set(&hndl->users, 1);
> > - /* New handlers are created pending */
> > - hash_add(ni->pending_events_handlers, &hndl->hash, hndl->key);
> > +
> > + return hndl;
> > +}
> > +
> > +static struct scmi_event_handler *
> > +scmi_allocate_pending_event_handler(struct scmi_notify_instance *ni,
> > + u32 evt_key)
> > +{
> > + struct scmi_event_handler *hndl;
> > +
> > + lockdep_assert_held(&ni->pending_mtx);
> > + hndl = scmi_allocate_event_handler(evt_key);
> > + if (hndl)
> > + hash_add(ni->pending_events_handlers, &hndl->hash, hndl->key);
> Trivial but I'd keep to a strict errors out of line
> if (!hndl)
> return NULL
>
> hash_add(ni->...
>
> return hndl;
>
> It burns a few lines be saves a few brain cells.
>
yes, I prefer this too...I'll do.
Thanks,
Cristian
next prev parent reply other threads:[~2026-11-05 17:38 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 18:55 [PATCH v14 00/32] Introduce SCMI Telemetry support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 01/32] firmware: arm_scmi: Add new SCMIv4.0 error codes definitions Cristian Marussi
2026-10-19 20:34 ` Jonathan Cameron
2026-11-05 16:52 ` Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 02/32] firmware: arm_scmi: Allow registration of unknown-size events/reports Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 03/32] firmware: arm_scmi: Refactor __scmi_event_handler_get_ops helper Cristian Marussi
2026-10-19 20:46 ` Jonathan Cameron
2026-11-05 17:38 ` Cristian Marussi [this message]
2026-10-16 18:55 ` [PATCH v14 04/32] firmware: arm_scmi: Introduce protocol instance notifiers Cristian Marussi
2026-10-19 21:02 ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 05/32] dt-bindings: firmware: arm,scmi: Add support for telemetry protocol Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 06/32] include: trace: Add Telemetry trace events Cristian Marussi
2026-10-19 21:03 ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 07/32] firmware: arm_scmi: Add Telemetry basic attributes enumeration Cristian Marussi
2026-10-19 21:27 ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 08/32] firmware: arm_scmi: Add Telemetry resources enumeration Cristian Marussi
2026-10-19 23:28 ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 09/32] firmware: arm_scmi: Add Telemetry groups initialization Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 10/32] firmware: arm_scmi: Add Telemetry update intervals enumeration Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 11/32] firmware: arm_scmi: Add Telemetry SHMTI areas enumeration Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 12/32] firmware: arm_scmi: Add Telemetry TDCF areas parsing support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 13/32] firmware: arm_scmi: Add Telemetry TDCF parsing for BLK_TS lines Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 14/32] firmware: arm_scmi: Add Telemetry TDCF parsing for UUID lines Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 15/32] firmware: arm_scmi: Add Telemetry configuration operations Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 16/32] firmware: arm_scmi: Add Telemetry DataEvent read capabilities Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 17/32] firmware: arm_scmi: Add Telemetry reset logic Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 18/32] firmware: arm_scmi: Add Telemetry notification support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 19/32] firmware: arm_scmi: Add Telemetry boot-on support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 20/32] firmware: arm-scmi: Add Telemetry generic event support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 21/32] firmware: arm_scmi: Add Telemetry generation counter event Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 22/32] firmware: arm_scmi: Add common per-protocol debugfs support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 23/32] firmware: arm_scmi: Add Telemetry debugfs SHMTI dump support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 24/32] firmware: arm_scmi: Add Telemetry debugfs ABI documentation Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 25/32] firmware: arm_scmi: Expose per-instance identifier Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 26/32] firmware: arm_scmi: Add un-managed methods to get/put protocols operations Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 27/32] uapi: Add ARM SCMI Telemetry definitions Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 28/32] firmware: arm_scmi: Add System Telemetry driver Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 29/32] docs: ioctl-number: Add SCMI Ioctls Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 30/32] [RFC] Documentation: Add SCMI System Telemetry documentation Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 31/32] [RFC] tools/testing/scmi: Add SCMI Telemetry testing tool Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 32/32] kselftest/arm64: Add SCMI Telemetry UAPI compliance testcases Cristian Marussi
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=auy_DP2okO9o7Yee@pluto \
--to=cristian.marussi@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=d-gole@ti.com \
--cc=david@kernel.org \
--cc=elif.topuz@arm.com \
--cc=etienne.carriere@st.com \
--cc=f.fainelli@gmail.com \
--cc=james.quinlan@broadcom.com \
--cc=jonathan.cameron@oss.qualcomm.com \
--cc=kas@kernel.org \
--cc=kernel-team@meta.com \
--cc=leitao@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=michal.simek@amd.com \
--cc=peng.fan@oss.nxp.com \
--cc=philip.radford@arm.com \
--cc=puranjay@kernel.org \
--cc=souvik.chakravarty@arm.com \
--cc=sudeep.holla@kernel.org \
--cc=usama.arif@linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox