[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220701134509.e6wk3vwhimqre6h5@bogus>
Date: Fri, 1 Jul 2022 14:45:09 +0100
From: Sudeep Holla <sudeep.holla@....com>
To: Cristian Marussi <cristian.marussi@....com>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
vincent.guittot@...aro.org, f.fainelli@...il.com,
Sudeep Holla <sudeep.holla@....com>
Subject: Re: [PATCH 2/5] firmware: arm_scmi: Support only one single
SystemPower device
On Thu, Jun 23, 2022 at 01:47:39PM +0100, Cristian Marussi wrote:
> In order to minimize SCMI platform fw-side complexity, only one single SCMI
> platform should be in charge of SCMI SystemPower protocol communications
> with the OSPM: enforce the existence of one single unique device associated
> with SystemPower protocol across any possible number of SCMI platforms, and
> warn if a system tries to register different SystemPower devices from
> multiple platforms.
>
> Signed-off-by: Cristian Marussi <cristian.marussi@....com>
> ---
> drivers/firmware/arm_scmi/bus.c | 31 ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
> index a7cbf4d09081..476855d3dccb 100644
> --- a/drivers/firmware/arm_scmi/bus.c
> +++ b/drivers/firmware/arm_scmi/bus.c
> @@ -19,6 +19,11 @@ static DEFINE_IDA(scmi_bus_id);
> static DEFINE_IDR(scmi_protocols);
> static DEFINE_SPINLOCK(protocol_lock);
>
> +/* Track globally the creation of SCMI SystemPower related devices */
> +static bool scmi_syspower_registered;
> +/* Protect access to scmi_syspower_registered */
> +static DEFINE_MUTEX(scmi_syspower_mtx);
> +
Since we create device from the driver, can't we do this from there
and keep the bus code free from handling all these special conditions
which are checked for each device creation.
Yes scmi_device_create can be called outside the exiting code but since it
is not exported(yet), we can assume all users are in kernel and we can
catch that if anyone attempts to add. And probably we don't need the lock
as well if it is taken care in the single loop creating the device.
--
Regards,
Sudeep
Powered by blists - more mailing lists