Re: [PATCH v3 17/29] media: bcm2835-unicam: Use v4l2_subdev_get_frame_desc()
Frank Li <[email protected]>
| Newsgroups | org.kernel.vger.linux-media |
|---|---|
| Message-ID | <aoyyogifML-mDfYJ@lizhi-Precision-Tower-5810> |
On Mon, Aug 24, 2026 at 03:14:39PM +0300, Sakari Ailus wrote: > Call v4l2_subdev_get_frame_desc() to obtain the frame descriptor. This is > preferred over calling the get_frame_desc() pad operation directly. > > Signed-off-by: Sakari Ailus <[email protected]> > --- > .../media/platform/broadcom/bcm2835-unicam.c | 22 +++++++++---------- > 1 file changed, 10 insertions(+), 12 deletions(-) > > diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c > index 14bb916dd7b1..2322d3df3915 100644 > --- a/drivers/media/platform/broadcom/bcm2835-unicam.c > +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c > @@ -27,6 +27,7 @@ > * output interface and V4L2 subdevice driver. > */ > > +#include <linux/cleanup.h> > #include <linux/clk.h> > #include <linux/delay.h> > #include <linux/device.h> > @@ -888,7 +889,6 @@ static int unicam_get_image_vc_dt(struct unicam_device *unicam, > struct v4l2_subdev_state *state, > u8 *vc, u8 *dt) > { > - struct v4l2_mbus_frame_desc fd; > u32 stream; > int ret; > > @@ -898,17 +898,15 @@ static int unicam_get_image_vc_dt(struct unicam_device *unicam, > if (ret) > return ret; > > - ret = v4l2_subdev_call(unicam->sensor.subdev, pad, get_frame_desc, > - unicam->sensor.pad->index, &fd); > - if (ret) > - return ret; > - > - /* Only CSI-2 supports DTs. */ > - if (fd.type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) > - return -EINVAL; > + struct v4l2_mbus_frame_desc *fd __free(v4l2_subdev_free_frame_desc) = > + v4l2_subdev_get_frame_desc(unicam->sensor.subdev, > + unicam->sensor.pad->index, > + V4L2_MBUS_FRAME_DESC_TYPE_CSI2); > + if (IS_ERR(fd)) > + return PTR_ERR(fd); > > - for (unsigned int i = 0; i < fd.num_entries; ++i) { > - const struct v4l2_mbus_frame_desc_entry *fde = &fd.entry[i]; > + for (unsigned int i = 0; i < fd->num_entries; ++i) { > + const struct v4l2_mbus_frame_desc_entry *fde = &fd->entry[i]; > > if (fde->stream == stream) { > *vc = fde->bus.csi2.vc; > @@ -927,7 +925,7 @@ static void unicam_start_rx(struct unicam_device *unicam, > const struct unicam_format_info *fmtinfo; > const struct v4l2_mbus_framefmt *fmt; > unsigned int line_int_freq; > - u8 vc, dt; > + u8 vc = 0, dt = 0; not sure why need here, if unicam_get_image_vc_dt() return failure, vc will be set to 0 if unicam_get_image_vc_dt() return success, vc will be expected value. Frank > u32 val; > int ret; > > -- > 2.47.3 >