All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Tsuchiya Yuto <kitakar@gmail.com>,
	Andy Shevchenko <andy@kernel.org>,
	Yury Luneff <yury.lunev@gmail.com>,
	Nable <nable.maininbox@googlemail.com>,
	andrey.i.trufanov@gmail.com, Fabio Aiuto <fabioaiuto83@gmail.com>,
	linux-media@vger.kernel.org, linux-staging@lists.linux.dev
Subject: [PATCH 09/14] media: atomisp: Split subdev and video-node registration into 2 steps
Date: Thu,  1 Sep 2022 11:46:21 +0200	[thread overview]
Message-ID: <20220901094626.11513-10-hdegoede@redhat.com> (raw)
In-Reply-To: <20220901094626.11513-1-hdegoede@redhat.com>

Split subdev and video-node registration into 2 steps, this is
a preparation step for moving video-node registration to the
end of probe() so that the loading() mutex can be removed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 .../staging/media/atomisp/pci/atomisp_subdev.c   | 16 ++++++++--------
 .../staging/media/atomisp/pci/atomisp_subdev.h   |  6 ++++--
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c |  4 +++-
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
index 5e66d6a69556..047e2e9d63d7 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
@@ -1281,8 +1281,14 @@ void atomisp_subdev_unregister_entities(struct atomisp_sub_device *asd)
 	atomisp_video_unregister(&asd->video_out_video_capture);
 }
 
-int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,
-				     struct v4l2_device *vdev)
+int atomisp_subdev_register_subdev(struct atomisp_sub_device *asd,
+				   struct v4l2_device *vdev)
+{
+	return v4l2_device_register_subdev(vdev, &asd->subdev);
+}
+
+int atomisp_subdev_register_video_nodes(struct atomisp_sub_device *asd,
+					struct v4l2_device *vdev)
 {
 	int ret;
 
@@ -1291,12 +1297,6 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,
 	 * Should any of those use V4L2_CAP_META_CAPTURE? Probably yes.
 	 */
 
-	/* Register the subdev and video node. */
-
-	ret = v4l2_device_register_subdev(vdev, &asd->subdev);
-	if (ret < 0)
-		goto error;
-
 	asd->video_out_preview.vdev.v4l2_dev = vdev;
 	asd->video_out_preview.vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
 	ret = video_register_device(&asd->video_out_preview.vdev,
diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp_subdev.h
index d1a9857e5d68..d8b2dd00a792 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h
@@ -417,8 +417,10 @@ int atomisp_update_run_mode(struct atomisp_sub_device *asd);
 void atomisp_subdev_cleanup_pending_events(struct atomisp_sub_device *asd);
 
 void atomisp_subdev_unregister_entities(struct atomisp_sub_device *asd);
-int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,
-				     struct v4l2_device *vdev);
+int atomisp_subdev_register_subdev(struct atomisp_sub_device *asd,
+				   struct v4l2_device *vdev);
+int atomisp_subdev_register_video_nodes(struct atomisp_sub_device *asd,
+					struct v4l2_device *vdev);
 int atomisp_subdev_init(struct atomisp_device *isp);
 void atomisp_subdev_cleanup(struct atomisp_device *isp);
 int atomisp_create_pads_links(struct atomisp_device *isp);
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index bb48c74c0c07..9a1eae1ba8c0 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -1193,7 +1193,9 @@ static int atomisp_register_entities(struct atomisp_device *isp)
 	for (i = 0; i < isp->num_of_streams; i++) {
 		struct atomisp_sub_device *asd = &isp->asd[i];
 
-		ret = atomisp_subdev_register_entities(asd, &isp->v4l2_dev);
+		ret = atomisp_subdev_register_subdev(asd, &isp->v4l2_dev);
+		if (ret == 0)
+			ret = atomisp_subdev_register_video_nodes(asd, &isp->v4l2_dev);
 		if (ret < 0) {
 			dev_err(isp->dev,
 				"atomisp_subdev_register_entities fail\n");
-- 
2.37.2


  parent reply	other threads:[~2022-09-01  9:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01  9:46 [PATCH 00/14] media: atomisp: More cleanups / code removal Hans de Goede
2022-09-01  9:46 ` [PATCH 01/14] media: atomisp: Fix device_caps reporting of the registered video-devs Hans de Goede
2022-09-01  9:46 ` [PATCH 02/14] media: atomisp: Remove file-injection support Hans de Goede
2022-09-01  9:46 ` [PATCH 03/14] media: atomisp: Remove atomisp_file_fops and atomisp_file_ioctl_ops Hans de Goede
2022-09-01  9:46 ` [PATCH 04/14] media: atomisp: Remove the outq videobuf queue Hans de Goede
2022-09-01  9:46 ` [PATCH 05/14] media: atomisp: Remove never set file_input flag Hans de Goede
2022-09-01  9:46 ` [PATCH 06/14] media: atomisp: Remove the ACC device node Hans de Goede
2022-09-01  9:46 ` [PATCH 07/14] media: atomisp: Remove some further ATOMISP_ACC_* related dead code Hans de Goede
2022-09-01  9:46 ` [PATCH 08/14] media: atomisp: Remove empty atomisp_css_set_cont_prev_start_time() function Hans de Goede
2022-09-01  9:46 ` Hans de Goede [this message]
2022-09-01  9:46 ` [PATCH 10/14] media: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe() Hans de Goede
2022-09-01 19:56   ` Andy Shevchenko
2022-09-02  9:04     ` Hans de Goede
2022-09-02  9:10       ` Andy Shevchenko
2022-09-02  9:16         ` Andy Shevchenko
2022-09-01  9:46 ` [PATCH 11/14] media: atomisp: Remove loading mutex Hans de Goede
2022-09-01  9:46 ` [PATCH 12/14] media: atomisp: Fix v4l2_fh resource leak on open errors Hans de Goede
2022-09-01  9:46 ` [PATCH 13/14] media: atomisp: Simplify v4l2_fh_open() error handling Hans de Goede
2022-09-01  9:46 ` [PATCH 14/14] media: atomisp: prevent integer overflow in sh_css_set_black_frame() Hans de Goede
2022-09-01 15:08 ` [PATCH 00/14] media: atomisp: More cleanups / code removal Mauro Carvalho Chehab
2022-09-01 15:30   ` Hans de Goede
2022-09-01 19:59 ` Andy Shevchenko

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=20220901094626.11513-10-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andrey.i.trufanov@gmail.com \
    --cc=andy@kernel.org \
    --cc=fabioaiuto83@gmail.com \
    --cc=kitakar@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nable.maininbox@googlemail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yury.lunev@gmail.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.