On Sun, Dec 31, 2023 at 12:31 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > > There are 3 code-paths all of 3 which need to do: > > 1. Get try or active state > 2. lock state > 3. Call atomisp_set_crop() > 4. Call v4l2_subdev_call(input->camera, pad, set_fmt, state, fmt) > 5. unlock state > > Change atomisp_set_crop into atomisp_set_crop_and_fmt() which does all of > this and change the 3 code-paths which need this to use the new > atomisp_set_crop_and_fmt() function. ... > + if (sd_state) > + v4l2_subdev_lock_state(sd_state); > + if (sd_state) > + v4l2_subdev_unlock_state(sd_state); If there is any reason why we need to have no conditional in the callee, I would prefer to see a helper with a conditional and/or using specific macro from cleanup.h, so you won't need to repeat all this every time. -- With Best Regards, Andy Shevchenko