2018-04-09 17:32 GMT+09:00 jacopo mondi <jac...@jmondi.org>:
> 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+rene...@jmondi.org>
>> Cc: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
>> Cc: Hans Verkuil <hans.verk...@cisco.com>
>> Cc: Sakari Ailus <sakari.ai...@linux.intel.com>
>> Cc: Mauro Carvalho Chehab <mche...@s-opensource.com>
>> Signed-off-by: Akinobu Mita <akinobu.m...@gmail.com>
>> ---
>>  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.

Reply via email to