Commit 3580112b authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: entity: Add a nop variant of media_entity_cleanup

Add nop variant of media_entity_cleanup. This allows calling
media_entity_cleanup whether or not Media controller is enabled,
simplifying driver code.

Also drop #ifdefs on a few drivers around media_entity_cleanup().
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 6146fde3
...@@ -1046,9 +1046,7 @@ static int mt9m111_remove(struct i2c_client *client) ...@@ -1046,9 +1046,7 @@ static int mt9m111_remove(struct i2c_client *client)
struct mt9m111 *mt9m111 = to_mt9m111(client); struct mt9m111 *mt9m111 = to_mt9m111(client);
v4l2_async_unregister_subdev(&mt9m111->subdev); v4l2_async_unregister_subdev(&mt9m111->subdev);
#ifdef CONFIG_MEDIA_CONTROLLER
media_entity_cleanup(&mt9m111->subdev.entity); media_entity_cleanup(&mt9m111->subdev.entity);
#endif
v4l2_clk_put(mt9m111->clk); v4l2_clk_put(mt9m111->clk);
v4l2_ctrl_handler_free(&mt9m111->hdl); v4l2_ctrl_handler_free(&mt9m111->hdl);
......
...@@ -1147,9 +1147,7 @@ static int ov2640_probe(struct i2c_client *client, ...@@ -1147,9 +1147,7 @@ static int ov2640_probe(struct i2c_client *client,
return 0; return 0;
err_videoprobe: err_videoprobe:
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&priv->subdev.entity); media_entity_cleanup(&priv->subdev.entity);
#endif
err_hdl: err_hdl:
v4l2_ctrl_handler_free(&priv->hdl); v4l2_ctrl_handler_free(&priv->hdl);
err_clk: err_clk:
...@@ -1163,9 +1161,7 @@ static int ov2640_remove(struct i2c_client *client) ...@@ -1163,9 +1161,7 @@ static int ov2640_remove(struct i2c_client *client)
v4l2_async_unregister_subdev(&priv->subdev); v4l2_async_unregister_subdev(&priv->subdev);
v4l2_ctrl_handler_free(&priv->hdl); v4l2_ctrl_handler_free(&priv->hdl);
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&priv->subdev.entity); media_entity_cleanup(&priv->subdev.entity);
#endif
v4l2_device_unregister_subdev(&priv->subdev); v4l2_device_unregister_subdev(&priv->subdev);
clk_disable_unprepare(priv->clk); clk_disable_unprepare(priv->clk);
return 0; return 0;
......
...@@ -1474,9 +1474,7 @@ static int ov2659_probe(struct i2c_client *client, ...@@ -1474,9 +1474,7 @@ static int ov2659_probe(struct i2c_client *client,
error: error:
v4l2_ctrl_handler_free(&ov2659->ctrls); v4l2_ctrl_handler_free(&ov2659->ctrls);
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&sd->entity); media_entity_cleanup(&sd->entity);
#endif
mutex_destroy(&ov2659->lock); mutex_destroy(&ov2659->lock);
return ret; return ret;
} }
...@@ -1488,9 +1486,7 @@ static int ov2659_remove(struct i2c_client *client) ...@@ -1488,9 +1486,7 @@ static int ov2659_remove(struct i2c_client *client)
v4l2_ctrl_handler_free(&ov2659->ctrls); v4l2_ctrl_handler_free(&ov2659->ctrls);
v4l2_async_unregister_subdev(sd); v4l2_async_unregister_subdev(sd);
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&sd->entity); media_entity_cleanup(&sd->entity);
#endif
mutex_destroy(&ov2659->lock); mutex_destroy(&ov2659->lock);
return 0; return 0;
......
...@@ -1846,9 +1846,7 @@ static int ov7670_probe(struct i2c_client *client, ...@@ -1846,9 +1846,7 @@ static int ov7670_probe(struct i2c_client *client,
return 0; return 0;
entity_cleanup: entity_cleanup:
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&info->sd.entity); media_entity_cleanup(&info->sd.entity);
#endif
hdl_free: hdl_free:
v4l2_ctrl_handler_free(&info->hdl); v4l2_ctrl_handler_free(&info->hdl);
power_off: power_off:
...@@ -1867,9 +1865,7 @@ static int ov7670_remove(struct i2c_client *client) ...@@ -1867,9 +1865,7 @@ static int ov7670_remove(struct i2c_client *client)
v4l2_async_unregister_subdev(sd); v4l2_async_unregister_subdev(sd);
v4l2_ctrl_handler_free(&info->hdl); v4l2_ctrl_handler_free(&info->hdl);
clk_disable_unprepare(info->clk); clk_disable_unprepare(info->clk);
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&info->sd.entity); media_entity_cleanup(&info->sd.entity);
#endif
ov7670_s_power(sd, 0); ov7670_s_power(sd, 0);
return 0; return 0;
} }
......
...@@ -1148,9 +1148,7 @@ static int ov7740_remove(struct i2c_client *client) ...@@ -1148,9 +1148,7 @@ static int ov7740_remove(struct i2c_client *client)
mutex_destroy(&ov7740->mutex); mutex_destroy(&ov7740->mutex);
v4l2_ctrl_handler_free(ov7740->subdev.ctrl_handler); v4l2_ctrl_handler_free(ov7740->subdev.ctrl_handler);
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&ov7740->subdev.entity); media_entity_cleanup(&ov7740->subdev.entity);
#endif
v4l2_async_unregister_subdev(sd); v4l2_async_unregister_subdev(sd);
ov7740_free_controls(ov7740); ov7740_free_controls(ov7740);
......
...@@ -1131,9 +1131,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1131,9 +1131,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
done: done:
if (ret < 0) { if (ret < 0) {
v4l2_ctrl_handler_free(&decoder->hdl); v4l2_ctrl_handler_free(&decoder->hdl);
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&decoder->sd.entity); media_entity_cleanup(&decoder->sd.entity);
#endif
} }
return ret; return ret;
} }
...@@ -1151,9 +1149,7 @@ static int tvp514x_remove(struct i2c_client *client) ...@@ -1151,9 +1149,7 @@ static int tvp514x_remove(struct i2c_client *client)
struct tvp514x_decoder *decoder = to_decoder(sd); struct tvp514x_decoder *decoder = to_decoder(sd);
v4l2_async_unregister_subdev(&decoder->sd); v4l2_async_unregister_subdev(&decoder->sd);
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&decoder->sd.entity); media_entity_cleanup(&decoder->sd.entity);
#endif
v4l2_ctrl_handler_free(&decoder->hdl); v4l2_ctrl_handler_free(&decoder->hdl);
return 0; return 0;
} }
......
...@@ -634,7 +634,11 @@ int media_entity_pads_init(struct media_entity *entity, u16 num_pads, ...@@ -634,7 +634,11 @@ int media_entity_pads_init(struct media_entity *entity, u16 num_pads,
* This function must be called during the cleanup phase after unregistering * This function must be called during the cleanup phase after unregistering
* the entity (currently, it does nothing). * the entity (currently, it does nothing).
*/ */
static inline void media_entity_cleanup(struct media_entity *entity) {}; #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER)
static inline void media_entity_cleanup(struct media_entity *entity) {}
#else
#define media_entity_cleanup(entity) do { } while (false)
#endif
/** /**
* media_create_pad_link() - creates a link between two entities. * media_create_pad_link() - creates a link between two entities.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment