[PATCH 1/9] mfd: Add driver for Photonicat power management MCU

Markus Elfring Markus.Elfring at web.de
Sat Sep 7 01:10:07 PDT 2024


…
> +++ b/drivers/mfd/photonicat-pmu.c
> @@ -0,0 +1,501 @@
…
> +int pcat_pmu_execute(struct pcat_request *request)
> +{
…

Under which circumstances would you become interested to apply statements
like the following?


> +	mutex_lock(&pmu->reply_lock);
> +	if (request->frame_id == 0)
> +		request->frame_id = atomic_inc_return(&pmu->frame);
> +	pmu->reply = request;
> +	mutex_unlock(&pmu->reply_lock);
…

A) guard(mutex)(&pmu->reply_lock);
   https://elixir.bootlin.com/linux/v6.11-rc6/source/include/linux/mutex.h#L196



> +		spin_lock_irqsave(&pmu->bus_lock, flags);
> +		ret = pcat_pmu_raw_write(pmu, request->frame_id, req->cmd,
> +					 true, req->data, req->size);
> +		spin_unlock_irqrestore(&pmu->bus_lock, flags);
…

B) guard(spinlock_irqsave)(&pmu->bus_lock);
   https://elixir.bootlin.com/linux/v6.11-rc6/source/include/linux/spinlock.h#L572


Regards,
Markus



More information about the Linux-rockchip mailing list