All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups
@ 2013-07-22 18:04 Sylwester Nawrocki
  2013-07-22 18:04 ` [PATCH RFC 1/5] V4L2: Drop bus_type check in v4l2-async match functions Sylwester Nawrocki
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-22 18:04 UTC (permalink / raw)
  To: linux-media
  Cc: g.liakhovetski, prabhakar.csengg, laurent.pinchart, hverkuil,
	kyungmin.park, Sylwester Nawrocki

Hello,

This is a few patches for the v4l2-async API I wrote while adding
the asynchronous subdev registration support to the exynos4-is
driver.

The most significant change is addition of V4L2_ASYNC_MATCH_OF
subdev matching method, where host driver can pass a list of
of_node pointers identifying its subdevs.

I thought it's a reasonable and simple enough way to support device
tree based systems. Comments/other ideas are of course welcome.

Thanks,
Sylwester

Sylwester Nawrocki (5):
  V4L2: Drop bus_type check in v4l2-async match functions
  V4L2: Rename v4l2_async_bus_* to v4l2_async_match_*
  V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type
  V4L2: Rename subdev field of struct v4l2_async_notifier
  V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev

 drivers/media/platform/soc_camera/soc_camera.c |    4 +-
 drivers/media/v4l2-core/v4l2-async.c           |  106 ++++++++++++------------
 include/media/v4l2-async.h                     |   36 ++++----
 include/media/v4l2-subdev.h                    |   13 ++-
 4 files changed, 74 insertions(+), 85 deletions(-)

--
1.7.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH RFC 1/5] V4L2: Drop bus_type check in v4l2-async match functions
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
@ 2013-07-22 18:04 ` Sylwester Nawrocki
  2013-07-22 18:04 ` [PATCH RFC 2/5] V4L2: Rename v4l2_async_bus_* to v4l2_async_match_* Sylwester Nawrocki
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-22 18:04 UTC (permalink / raw)
  To: linux-media
  Cc: g.liakhovetski, prabhakar.csengg, laurent.pinchart, hverkuil,
	kyungmin.park, Sylwester Nawrocki

These match_* functions are internal callbacks and are always
invoked only after checking asd->bus_type. So drop redundant
checks in match_i2c() and match_platform() functions.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/media/v4l2-core/v4l2-async.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index aae2417..ff87c29 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -27,7 +27,6 @@ static bool match_i2c(struct device *dev, struct v4l2_async_subdev *asd)
 #if IS_ENABLED(CONFIG_I2C)
 	struct i2c_client *client = i2c_verify_client(dev);
 	return client &&
-		asd->bus_type == V4L2_ASYNC_BUS_I2C &&
 		asd->match.i2c.adapter_id == client->adapter->nr &&
 		asd->match.i2c.address == client->addr;
 #else
@@ -37,8 +36,7 @@ static bool match_i2c(struct device *dev, struct v4l2_async_subdev *asd)
 
 static bool match_platform(struct device *dev, struct v4l2_async_subdev *asd)
 {
-	return asd->bus_type == V4L2_ASYNC_BUS_PLATFORM &&
-		!strcmp(asd->match.platform.name, dev_name(dev));
+	return !strcmp(asd->match.platform.name, dev_name(dev));
 }
 
 static LIST_HEAD(subdev_list);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RFC 2/5] V4L2: Rename v4l2_async_bus_* to v4l2_async_match_*
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
  2013-07-22 18:04 ` [PATCH RFC 1/5] V4L2: Drop bus_type check in v4l2-async match functions Sylwester Nawrocki
@ 2013-07-22 18:04 ` Sylwester Nawrocki
  2013-07-22 18:04 ` [PATCH RFC 3/5] V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type Sylwester Nawrocki
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-22 18:04 UTC (permalink / raw)
  To: linux-media
  Cc: g.liakhovetski, prabhakar.csengg, laurent.pinchart, hverkuil,
	kyungmin.park, Sylwester Nawrocki

enum v4l2_async_bus_type also selects a method subdevs are matched
in the notification handlers, rename it to v4l2_async_match_type
so V4L2_ASYNC_MATCH_OF entry can be further added for matching by
device tree node pointer.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/media/platform/soc_camera/soc_camera.c |    2 +-
 drivers/media/v4l2-core/v4l2-async.c           |   26 ++++++++++++------------
 include/media/v4l2-async.h                     |   12 +++++------
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 2dd0e52..8af572b 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1475,7 +1475,7 @@ static int scan_async_group(struct soc_camera_host *ici,
 			break;
 	}
 
-	if (i == size || asd[i]->bus_type != V4L2_ASYNC_BUS_I2C) {
+	if (i == size || asd[i]->match_type != V4L2_ASYNC_MATCH_I2C) {
 		/* All useless */
 		dev_err(ici->v4l2_dev.dev, "No I2C data source found!\n");
 		return -ENODEV;
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index ff87c29..86934ca 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -34,9 +34,9 @@ static bool match_i2c(struct device *dev, struct v4l2_async_subdev *asd)
 #endif
 }
 
-static bool match_platform(struct device *dev, struct v4l2_async_subdev *asd)
+static bool match_devname(struct device *dev, struct v4l2_async_subdev *asd)
 {
-	return !strcmp(asd->match.platform.name, dev_name(dev));
+	return !strcmp(asd->match.device_name.name, dev_name(dev));
 }
 
 static LIST_HEAD(subdev_list);
@@ -53,17 +53,17 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *
 
 	list_for_each_entry(asd, &notifier->waiting, list) {
 		/* bus_type has been verified valid before */
-		switch (asd->bus_type) {
-		case V4L2_ASYNC_BUS_CUSTOM:
+		switch (asd->match_type) {
+		case V4L2_ASYNC_MATCH_CUSTOM:
 			match = asd->match.custom.match;
 			if (!match)
 				/* Match always */
 				return asd;
 			break;
-		case V4L2_ASYNC_BUS_PLATFORM:
-			match = match_platform;
+		case V4L2_ASYNC_MATCH_DEVNAME:
+			match = match_devname;
 			break;
-		case V4L2_ASYNC_BUS_I2C:
+		case V4L2_ASYNC_MATCH_I2C:
 			match = match_i2c;
 			break;
 		default:
@@ -141,15 +141,15 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
 	for (i = 0; i < notifier->num_subdevs; i++) {
 		asd = notifier->subdev[i];
 
-		switch (asd->bus_type) {
-		case V4L2_ASYNC_BUS_CUSTOM:
-		case V4L2_ASYNC_BUS_PLATFORM:
-		case V4L2_ASYNC_BUS_I2C:
+		switch (asd->match_type) {
+		case V4L2_ASYNC_MATCH_CUSTOM:
+		case V4L2_ASYNC_MATCH_DEVNAME:
+		case V4L2_ASYNC_MATCH_I2C:
 			break;
 		default:
 			dev_err(notifier->v4l2_dev ? notifier->v4l2_dev->dev : NULL,
-				"Invalid bus-type %u on %p\n",
-				asd->bus_type, asd);
+				"Invalid match type %u on %p\n",
+				asd->match_type, asd);
 			return -EINVAL;
 		}
 		list_add_tail(&asd->list, &notifier->waiting);
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index c3ec6ac..33e3b2a 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -22,10 +22,10 @@ struct v4l2_async_notifier;
 /* A random max subdevice number, used to allocate an array on stack */
 #define V4L2_MAX_SUBDEVS 128U
 
-enum v4l2_async_bus_type {
-	V4L2_ASYNC_BUS_CUSTOM,
-	V4L2_ASYNC_BUS_PLATFORM,
-	V4L2_ASYNC_BUS_I2C,
+enum v4l2_async_match_type {
+	V4L2_ASYNC_MATCH_CUSTOM,
+	V4L2_ASYNC_MATCH_DEVNAME,
+	V4L2_ASYNC_MATCH_I2C,
 };
 
 /**
@@ -36,11 +36,11 @@ enum v4l2_async_bus_type {
  *		probed, to a notifier->waiting list
  */
 struct v4l2_async_subdev {
-	enum v4l2_async_bus_type bus_type;
+	enum v4l2_async_match_type match_type;
 	union {
 		struct {
 			const char *name;
-		} platform;
+		} device_name;
 		struct {
 			int adapter_id;
 			unsigned short address;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RFC 3/5] V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
  2013-07-22 18:04 ` [PATCH RFC 1/5] V4L2: Drop bus_type check in v4l2-async match functions Sylwester Nawrocki
  2013-07-22 18:04 ` [PATCH RFC 2/5] V4L2: Rename v4l2_async_bus_* to v4l2_async_match_* Sylwester Nawrocki
@ 2013-07-22 18:04 ` Sylwester Nawrocki
  2013-07-24 11:21   ` Guennadi Liakhovetski
  2013-07-22 18:04 ` [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier Sylwester Nawrocki
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-22 18:04 UTC (permalink / raw)
  To: linux-media
  Cc: g.liakhovetski, prabhakar.csengg, laurent.pinchart, hverkuil,
	kyungmin.park, Sylwester Nawrocki

Add support for matching by device_node pointer. This allows
the notifier user to simply pass a list of device_node pointers
corresponding to sub-devices.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/media/v4l2-core/v4l2-async.c |    9 +++++++++
 include/media/v4l2-async.h           |    5 +++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 86934ca..9f91013 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -39,6 +39,11 @@ static bool match_devname(struct device *dev, struct v4l2_async_subdev *asd)
 	return !strcmp(asd->match.device_name.name, dev_name(dev));
 }
 
+static bool match_of(struct device *dev, struct v4l2_async_subdev *asd)
+{
+	return dev->of_node == asd->match.of.node;
+}
+
 static LIST_HEAD(subdev_list);
 static LIST_HEAD(notifier_list);
 static DEFINE_MUTEX(list_lock);
@@ -66,6 +71,9 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *
 		case V4L2_ASYNC_MATCH_I2C:
 			match = match_i2c;
 			break;
+		case V4L2_ASYNC_MATCH_OF:
+			match = match_of;
+			break;
 		default:
 			/* Cannot happen, unless someone breaks us */
 			WARN_ON(true);
@@ -145,6 +153,7 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
 		case V4L2_ASYNC_MATCH_CUSTOM:
 		case V4L2_ASYNC_MATCH_DEVNAME:
 		case V4L2_ASYNC_MATCH_I2C:
+		case V4L2_ASYNC_MATCH_OF:
 			break;
 		default:
 			dev_err(notifier->v4l2_dev ? notifier->v4l2_dev->dev : NULL,
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index 33e3b2a..295782e 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -13,6 +13,7 @@
 
 #include <linux/list.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 
 struct device;
 struct v4l2_device;
@@ -26,6 +27,7 @@ enum v4l2_async_match_type {
 	V4L2_ASYNC_MATCH_CUSTOM,
 	V4L2_ASYNC_MATCH_DEVNAME,
 	V4L2_ASYNC_MATCH_I2C,
+	V4L2_ASYNC_MATCH_OF,
 };
 
 /**
@@ -39,6 +41,9 @@ struct v4l2_async_subdev {
 	enum v4l2_async_match_type match_type;
 	union {
 		struct {
+			const struct device_node *node;
+		} of;
+		struct {
 			const char *name;
 		} device_name;
 		struct {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
                   ` (2 preceding siblings ...)
  2013-07-22 18:04 ` [PATCH RFC 3/5] V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type Sylwester Nawrocki
@ 2013-07-22 18:04 ` Sylwester Nawrocki
  2013-07-23 15:50   ` Prabhakar Lad
  2013-07-24 11:26   ` Guennadi Liakhovetski
  2013-07-22 18:04 ` [PATCH RFC 5/5] V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev Sylwester Nawrocki
                   ` (4 subsequent siblings)
  8 siblings, 2 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-22 18:04 UTC (permalink / raw)
  To: linux-media
  Cc: g.liakhovetski, prabhakar.csengg, laurent.pinchart, hverkuil,
	kyungmin.park, Sylwester Nawrocki

This is a purely cosmetic change. Since the 'subdev' member
points to an array of subdevs it seems more intuitive to name
it in plural form.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/media/platform/soc_camera/soc_camera.c |    2 +-
 drivers/media/v4l2-core/v4l2-async.c           |    2 +-
 include/media/v4l2-async.h                     |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 8af572b..4b42572 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1501,7 +1501,7 @@ static int scan_async_group(struct soc_camera_host *ici,
 		return -ENOMEM;
 	}
 
-	sasc->notifier.subdev = asd;
+	sasc->notifier.subdevs = asd;
 	sasc->notifier.num_subdevs = size;
 	sasc->notifier.bound = soc_camera_async_bound;
 	sasc->notifier.unbind = soc_camera_async_unbind;
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 9f91013..ed31a65 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -147,7 +147,7 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
 	INIT_LIST_HEAD(&notifier->done);
 
 	for (i = 0; i < notifier->num_subdevs; i++) {
-		asd = notifier->subdev[i];
+		asd = notifier->subdevs[i];
 
 		switch (asd->match_type) {
 		case V4L2_ASYNC_MATCH_CUSTOM:
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index 295782e..4e7834a 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -77,7 +77,7 @@ struct v4l2_async_subdev_list {
 /**
  * v4l2_async_notifier - v4l2_device notifier data
  * @num_subdevs:number of subdevices
- * @subdev:	array of pointers to subdevice descriptors
+ * @subdevs:	array of pointers to subdevice descriptors
  * @v4l2_dev:	pointer to struct v4l2_device
  * @waiting:	list of struct v4l2_async_subdev, waiting for their drivers
  * @done:	list of struct v4l2_async_subdev_list, already probed
@@ -88,7 +88,7 @@ struct v4l2_async_subdev_list {
  */
 struct v4l2_async_notifier {
 	unsigned int num_subdevs;
-	struct v4l2_async_subdev **subdev;
+	struct v4l2_async_subdev **subdevs;
 	struct v4l2_device *v4l2_dev;
 	struct list_head waiting;
 	struct list_head done;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RFC 5/5] V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
                   ` (3 preceding siblings ...)
  2013-07-22 18:04 ` [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier Sylwester Nawrocki
@ 2013-07-22 18:04 ` Sylwester Nawrocki
  2013-07-23 15:44 ` [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Prabhakar Lad
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-22 18:04 UTC (permalink / raw)
  To: linux-media
  Cc: g.liakhovetski, prabhakar.csengg, laurent.pinchart, hverkuil,
	kyungmin.park, Sylwester Nawrocki

By integrating the v4l2-async API internals a bit more with
the core overall the v4l2-async code becomes a bit simpler
and easier to follow.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/media/v4l2-core/v4l2-async.c |   67 +++++++++++++++-------------------
 include/media/v4l2-async.h           |   15 +-------
 include/media/v4l2-subdev.h          |   13 +++----
 3 files changed, 36 insertions(+), 59 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index ed31a65..b350ab9 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -49,12 +49,10 @@ static LIST_HEAD(notifier_list);
 static DEFINE_MUTEX(list_lock);
 
 static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *notifier,
-						    struct v4l2_async_subdev_list *asdl)
+						    struct v4l2_subdev *sd)
 {
-	struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl);
 	struct v4l2_async_subdev *asd;
-	bool (*match)(struct device *,
-		      struct v4l2_async_subdev *);
+	bool (*match)(struct device *, struct v4l2_async_subdev *);
 
 	list_for_each_entry(asd, &notifier->waiting, list) {
 		/* bus_type has been verified valid before */
@@ -89,16 +87,15 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *
 }
 
 static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier,
-				  struct v4l2_async_subdev_list *asdl,
+				  struct v4l2_subdev *sd,
 				  struct v4l2_async_subdev *asd)
 {
-	struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl);
 	int ret;
 
 	/* Remove from the waiting list */
 	list_del(&asd->list);
-	asdl->asd = asd;
-	asdl->notifier = notifier;
+	sd->asd = asd;
+	sd->notifier = notifier;
 
 	if (notifier->bound) {
 		ret = notifier->bound(notifier, sd, asd);
@@ -106,7 +103,7 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier,
 			return ret;
 	}
 	/* Move from the global subdevice list to notifier's done */
-	list_move(&asdl->list, &notifier->done);
+	list_move(&sd->async_list, &notifier->done);
 
 	ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd);
 	if (ret < 0) {
@@ -121,21 +118,19 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier,
 	return 0;
 }
 
-static void v4l2_async_cleanup(struct v4l2_async_subdev_list *asdl)
+static void v4l2_async_cleanup(struct v4l2_subdev *sd)
 {
-	struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl);
-
 	v4l2_device_unregister_subdev(sd);
-	/* Subdevice driver will reprobe and put asdl back onto the list */
-	list_del_init(&asdl->list);
-	asdl->asd = NULL;
+	/* Subdevice driver will reprobe and put the subdev back onto the list */
+	list_del_init(&sd->async_list);
+	sd->asd = NULL;
 	sd->dev = NULL;
 }
 
 int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
 				 struct v4l2_async_notifier *notifier)
 {
-	struct v4l2_async_subdev_list *asdl, *tmp;
+	struct v4l2_subdev *sd, *tmp;
 	struct v4l2_async_subdev *asd;
 	int i;
 
@@ -169,14 +164,14 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
 	/* Keep also completed notifiers on the list */
 	list_add(&notifier->list, &notifier_list);
 
-	list_for_each_entry_safe(asdl, tmp, &subdev_list, list) {
+	list_for_each_entry_safe(sd, tmp, &subdev_list, async_list) {
 		int ret;
 
-		asd = v4l2_async_belongs(notifier, asdl);
+		asd = v4l2_async_belongs(notifier, sd);
 		if (!asd)
 			continue;
 
-		ret = v4l2_async_test_notify(notifier, asdl, asd);
+		ret = v4l2_async_test_notify(notifier, sd, asd);
 		if (ret < 0) {
 			mutex_unlock(&list_lock);
 			return ret;
@@ -191,7 +186,7 @@ EXPORT_SYMBOL(v4l2_async_notifier_register);
 
 void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
 {
-	struct v4l2_async_subdev_list *asdl, *tmp;
+	struct v4l2_subdev *sd, *tmp;
 	unsigned int notif_n_subdev = notifier->num_subdevs;
 	unsigned int n_subdev = min(notif_n_subdev, V4L2_MAX_SUBDEVS);
 	struct device *dev[n_subdev];
@@ -201,18 +196,16 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
 
 	list_del(&notifier->list);
 
-	list_for_each_entry_safe(asdl, tmp, &notifier->done, list) {
-		struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl);
-
+	list_for_each_entry_safe(sd, tmp, &notifier->done, list) {
 		dev[i] = get_device(sd->dev);
 
-		v4l2_async_cleanup(asdl);
+		v4l2_async_cleanup(sd);
 
 		/* If we handled USB devices, we'd have to lock the parent too */
 		device_release_driver(dev[i++]);
 
 		if (notifier->unbind)
-			notifier->unbind(notifier, sd, sd->asdl.asd);
+			notifier->unbind(notifier, sd, sd->asd);
 	}
 
 	mutex_unlock(&list_lock);
@@ -241,24 +234,23 @@ EXPORT_SYMBOL(v4l2_async_notifier_unregister);
 
 int v4l2_async_register_subdev(struct v4l2_subdev *sd)
 {
-	struct v4l2_async_subdev_list *asdl = &sd->asdl;
 	struct v4l2_async_notifier *notifier;
 
 	mutex_lock(&list_lock);
 
-	INIT_LIST_HEAD(&asdl->list);
+	INIT_LIST_HEAD(&sd->async_list);
 
 	list_for_each_entry(notifier, &notifier_list, list) {
-		struct v4l2_async_subdev *asd = v4l2_async_belongs(notifier, asdl);
+		struct v4l2_async_subdev *asd = v4l2_async_belongs(notifier, sd);
 		if (asd) {
-			int ret = v4l2_async_test_notify(notifier, asdl, asd);
+			int ret = v4l2_async_test_notify(notifier, sd, asd);
 			mutex_unlock(&list_lock);
 			return ret;
 		}
 	}
 
 	/* None matched, wait for hot-plugging */
-	list_add(&asdl->list, &subdev_list);
+	list_add(&sd->async_list, &subdev_list);
 
 	mutex_unlock(&list_lock);
 
@@ -268,23 +260,22 @@ EXPORT_SYMBOL(v4l2_async_register_subdev);
 
 void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
 {
-	struct v4l2_async_subdev_list *asdl = &sd->asdl;
-	struct v4l2_async_notifier *notifier = asdl->notifier;
+	struct v4l2_async_notifier *notifier = sd->notifier;
 
-	if (!asdl->asd) {
-		if (!list_empty(&asdl->list))
-			v4l2_async_cleanup(asdl);
+	if (!sd->asd) {
+		if (!list_empty(&sd->async_list))
+			v4l2_async_cleanup(sd);
 		return;
 	}
 
 	mutex_lock(&list_lock);
 
-	list_add(&asdl->asd->list, &notifier->waiting);
+	list_add(&sd->asd->list, &notifier->waiting);
 
-	v4l2_async_cleanup(asdl);
+	v4l2_async_cleanup(sd);
 
 	if (notifier->unbind)
-		notifier->unbind(notifier, sd, sd->asdl.asd);
+		notifier->unbind(notifier, sd, sd->asd);
 
 	mutex_unlock(&list_lock);
 }
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index 4e7834a..0b2b32b 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -62,25 +62,12 @@ struct v4l2_async_subdev {
 };
 
 /**
- * v4l2_async_subdev_list - provided by subdevices
- * @list:	links struct v4l2_async_subdev_list objects to a global list
- *		before probing, and onto notifier->done after probing
- * @asd:	pointer to respective struct v4l2_async_subdev
- * @notifier:	pointer to managing notifier
- */
-struct v4l2_async_subdev_list {
-	struct list_head list;
-	struct v4l2_async_subdev *asd;
-	struct v4l2_async_notifier *notifier;
-};
-
-/**
  * v4l2_async_notifier - v4l2_device notifier data
  * @num_subdevs:number of subdevices
  * @subdevs:	array of pointers to subdevice descriptors
  * @v4l2_dev:	pointer to struct v4l2_device
  * @waiting:	list of struct v4l2_async_subdev, waiting for their drivers
- * @done:	list of struct v4l2_async_subdev_list, already probed
+ * @done:	list of struct v4l2_subdev, already probed
  * @list:	member in a global list of notifiers
  * @bound:	a subdevice driver has successfully probed one of subdevices
  * @complete:	all subdevices have been probed successfully
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 3250cc5..bfda0fe 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -586,15 +586,14 @@ struct v4l2_subdev {
 	struct video_device *devnode;
 	/* pointer to the physical device, if any */
 	struct device *dev;
-	struct v4l2_async_subdev_list asdl;
+	/* Links this subdev to a global subdev_list or @notifier->done list. */
+	struct list_head async_list;
+	/* Pointer to respective struct v4l2_async_subdev. */
+	struct v4l2_async_subdev *asd;
+	/* Pointer to the managing notifier. */
+	struct v4l2_async_notifier *notifier;
 };
 
-static inline struct v4l2_subdev *v4l2_async_to_subdev(
-			struct v4l2_async_subdev_list *asdl)
-{
-	return container_of(asdl, struct v4l2_subdev, asdl);
-}
-
 #define media_entity_to_v4l2_subdev(ent) \
 	container_of(ent, struct v4l2_subdev, entity)
 #define vdev_to_v4l2_subdev(vdev) \
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
                   ` (4 preceding siblings ...)
  2013-07-22 18:04 ` [PATCH RFC 5/5] V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev Sylwester Nawrocki
@ 2013-07-23 15:44 ` Prabhakar Lad
  2013-07-24 10:06 ` Laurent Pinchart
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Prabhakar Lad @ 2013-07-23 15:44 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, g.liakhovetski, laurent.pinchart, hverkuil, kyungmin.park

Hi Sylwester,

On Mon, Jul 22, 2013 at 11:34 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> Hello,
>
> This is a few patches for the v4l2-async API I wrote while adding
> the asynchronous subdev registration support to the exynos4-is
> driver.
>
> The most significant change is addition of V4L2_ASYNC_MATCH_OF
> subdev matching method, where host driver can pass a list of
> of_node pointers identifying its subdevs.
>
> I thought it's a reasonable and simple enough way to support device
> tree based systems. Comments/other ideas are of course welcome.
>
> Thanks,
> Sylwester
>
> Sylwester Nawrocki (5):
>   V4L2: Drop bus_type check in v4l2-async match functions
>   V4L2: Rename v4l2_async_bus_* to v4l2_async_match_*
>   V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type
>   V4L2: Rename subdev field of struct v4l2_async_notifier
>   V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev
>
Thanks for the patche's tested on DA850 EVM for VPIF driver.

for patches 1,2,4,5:

Acked-and-tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

and for patch 3:

Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier
  2013-07-22 18:04 ` [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier Sylwester Nawrocki
@ 2013-07-23 15:50   ` Prabhakar Lad
  2013-07-24  9:39     ` Sylwester Nawrocki
  2013-07-24 11:26   ` Guennadi Liakhovetski
  1 sibling, 1 reply; 19+ messages in thread
From: Prabhakar Lad @ 2013-07-23 15:50 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, g.liakhovetski, laurent.pinchart, hverkuil, kyungmin.park

Hi Sylwester,

On Mon, Jul 22, 2013 at 11:34 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> This is a purely cosmetic change. Since the 'subdev' member
> points to an array of subdevs it seems more intuitive to name
> it in plural form.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/media/platform/soc_camera/soc_camera.c |    2 +-
>  drivers/media/v4l2-core/v4l2-async.c           |    2 +-
>  include/media/v4l2-async.h                     |    4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
>

can you include the following changes in the same patch ?
so that git bisect doesn’t break.

(maybe you need to rebase the patches on
http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/for-v3.12)

Regards,
--Prabhakar Lad

diff --git a/drivers/media/platform/davinci/vpif_capture.c
b/drivers/media/platform/davinci/vpif_capture.c
index b11d7a7..7fbde6d 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -2168,7 +2168,7 @@ static __init int vpif_probe(struct platform_device *pdev)
 		}
 		vpif_probe_complete();
 	} else {
-		vpif_obj.notifier.subdev = vpif_obj.config->asd;
+		vpif_obj.notifier.subdevs = vpif_obj.config->asd;
 		vpif_obj.notifier.num_subdevs = vpif_obj.config->asd_sizes[0];
 		vpif_obj.notifier.bound = vpif_async_bound;
 		vpif_obj.notifier.complete = vpif_async_complete;
diff --git a/drivers/media/platform/davinci/vpif_display.c
b/drivers/media/platform/davinci/vpif_display.c
index c2ff067..6336dfc 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1832,7 +1832,7 @@ static __init int vpif_probe(struct platform_device *pdev)
 		}
 		vpif_probe_complete();
 	} else {
-		vpif_obj.notifier.subdev = vpif_obj.config->asd;
+		vpif_obj.notifier.subdevs = vpif_obj.config->asd;
 		vpif_obj.notifier.num_subdevs = vpif_obj.config->asd_sizes[0];
 		vpif_obj.notifier.bound = vpif_async_bound;
 		vpif_obj.notifier.complete = vpif_async_complete;

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier
  2013-07-23 15:50   ` Prabhakar Lad
@ 2013-07-24  9:39     ` Sylwester Nawrocki
  0 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-24  9:39 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: linux-media, g.liakhovetski, laurent.pinchart, hverkuil, kyungmin.park

Hi Prabhakar,

On 07/23/2013 05:50 PM, Prabhakar Lad wrote:
> On Mon, Jul 22, 2013 at 11:34 PM, Sylwester Nawrocki
> <s.nawrocki@samsung.com> wrote:
>> This is a purely cosmetic change. Since the 'subdev' member
>> points to an array of subdevs it seems more intuitive to name
>> it in plural form.
>>
>> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  drivers/media/platform/soc_camera/soc_camera.c |    2 +-
>>  drivers/media/v4l2-core/v4l2-async.c           |    2 +-
>>  include/media/v4l2-async.h                     |    4 ++--
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>
> 
> can you include the following changes in the same patch ?
> so that git bisect doesn’t break.
> 
> (maybe you need to rebase the patches on
> http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/for-v3.12)

Thanks for your testing and Ack. I'll wait couple days to also
let other take a look and review the patches. I'm not going to
try to merge that without at least Guennadi's Ack ;)

I think the best is to wait until the above patches from Hans'
tree get merged to the media master branch. Then I would rebase
my series on top of that before sending any pull request.

Regards,
Sylwester

> diff --git a/drivers/media/platform/davinci/vpif_capture.c
> b/drivers/media/platform/davinci/vpif_capture.c
> index b11d7a7..7fbde6d 100644
> --- a/drivers/media/platform/davinci/vpif_capture.c
> +++ b/drivers/media/platform/davinci/vpif_capture.c
> @@ -2168,7 +2168,7 @@ static __init int vpif_probe(struct platform_device *pdev)
>  		}
>  		vpif_probe_complete();
>  	} else {
> -		vpif_obj.notifier.subdev = vpif_obj.config->asd;
> +		vpif_obj.notifier.subdevs = vpif_obj.config->asd;
>  		vpif_obj.notifier.num_subdevs = vpif_obj.config->asd_sizes[0];
>  		vpif_obj.notifier.bound = vpif_async_bound;
>  		vpif_obj.notifier.complete = vpif_async_complete;
> diff --git a/drivers/media/platform/davinci/vpif_display.c
> b/drivers/media/platform/davinci/vpif_display.c
> index c2ff067..6336dfc 100644
> --- a/drivers/media/platform/davinci/vpif_display.c
> +++ b/drivers/media/platform/davinci/vpif_display.c
> @@ -1832,7 +1832,7 @@ static __init int vpif_probe(struct platform_device *pdev)
>  		}
>  		vpif_probe_complete();
>  	} else {
> -		vpif_obj.notifier.subdev = vpif_obj.config->asd;
> +		vpif_obj.notifier.subdevs = vpif_obj.config->asd;
>  		vpif_obj.notifier.num_subdevs = vpif_obj.config->asd_sizes[0];
>  		vpif_obj.notifier.bound = vpif_async_bound;
>  		vpif_obj.notifier.complete = vpif_async_complete;

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
                   ` (5 preceding siblings ...)
  2013-07-23 15:44 ` [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Prabhakar Lad
@ 2013-07-24 10:06 ` Laurent Pinchart
  2013-07-25  9:33   ` Sylwester Nawrocki
  2013-07-24 10:16 ` Hans Verkuil
  2013-07-24 11:36 ` Guennadi Liakhovetski
  8 siblings, 1 reply; 19+ messages in thread
From: Laurent Pinchart @ 2013-07-24 10:06 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, g.liakhovetski, prabhakar.csengg, hverkuil, kyungmin.park

Hi Sylwester,

Thanks for the patches.

On Monday 22 July 2013 20:04:42 Sylwester Nawrocki wrote:
> Hello,
> 
> This is a few patches for the v4l2-async API I wrote while adding
> the asynchronous subdev registration support to the exynos4-is
> driver.
> 
> The most significant change is addition of V4L2_ASYNC_MATCH_OF
> subdev matching method, where host driver can pass a list of
> of_node pointers identifying its subdevs.
> 
> I thought it's a reasonable and simple enough way to support device tree
> based systems. Comments/other ideas are of course welcome.

I have similar patches in my tree that I haven't posted yet, so I like the 
idea :-) For the whole series,

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Thanks,
> Sylwester
> 
> Sylwester Nawrocki (5):
>   V4L2: Drop bus_type check in v4l2-async match functions
>   V4L2: Rename v4l2_async_bus_* to v4l2_async_match_*
>   V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type
>   V4L2: Rename subdev field of struct v4l2_async_notifier
>   V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev
> 
>  drivers/media/platform/soc_camera/soc_camera.c |    4 +-
>  drivers/media/v4l2-core/v4l2-async.c           |  106 ++++++++++-----------
>  include/media/v4l2-async.h                     |   36 ++++----
>  include/media/v4l2-subdev.h                    |   13 ++-
>  4 files changed, 74 insertions(+), 85 deletions(-)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
                   ` (6 preceding siblings ...)
  2013-07-24 10:06 ` Laurent Pinchart
@ 2013-07-24 10:16 ` Hans Verkuil
  2013-07-25  9:38   ` Sylwester Nawrocki
  2013-07-24 11:36 ` Guennadi Liakhovetski
  8 siblings, 1 reply; 19+ messages in thread
From: Hans Verkuil @ 2013-07-24 10:16 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, g.liakhovetski, prabhakar.csengg, laurent.pinchart,
	kyungmin.park

On Mon 22 July 2013 20:04:42 Sylwester Nawrocki wrote:
> Hello,
> 
> This is a few patches for the v4l2-async API I wrote while adding
> the asynchronous subdev registration support to the exynos4-is
> driver.
> 
> The most significant change is addition of V4L2_ASYNC_MATCH_OF
> subdev matching method, where host driver can pass a list of
> of_node pointers identifying its subdevs.
> 
> I thought it's a reasonable and simple enough way to support device
> tree based systems. Comments/other ideas are of course welcome.

Looks good!

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

> 
> Thanks,
> Sylwester
> 
> Sylwester Nawrocki (5):
>   V4L2: Drop bus_type check in v4l2-async match functions
>   V4L2: Rename v4l2_async_bus_* to v4l2_async_match_*
>   V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type
>   V4L2: Rename subdev field of struct v4l2_async_notifier
>   V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev
> 
>  drivers/media/platform/soc_camera/soc_camera.c |    4 +-
>  drivers/media/v4l2-core/v4l2-async.c           |  106 ++++++++++++------------
>  include/media/v4l2-async.h                     |   36 ++++----
>  include/media/v4l2-subdev.h                    |   13 ++-
>  4 files changed, 74 insertions(+), 85 deletions(-)
> 
> --
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 3/5] V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type
  2013-07-22 18:04 ` [PATCH RFC 3/5] V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type Sylwester Nawrocki
@ 2013-07-24 11:21   ` Guennadi Liakhovetski
  2013-07-25  9:45     ` Sylwester Nawrocki
  0 siblings, 1 reply; 19+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-24 11:21 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, prabhakar.csengg, laurent.pinchart, hverkuil, kyungmin.park

Hi Sylwester

On Mon, 22 Jul 2013, Sylwester Nawrocki wrote:

> Add support for matching by device_node pointer. This allows
> the notifier user to simply pass a list of device_node pointers
> corresponding to sub-devices.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/media/v4l2-core/v4l2-async.c |    9 +++++++++
>  include/media/v4l2-async.h           |    5 +++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
> index 86934ca..9f91013 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -39,6 +39,11 @@ static bool match_devname(struct device *dev, struct v4l2_async_subdev *asd)
>  	return !strcmp(asd->match.device_name.name, dev_name(dev));
>  }
>  
> +static bool match_of(struct device *dev, struct v4l2_async_subdev *asd)
> +{
> +	return dev->of_node == asd->match.of.node;
> +}
> +
>  static LIST_HEAD(subdev_list);
>  static LIST_HEAD(notifier_list);
>  static DEFINE_MUTEX(list_lock);
> @@ -66,6 +71,9 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *
>  		case V4L2_ASYNC_MATCH_I2C:
>  			match = match_i2c;
>  			break;
> +		case V4L2_ASYNC_MATCH_OF:
> +			match = match_of;
> +			break;
>  		default:
>  			/* Cannot happen, unless someone breaks us */
>  			WARN_ON(true);
> @@ -145,6 +153,7 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
>  		case V4L2_ASYNC_MATCH_CUSTOM:
>  		case V4L2_ASYNC_MATCH_DEVNAME:
>  		case V4L2_ASYNC_MATCH_I2C:
> +		case V4L2_ASYNC_MATCH_OF:
>  			break;
>  		default:
>  			dev_err(notifier->v4l2_dev ? notifier->v4l2_dev->dev : NULL,
> diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
> index 33e3b2a..295782e 100644
> --- a/include/media/v4l2-async.h
> +++ b/include/media/v4l2-async.h
> @@ -13,6 +13,7 @@
>  
>  #include <linux/list.h>
>  #include <linux/mutex.h>
> +#include <linux/of.h>
>  
>  struct device;
>  struct v4l2_device;

A nitpick: it is common to just forward-declare structs as above instead 
of including a header if just a pointer to that struct is needed. I think 
it would be more consistent to update it here.

Thanks
Guennadi

> @@ -26,6 +27,7 @@ enum v4l2_async_match_type {
>  	V4L2_ASYNC_MATCH_CUSTOM,
>  	V4L2_ASYNC_MATCH_DEVNAME,
>  	V4L2_ASYNC_MATCH_I2C,
> +	V4L2_ASYNC_MATCH_OF,
>  };
>  
>  /**
> @@ -39,6 +41,9 @@ struct v4l2_async_subdev {
>  	enum v4l2_async_match_type match_type;
>  	union {
>  		struct {
> +			const struct device_node *node;
> +		} of;
> +		struct {
>  			const char *name;
>  		} device_name;
>  		struct {
> -- 
> 1.7.9.5
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier
  2013-07-22 18:04 ` [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier Sylwester Nawrocki
  2013-07-23 15:50   ` Prabhakar Lad
@ 2013-07-24 11:26   ` Guennadi Liakhovetski
  2013-07-25  9:52     ` Sylwester Nawrocki
  1 sibling, 1 reply; 19+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-24 11:26 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, prabhakar.csengg, laurent.pinchart, hverkuil, kyungmin.park

Hi Sylwester

On Mon, 22 Jul 2013, Sylwester Nawrocki wrote:

> This is a purely cosmetic change. Since the 'subdev' member
> points to an array of subdevs it seems more intuitive to name
> it in plural form.

Well, I was aware of the fact, that "subdev" is an array and that the 
plural form of "subdev" would be "subdevs" :-) It was kind of a conscious 
choice. I think, both ways can be found in the kernel: using singulars and 
plurals for array names. Whether one of them is better than the other - no 
idea. My personal preference is somewhat with the singular form as in, say 
"subdev array" instead of "subdevs array," i.e. as an adjective, but I 
really don't care all that much :) Feel free to change if that's important 
for you or for others on V4L :)

Thanks
Guennadi

> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/media/platform/soc_camera/soc_camera.c |    2 +-
>  drivers/media/v4l2-core/v4l2-async.c           |    2 +-
>  include/media/v4l2-async.h                     |    4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
> index 8af572b..4b42572 100644
> --- a/drivers/media/platform/soc_camera/soc_camera.c
> +++ b/drivers/media/platform/soc_camera/soc_camera.c
> @@ -1501,7 +1501,7 @@ static int scan_async_group(struct soc_camera_host *ici,
>  		return -ENOMEM;
>  	}
>  
> -	sasc->notifier.subdev = asd;
> +	sasc->notifier.subdevs = asd;
>  	sasc->notifier.num_subdevs = size;
>  	sasc->notifier.bound = soc_camera_async_bound;
>  	sasc->notifier.unbind = soc_camera_async_unbind;
> diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
> index 9f91013..ed31a65 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -147,7 +147,7 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
>  	INIT_LIST_HEAD(&notifier->done);
>  
>  	for (i = 0; i < notifier->num_subdevs; i++) {
> -		asd = notifier->subdev[i];
> +		asd = notifier->subdevs[i];
>  
>  		switch (asd->match_type) {
>  		case V4L2_ASYNC_MATCH_CUSTOM:
> diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
> index 295782e..4e7834a 100644
> --- a/include/media/v4l2-async.h
> +++ b/include/media/v4l2-async.h
> @@ -77,7 +77,7 @@ struct v4l2_async_subdev_list {
>  /**
>   * v4l2_async_notifier - v4l2_device notifier data
>   * @num_subdevs:number of subdevices
> - * @subdev:	array of pointers to subdevice descriptors
> + * @subdevs:	array of pointers to subdevice descriptors
>   * @v4l2_dev:	pointer to struct v4l2_device
>   * @waiting:	list of struct v4l2_async_subdev, waiting for their drivers
>   * @done:	list of struct v4l2_async_subdev_list, already probed
> @@ -88,7 +88,7 @@ struct v4l2_async_subdev_list {
>   */
>  struct v4l2_async_notifier {
>  	unsigned int num_subdevs;
> -	struct v4l2_async_subdev **subdev;
> +	struct v4l2_async_subdev **subdevs;
>  	struct v4l2_device *v4l2_dev;
>  	struct list_head waiting;
>  	struct list_head done;
> -- 
> 1.7.9.5
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups
  2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
                   ` (7 preceding siblings ...)
  2013-07-24 10:16 ` Hans Verkuil
@ 2013-07-24 11:36 ` Guennadi Liakhovetski
  2013-07-25 10:01   ` Sylwester Nawrocki
  8 siblings, 1 reply; 19+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-24 11:36 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, prabhakar.csengg, laurent.pinchart, hverkuil, kyungmin.park

Hi Sylwester

On Mon, 22 Jul 2013, Sylwester Nawrocki wrote:

> Hello,
> 
> This is a few patches for the v4l2-async API I wrote while adding
> the asynchronous subdev registration support to the exynos4-is
> driver.
> 
> The most significant change is addition of V4L2_ASYNC_MATCH_OF
> subdev matching method, where host driver can pass a list of
> of_node pointers identifying its subdevs.
> 
> I thought it's a reasonable and simple enough way to support device
> tree based systems. Comments/other ideas are of course welcome.

Thanks for the patches. In principle I have nothing against them, OF 
support looks good, integrating asdl into struct v4l2_subdev, dropping 
redundant checks, renaming "bus" to "match look ok too. Plural vs. 
singular seems to be a matter of taste to me :) But in general, provided 
my single comment concerning struct forward-declaration is addressed

Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Thanks
Guennadi

> 
> Thanks,
> Sylwester
> 
> Sylwester Nawrocki (5):
>   V4L2: Drop bus_type check in v4l2-async match functions
>   V4L2: Rename v4l2_async_bus_* to v4l2_async_match_*
>   V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type
>   V4L2: Rename subdev field of struct v4l2_async_notifier
>   V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev
> 
>  drivers/media/platform/soc_camera/soc_camera.c |    4 +-
>  drivers/media/v4l2-core/v4l2-async.c           |  106 ++++++++++++------------
>  include/media/v4l2-async.h                     |   36 ++++----
>  include/media/v4l2-subdev.h                    |   13 ++-
>  4 files changed, 74 insertions(+), 85 deletions(-)
> 
> --
> 1.7.9.5
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups
  2013-07-24 10:06 ` Laurent Pinchart
@ 2013-07-25  9:33   ` Sylwester Nawrocki
  0 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-25  9:33 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, g.liakhovetski, prabhakar.csengg, hverkuil, kyungmin.park

Hi Laurent,

On 07/24/2013 12:06 PM, Laurent Pinchart wrote:
> Hi Sylwester,
> 
> Thanks for the patches.
> 
> On Monday 22 July 2013 20:04:42 Sylwester Nawrocki wrote:
>> Hello,
>>
>> This is a few patches for the v4l2-async API I wrote while adding
>> the asynchronous subdev registration support to the exynos4-is
>> driver.
>>
>> The most significant change is addition of V4L2_ASYNC_MATCH_OF
>> subdev matching method, where host driver can pass a list of
>> of_node pointers identifying its subdevs.
>>
>> I thought it's a reasonable and simple enough way to support device tree
>> based systems. Comments/other ideas are of course welcome.
> 
> I have similar patches in my tree that I haven't posted yet, so I like the 
> idea :-) For the whole series,

Hm, what a coincidence :-) Thank you for the review.

> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

--
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups
  2013-07-24 10:16 ` Hans Verkuil
@ 2013-07-25  9:38   ` Sylwester Nawrocki
  0 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-25  9:38 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: linux-media, g.liakhovetski, prabhakar.csengg, laurent.pinchart,
	kyungmin.park

On 07/24/2013 12:16 PM, Hans Verkuil wrote:
> On Mon 22 July 2013 20:04:42 Sylwester Nawrocki wrote:
>> Hello,
>>
>> This is a few patches for the v4l2-async API I wrote while adding
>> the asynchronous subdev registration support to the exynos4-is
>> driver.
>>
>> The most significant change is addition of V4L2_ASYNC_MATCH_OF
>> subdev matching method, where host driver can pass a list of
>> of_node pointers identifying its subdevs.
>>
>> I thought it's a reasonable and simple enough way to support device
>> tree based systems. Comments/other ideas are of course welcome.
> 
> Looks good!
> 
> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thank you for the review, Hans. We can always be sure nothing miss
your eye ;)

--
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 3/5] V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type
  2013-07-24 11:21   ` Guennadi Liakhovetski
@ 2013-07-25  9:45     ` Sylwester Nawrocki
  0 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-25  9:45 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-media, prabhakar.csengg, laurent.pinchart, hverkuil, kyungmin.park

Hi Guennadi,

On 07/24/2013 01:21 PM, Guennadi Liakhovetski wrote:
> Hi Sylwester
> 
> On Mon, 22 Jul 2013, Sylwester Nawrocki wrote:
> 
>> Add support for matching by device_node pointer. This allows
>> the notifier user to simply pass a list of device_node pointers
>> corresponding to sub-devices.
>>
>> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  drivers/media/v4l2-core/v4l2-async.c |    9 +++++++++
>>  include/media/v4l2-async.h           |    5 +++++
>>  2 files changed, 14 insertions(+)
>>
>> diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
>> index 86934ca..9f91013 100644
>> --- a/drivers/media/v4l2-core/v4l2-async.c
>> +++ b/drivers/media/v4l2-core/v4l2-async.c
>> @@ -39,6 +39,11 @@ static bool match_devname(struct device *dev, struct v4l2_async_subdev *asd)
>>  	return !strcmp(asd->match.device_name.name, dev_name(dev));
>>  }
>>  
>> +static bool match_of(struct device *dev, struct v4l2_async_subdev *asd)
>> +{
>> +	return dev->of_node == asd->match.of.node;
>> +}
>> +
>>  static LIST_HEAD(subdev_list);
>>  static LIST_HEAD(notifier_list);
>>  static DEFINE_MUTEX(list_lock);
>> @@ -66,6 +71,9 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *
>>  		case V4L2_ASYNC_MATCH_I2C:
>>  			match = match_i2c;
>>  			break;
>> +		case V4L2_ASYNC_MATCH_OF:
>> +			match = match_of;
>> +			break;
>>  		default:
>>  			/* Cannot happen, unless someone breaks us */
>>  			WARN_ON(true);
>> @@ -145,6 +153,7 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
>>  		case V4L2_ASYNC_MATCH_CUSTOM:
>>  		case V4L2_ASYNC_MATCH_DEVNAME:
>>  		case V4L2_ASYNC_MATCH_I2C:
>> +		case V4L2_ASYNC_MATCH_OF:
>>  			break;
>>  		default:
>>  			dev_err(notifier->v4l2_dev ? notifier->v4l2_dev->dev : NULL,
>> diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
>> index 33e3b2a..295782e 100644
>> --- a/include/media/v4l2-async.h
>> +++ b/include/media/v4l2-async.h
>> @@ -13,6 +13,7 @@
>>  
>>  #include <linux/list.h>
>>  #include <linux/mutex.h>
>> +#include <linux/of.h>
>>  
>>  struct device;
>>  struct v4l2_device;
> 
> A nitpick: it is common to just forward-declare structs as above instead 
> of including a header if just a pointer to that struct is needed. I think 
> it would be more consistent to update it here.

Sure, I will make this change before sending the pull request. I wasn't 
really sure which way is better.
--
Regards,
Sylwester


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier
  2013-07-24 11:26   ` Guennadi Liakhovetski
@ 2013-07-25  9:52     ` Sylwester Nawrocki
  0 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-25  9:52 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-media, prabhakar.csengg, laurent.pinchart, hverkuil, kyungmin.park

Hi Gueannadi,

On 07/24/2013 01:26 PM, Guennadi Liakhovetski wrote:
> On Mon, 22 Jul 2013, Sylwester Nawrocki wrote:
> 
>> > This is a purely cosmetic change. Since the 'subdev' member
>> > points to an array of subdevs it seems more intuitive to name
>> > it in plural form.
>
> Well, I was aware of the fact, that "subdev" is an array and that the 
> plural form of "subdev" would be "subdevs" :-) It was kind of a conscious 
> choice. I think, both ways can be found in the kernel: using singulars and 
> plurals for array names. Whether one of them is better than the other - no 
> idea. My personal preference is somewhat with the singular form as in, say 
> "subdev array" instead of "subdevs array," i.e. as an adjective, but I 
> really don't care all that much :) Feel free to change if that's important 
> for you or for others on V4L :)

Sorry, I expected this patch to be a bit controversial... :) I agree it
might be a matter of taste, but subdev/num_subdevs pair bothered me quite
a bit so I've decided to post the patch anyway.
If you don't mind that much I'd like to keep that patch in this series.

--
Thanks,
Sylwester

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups
  2013-07-24 11:36 ` Guennadi Liakhovetski
@ 2013-07-25 10:01   ` Sylwester Nawrocki
  0 siblings, 0 replies; 19+ messages in thread
From: Sylwester Nawrocki @ 2013-07-25 10:01 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-media, prabhakar.csengg, laurent.pinchart, hverkuil, kyungmin.park

Hi Guennadi,

On 07/24/2013 01:36 PM, Guennadi Liakhovetski wrote:
> On Mon, 22 Jul 2013, Sylwester Nawrocki wrote:
>> Hello,
>>
>> This is a few patches for the v4l2-async API I wrote while adding
>> the asynchronous subdev registration support to the exynos4-is
>> driver.
>>
>> The most significant change is addition of V4L2_ASYNC_MATCH_OF
>> subdev matching method, where host driver can pass a list of
>> of_node pointers identifying its subdevs.
>>
>> I thought it's a reasonable and simple enough way to support device
>> tree based systems. Comments/other ideas are of course welcome.
> 
> Thanks for the patches. In principle I have nothing against them, OF 
> support looks good, integrating asdl into struct v4l2_subdev, dropping 
> redundant checks, renaming "bus" to "match look ok too. Plural vs. 
> singular seems to be a matter of taste to me :) But in general, provided 
> my single comment concerning struct forward-declaration is addressed

Thanks for your review. I'm going to make that change locally, before
sending a pull request with those patches.

> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

--
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2013-07-25 10:01 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22 18:04 [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Sylwester Nawrocki
2013-07-22 18:04 ` [PATCH RFC 1/5] V4L2: Drop bus_type check in v4l2-async match functions Sylwester Nawrocki
2013-07-22 18:04 ` [PATCH RFC 2/5] V4L2: Rename v4l2_async_bus_* to v4l2_async_match_* Sylwester Nawrocki
2013-07-22 18:04 ` [PATCH RFC 3/5] V4L2: Add V4L2_ASYNC_MATCH_OF subdev matching type Sylwester Nawrocki
2013-07-24 11:21   ` Guennadi Liakhovetski
2013-07-25  9:45     ` Sylwester Nawrocki
2013-07-22 18:04 ` [PATCH RFC 4/5] V4L2: Rename subdev field of struct v4l2_async_notifier Sylwester Nawrocki
2013-07-23 15:50   ` Prabhakar Lad
2013-07-24  9:39     ` Sylwester Nawrocki
2013-07-24 11:26   ` Guennadi Liakhovetski
2013-07-25  9:52     ` Sylwester Nawrocki
2013-07-22 18:04 ` [PATCH RFC 5/5] V4L2: Fold struct v4l2_async_subdev_list with struct v4l2_subdev Sylwester Nawrocki
2013-07-23 15:44 ` [PATCH RFC 0/5] v4l2-async DT support improvement and cleanups Prabhakar Lad
2013-07-24 10:06 ` Laurent Pinchart
2013-07-25  9:33   ` Sylwester Nawrocki
2013-07-24 10:16 ` Hans Verkuil
2013-07-25  9:38   ` Sylwester Nawrocki
2013-07-24 11:36 ` Guennadi Liakhovetski
2013-07-25 10:01   ` Sylwester Nawrocki

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.