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

Junhao Xie bigfoot at classfun.cn
Sat Sep 7 07:46:29 PDT 2024


On 2024/9/7 16:10, Markus Elfring wrote:
>>> +++ 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

Thanks for your suggestions, I will try these statements.

Best regards,
Junhao



More information about the linux-arm-kernel mailing list