[4/6] media: rcar-vin: Register the media device together with the group
Commit Message
Prepare for replacing the shared group notifier with an individual
notifier per VIN by moving the media device registration and
un-registration to the group. This is needed as the media device will
still be shared between all VIN:s.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
drivers/media/platform/renesas/rcar-vin/rcar-core.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
@@ -85,7 +85,7 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin)
media_device_init(mdev);
- return 0;
+ return media_device_register(mdev);
}
static void rvin_group_release(struct kref *kref)
@@ -97,6 +97,7 @@ static void rvin_group_release(struct kref *kref)
rvin_group_data = NULL;
+ media_device_unregister(&group->mdev);
media_device_cleanup(&group->mdev);
mutex_destroy(&group->lock);
@@ -215,10 +216,6 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
unsigned int i;
int ret;
- ret = media_device_register(&vin->group->mdev);
- if (ret)
- return ret;
-
ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev);
if (ret) {
vin_err(vin, "Failed to register subdev nodes\n");
@@ -260,8 +257,6 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier,
}
mutex_unlock(&vin->group->lock);
-
- media_device_unregister(&vin->group->mdev);
}
static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,