Linux-Media Archive on lore.kernel.org
 help / color / Atom feed
From: Luca Ceresoli <luca@lucaceresoli.net>
To: linux-media@vger.kernel.org
Cc: Luca Ceresoli <luca@lucaceresoli.net>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: [PATCH 5/9] media: docs: v4l2-controls: rearrange control initialization sequence
Date: Thu, 13 Jun 2019 16:18:22 +0200
Message-ID: <20190613141826.26775-5-luca@lucaceresoli.net> (raw)
In-Reply-To: <20190613141826.26775-1-luca@lucaceresoli.net>

The code snippet showing how to add controls to the driver’s top-level
struct is present twice, but only the second time it is split in the V4L2
and subdev cases. Consolidate everything at the beginning.

Also remove the "Where foo->bar is of type struct baz" sentences, this
obvious from the code.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
---
 Documentation/media/kapi/v4l2-controls.rst | 40 +++++++++-------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/Documentation/media/kapi/v4l2-controls.rst b/Documentation/media/kapi/v4l2-controls.rst
index 0c3f486727ed..5281c9b1fd66 100644
--- a/Documentation/media/kapi/v4l2-controls.rst
+++ b/Documentation/media/kapi/v4l2-controls.rst
@@ -52,15 +52,29 @@ Basic usage for V4L2 and sub-device drivers
 
 1.1) Add the handler to your driver's top-level struct:
 
+For V4L2 drivers:
+
 .. code-block:: none
 
 	struct foo_dev {
+		...
+		struct v4l2_device v4l2_dev;
 		...
 		struct v4l2_ctrl_handler ctrl_handler;
 		...
 	};
 
-	struct foo_dev *foo;
+For sub-device drivers:
+
+.. code-block:: none
+
+	struct foo_dev {
+		...
+		struct v4l2_subdev sd;
+		...
+		struct v4l2_ctrl_handler ctrl_handler;
+		...
+	};
 
 1.2) Initialize the handler:
 
@@ -74,43 +88,23 @@ information. It is a hint only.
 
 1.3) Hook the control handler into the driver:
 
-1.3.1) For V4L2 drivers do this:
+For V4L2 drivers:
 
 .. code-block:: none
 
-	struct foo_dev {
-		...
-		struct v4l2_device v4l2_dev;
-		...
-		struct v4l2_ctrl_handler ctrl_handler;
-		...
-	};
-
 	foo->v4l2_dev.ctrl_handler = &foo->ctrl_handler;
 
-Where foo->v4l2_dev is of type struct v4l2_device.
-
 Finally, remove all control functions from your v4l2_ioctl_ops (if any):
 vidioc_queryctrl, vidioc_query_ext_ctrl, vidioc_querymenu, vidioc_g_ctrl,
 vidioc_s_ctrl, vidioc_g_ext_ctrls, vidioc_try_ext_ctrls and vidioc_s_ext_ctrls.
 Those are now no longer needed.
 
-1.3.2) For sub-device drivers do this:
+For sub-device drivers:
 
 .. code-block:: none
 
-	struct foo_dev {
-		...
-		struct v4l2_subdev sd;
-		...
-		struct v4l2_ctrl_handler ctrl_handler;
-		...
-	};
-
 	foo->sd.ctrl_handler = &foo->ctrl_handler;
 
-Where foo->sd is of type struct v4l2_subdev.
-
 1.4) Clean up the handler at the end:
 
 .. code-block:: none
-- 
2.21.0


  parent reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 14:18 [PATCH 1/9] media: docs: v4l2-controls: fix sentence rendered in a nonsense way Luca Ceresoli
2019-06-13 14:18 ` [PATCH 2/9] media: docs: v4l2-controls: remove repeated ioctl names Luca Ceresoli
2019-06-13 14:18 ` [PATCH 3/9] media: docs: v4l2-controls: fix indentation Luca Ceresoli
2019-06-13 14:18 ` [PATCH 4/9] media: docs: v4l2-controls: add links to structs Luca Ceresoli
2019-06-13 14:18 ` Luca Ceresoli [this message]
2019-06-13 14:18 ` [PATCH 6/9] media: docs: v4l2-controls: add links to functions Luca Ceresoli
2019-06-13 14:18 ` [PATCH 7/9] media: docs: v4l2-controls: convert code blocks to C Luca Ceresoli
2019-06-13 14:18 ` [PATCH 8/9] media: docs: v4l2-controls: document file to include Luca Ceresoli
2019-06-13 14:18 ` [PATCH 9/9] media: docs: v4l2-controls: remove outdated paragraph Luca Ceresoli
2019-06-14  7:14 ` [PATCH 1/9] media: docs: v4l2-controls: fix sentence rendered in a nonsense way Hans Verkuil
2019-06-14 15:16   ` Luca Ceresoli

Reply instructions:

You may reply publically 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=20190613141826.26775-5-luca@lucaceresoli.net \
    --to=luca@lucaceresoli.net \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /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

Linux-Media Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-media/0 linux-media/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-media linux-media/ https://lore.kernel.org/linux-media \
		linux-media@vger.kernel.org linux-media@archiver.kernel.org
	public-inbox-index linux-media


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-media


AGPL code for this site: git clone https://public-inbox.org/ public-inbox