[PATCH v7 4/6] media: platform: synopsys: Add support for HDMI input driver

Dmitry Osipenko dmitry.osipenko at collabora.com
Sat Feb 22 13:25:18 PST 2025


On 2/19/25 23:56, Markus Elfring wrote:
>>> +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
>> @@ -0,0 +1,2718 @@
>>> +static u32 hdmirx_readl(struct snps_hdmirx_dev *hdmirx_dev, int reg)
>> +{
>> +	u32 val;
>> +
>> +	guard(spinlock_irqsave)(&hdmirx_dev->rst_lock);
>> +
>> +	val = readl(hdmirx_dev->regs + reg);
>> +
>> +	return val;
>> +}
> 
> May such a function implementation be simplified?
> 
> {
> 	guard(spinlock_irqsave)(&hdmirx_dev->rst_lock);
> 	return readl(hdmirx_dev->regs + reg);
> }

That will work, thanks.

>>> +static int hdmirx_get_detected_timings(struct snps_hdmirx_dev *hdmirx_dev,
>> +				       struct v4l2_dv_timings *timings)
>> +{
>>> +	mutex_lock(&hdmirx_dev->work_lock);
>> +retry:
>> +	memset(timings, 0, sizeof(struct v4l2_dv_timings));
>>> +	mutex_unlock(&hdmirx_dev->work_lock);
>> +
>> +	return ret;
>> +}
>> 
> Would you become interested to apply a statement like “guard(mutex)(&hdmirx_dev->work_lock);”?
> https://elixir.bootlin.com/linux/v6.14-rc3/source/include/linux/mutex.h#L201

That will make code less consistent and less intuitive to me. Anyways,
thanks for the suggestion.

-- 
Best regards,
Dmitry



More information about the Linux-rockchip mailing list