[PATCH] media: stm32: dcmi: Switch to __v4l2_subdev_state_alloc()

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Mon Jun 20 02:44:02 PDT 2022


Hi,

On 19/06/2022 02:16, Laurent Pinchart wrote:
> Hi Marek,
> 
> CC'ing Tomi to get his opinion.
> 
> On Sun, Jun 19, 2022 at 12:24:42AM +0200, Marek Vasut wrote:
>> Any local subdev state should be allocated and free'd using
>> __v4l2_subdev_state_alloc()/__v4l2_subdev_state_free(), which
>> takes care of calling .init_cfg() subdev op. Without this,
>> subdev internal state might be uninitialized by the time
>> any other subdev op is called.

Does this fix a bug you have? Wasn't this broken even before the active 
state, as init_cfg was not called?

In any case, I think we have to do something like this, as the source 
subdev might depend on a valid subdev state.

It's not very nice to have the drivers using __v4l2_subdev_state_alloc, 
though. But if non-MC drivers are not going away, and if they are going 
to be calling ops in other subdevs with V4L2_SUBDEV_FORMAT_TRY, they 
need to pass a valid subdev state...

I don't see a better way right away, so I think this is fine.

Do we need a v4l2_subdev_call_state_try(), similar to 
v4l2_subdev_call_state_active()? It would handle allocating the state, 
calling the op and freeing the state.

  Tomi



More information about the linux-arm-kernel mailing list