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

Markus Elfring
2025-02-19T20:58:00Z

…
> +++ 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);
}

…
> +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

Regards,
Markus