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 3/6] media: rcar-vin: Fold simple functions into only caller
Date: Mon, 29 Jan 2024 21:22:51 +0100	[thread overview]
Message-ID: <20240129202254.1126012-4-niklas.soderlund+renesas@ragnatech.se> (raw)
In-Reply-To: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se>

The two functions rvin_parallel_subdevice_detach() and
rvin_group_cleanup() have been reworked over time and have become
simpler and now only have one call site each.

To make refactoring of the notifier code simpler fold them into their
only call sites.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 .../platform/renesas/rcar-vin/rcar-core.c     | 24 ++++++-------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
index 8555fa446811..d8b9c3b991b1 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
@@ -58,12 +58,6 @@
 static DEFINE_MUTEX(rvin_group_lock);
 static struct rvin_group *rvin_group_data;
 
-static void rvin_group_cleanup(struct rvin_group *group)
-{
-	media_device_cleanup(&group->mdev);
-	mutex_destroy(&group->lock);
-}
-
 static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin)
 {
 	struct media_device *mdev = &group->mdev;
@@ -103,7 +97,8 @@ static void rvin_group_release(struct kref *kref)
 
 	rvin_group_data = NULL;
 
-	rvin_group_cleanup(group);
+	media_device_cleanup(&group->mdev);
+	mutex_destroy(&group->lock);
 
 	kfree(group);
 
@@ -558,15 +553,6 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin,
 	return 0;
 }
 
-static void rvin_parallel_subdevice_detach(struct rvin_dev *vin)
-{
-	rvin_v4l2_unregister(vin);
-	vin->parallel.subdev = NULL;
-
-	if (!vin->info->use_mc)
-		rvin_free_controls(vin);
-}
-
 static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier)
 {
 	struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev);
@@ -611,7 +597,11 @@ static void rvin_parallel_notify_unbind(struct v4l2_async_notifier *notifier,
 	vin_dbg(vin, "unbind parallel subdev %s\n", subdev->name);
 
 	mutex_lock(&vin->lock);
-	rvin_parallel_subdevice_detach(vin);
+	rvin_v4l2_unregister(vin);
+	vin->parallel.subdev = NULL;
+
+	if (!vin->info->use_mc)
+		rvin_free_controls(vin);
 	mutex_unlock(&vin->lock);
 }
 
-- 
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 ` Niklas Söderlund [this message]
2024-01-29 20:22 ` [PATCH 4/6] media: rcar-vin: Register the media device together with the group Niklas Söderlund
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-4-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.