All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Hans Verkuil <hverkuil@xs4all.nl>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [PATCH 4/6] media: rcar-vin: Register the media device together with the group
Date: Mon, 29 Jan 2024 21:22:52 +0100	[thread overview]
Message-ID: <20240129202254.1126012-5-niklas.soderlund+renesas@ragnatech.se> (raw)
In-Reply-To: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se>

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(-)

diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
index d8b9c3b991b1..ffc79c26a303 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
@@ -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,
-- 
2.43.0


  parent reply	other threads:[~2024-01-29 20:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 20:22 [PATCH 0/6] media: rcar-vin: Make use of multiple connections in v4l-async Niklas Söderlund
2024-01-29 20:22 ` [PATCH 1/6] media: rcar-vin: Move media graph pointers to device info Niklas Söderlund
2024-01-29 20:22 ` [PATCH 2/6] media: rcar-vin: Simplify remote source type detection Niklas Söderlund
2024-01-29 20:22 ` [PATCH 3/6] media: rcar-vin: Fold simple functions into only caller Niklas Söderlund
2024-01-29 20:22 ` Niklas Söderlund [this message]
2024-01-29 20:22 ` [PATCH 5/6] media: rcar-vin: Remove the shared group notifier Niklas Söderlund
2024-01-29 20:22 ` [PATCH 6/6] media: rcar-vin Rename notifier helper functions Niklas Söderlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240129202254.1126012-5-niklas.soderlund+renesas@ragnatech.se \
    --to=niklas.soderlund+renesas@ragnatech.se \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.