Message ID | 487a406afc2d79b2027f1d9667dfad4a716ed630.1420315245.git.mchehab@osg.samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, 2015-01-03 at 18:09 -0200, Mauro Carvalho Chehab wrote: > Instead of keeping the media controller entity not initialized, > fill it and create the pads for cx25840. Won't you get an unused variable for ret without CONFIG_MEDIA_CONTROLLER? > diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c [] > @@ -5134,7 +5134,7 @@ static int cx25840_probe(struct i2c_client *client, > { > struct cx25840_state *state; > struct v4l2_subdev *sd; > - int default_volume; > + int default_volume, ret; > u32 id; > u16 device_id; > > @@ -5178,6 +5178,18 @@ static int cx25840_probe(struct i2c_client *client, > > sd = &state->sd; > v4l2_i2c_subdev_init(sd, client, &cx25840_ops); > +#if defined(CONFIG_MEDIA_CONTROLLER) > + /* TODO: need to represent analog inputs too */ > + state->pads[0].flags = MEDIA_PAD_FL_SINK; /* Tuner or input */ > + state->pads[1].flags = MEDIA_PAD_FL_SOURCE; /* Video */ > + state->pads[2].flags = MEDIA_PAD_FL_SOURCE; /* VBI */ > + sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_DECODER; > + > + ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads), > + state->pads, 0); > + if (ret < 0) > + v4l_info(client, "failed to initialize media entity!\n"); > +#endif > > switch (id) { > case CX23885_AV: Maybe write this without ret at all. if (media_entry_init(...) < 0) v4l_info(...) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c index 573e08826b9b..831c74b97798 100644 --- a/drivers/media/i2c/cx25840/cx25840-core.c +++ b/drivers/media/i2c/cx25840/cx25840-core.c @@ -5134,7 +5134,7 @@ static int cx25840_probe(struct i2c_client *client, { struct cx25840_state *state; struct v4l2_subdev *sd; - int default_volume; + int default_volume, ret; u32 id; u16 device_id; @@ -5178,6 +5178,18 @@ static int cx25840_probe(struct i2c_client *client, sd = &state->sd; v4l2_i2c_subdev_init(sd, client, &cx25840_ops); +#if defined(CONFIG_MEDIA_CONTROLLER) + /* TODO: need to represent analog inputs too */ + state->pads[0].flags = MEDIA_PAD_FL_SINK; /* Tuner or input */ + state->pads[1].flags = MEDIA_PAD_FL_SOURCE; /* Video */ + state->pads[2].flags = MEDIA_PAD_FL_SOURCE; /* VBI */ + sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_DECODER; + + ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads), + state->pads, 0); + if (ret < 0) + v4l_info(client, "failed to initialize media entity!\n"); +#endif switch (id) { case CX23885_AV: diff --git a/drivers/media/i2c/cx25840/cx25840-core.h b/drivers/media/i2c/cx25840/cx25840-core.h index 37bc04217c44..17b409f55445 100644 --- a/drivers/media/i2c/cx25840/cx25840-core.h +++ b/drivers/media/i2c/cx25840/cx25840-core.h @@ -64,6 +64,9 @@ struct cx25840_state { wait_queue_head_t fw_wait; /* wake up when the fw load is finished */ struct work_struct fw_work; /* work entry for fw load */ struct cx25840_ir_state *ir_state; +#if defined(CONFIG_MEDIA_CONTROLLER) + struct media_pad pads[3]; +#endif }; static inline struct cx25840_state *to_state(struct v4l2_subdev *sd)
Instead of keeping the media controller entity not initialized, fill it and create the pads for cx25840. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>