2018-04-09 17:32 GMT+09:00 jacopo mondi <jacopo@xxxxxxxxxx>: > Hi Akinobu, > > On Sun, Apr 08, 2018 at 12:48:08AM +0900, Akinobu Mita wrote: >> Create a source pad and set the media controller type to the sensor. >> >> Cc: Jacopo Mondi <jacopo+renesas@xxxxxxxxxx> >> Cc: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> >> Cc: Hans Verkuil <hans.verkuil@xxxxxxxxx> >> Cc: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> >> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxxx> >> Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx> >> --- >> drivers/media/i2c/ov772x.c | 22 ++++++++++++++++++++-- >> 1 file changed, 20 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c >> index 4bb81ff..5e91fa1 100644 >> --- a/drivers/media/i2c/ov772x.c >> +++ b/drivers/media/i2c/ov772x.c >> @@ -425,6 +425,9 @@ struct ov772x_priv { >> unsigned short band_filter; >> unsigned int fps; >> int (*reg_read)(struct i2c_client *client, u8 addr); >> +#ifdef CONFIG_MEDIA_CONTROLLER >> + struct media_pad pad; >> +#endif >> }; >> >> /* >> @@ -1328,9 +1331,17 @@ static int ov772x_probe(struct i2c_client *client, >> goto error_clk_put; >> } >> >> - ret = ov772x_video_probe(priv); >> +#ifdef CONFIG_MEDIA_CONTROLLER >> + priv->pad.flags = MEDIA_PAD_FL_SOURCE; >> + priv->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; >> + ret = media_entity_pads_init(&priv->subdev.entity, 1, &priv->pad); >> if (ret < 0) >> goto error_gpio_put; >> +#endif >> + >> + ret = ov772x_video_probe(priv); >> + if (ret < 0) >> + goto error_entity_cleanup; > > If you remove the #ifdef around the media_entity_cleanup() below, I > suggest moving video_probe() before the entity intialization so you > don't have to #ifdef around the error_gpio_put: label, which otherwise > the compiler complains for being defined but not used. I see. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html