On Thu, Oct 20, 2022 at 09:55:25PM +0200, Hans de Goede wrote: > Several places rely on the [frame_]info member being the first member of > struct ia_css_frame, so that &frame->info will yield NULL when frame is > NULL (some places already explicitly check for a NULL frame pointer but > not nearly all). > > For videobuf2 support the vb2_v4l2_buffer struct needs to be embedded > in the frame struct and it needs to be the first member. Breaking the > assumption that &frame->info will yield NULL when frame is NULL. > > Add a ia_css_frame_get_info() helper to return either the ia_css_frame_info > struct embedded in the frame, or NULL when the frame pointer is NULL and > use this in places where a ia_css_frame_info ptr or NULL is expected. > > To make sure that we catch all uses of the info field this patch also > renames the info field to frame_info. > > This is a preparation patch for converting the driver to videobuf2. ... > + const struct ia_css_frame_info *in_frame_info = ia_css_frame_get_info(in_frame); > const unsigned int ddr_bits_per_element = sizeof(short) * 8; Side note: BITS_PER_TYPE(). ... > + const struct ia_css_frame_info *in_frame_info = ia_css_frame_get_info(in_frame); > const unsigned int ddr_bits_per_element = sizeof(short) * 8; Ditto. > const unsigned int ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS, > ddr_bits_per_element); -- With Best Regards, Andy Shevchenko