All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] V4L: Int if: Set slave's master before attach, remove master argument
@ 2007-10-16 15:08 Sakari Ailus
  2007-10-16 15:08 ` [PATCH] ARM: OMAP2: Camera: Fix v4l2 int device detach Sakari Ailus
  2007-10-31 12:50 ` [PATCH] V4L: Int if: Set slave's master before attach, remove master argument Tony Lindgren
  0 siblings, 2 replies; 4+ messages in thread
From: Sakari Ailus @ 2007-10-16 15:08 UTC (permalink / raw)
  To: linux-omap-open-source

Set slave's master before master's attach call.

The master also now gets its own pointer from slave's structure.

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 drivers/media/video/v4l2-int-device.c |    6 +++---
 include/media/v4l2-int-device.h       |    5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/media/video/v4l2-int-device.c b/drivers/media/video/v4l2-int-device.c
index f497c94..286b7f0 100644
--- a/drivers/media/video/v4l2-int-device.c
+++ b/drivers/media/video/v4l2-int-device.c
@@ -65,12 +65,12 @@ static void v4l2_int_device_try_attach_all(void)
 			if (!try_module_get(m->module))
 				continue;
 
-			if (m->u.master->attach(m, s)) {
+			s->u.slave->master = m;
+			if (m->u.master->attach(s)) {
+				s->u.slave->master = NULL;
 				module_put(m->module);
 				continue;
 			}
-
-			s->u.slave->master = m;
 		}
 	}
 }
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index 066ebfc..c8b80e0 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -44,9 +44,8 @@ enum v4l2_int_type {
 struct v4l2_int_device;
 
 struct v4l2_int_master {
-	int (*attach)(struct v4l2_int_device *master,
-		      struct v4l2_int_device *slave);
-	void (*detach)(struct v4l2_int_device *master);
+	int (*attach)(struct v4l2_int_device *slave);
+	void (*detach)(struct v4l2_int_device *slave);
 };
 
 typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *);
-- 
1.5.0.6

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

* [PATCH] ARM: OMAP2: Camera: Fix v4l2 int device detach
  2007-10-16 15:08 [PATCH] V4L: Int if: Set slave's master before attach, remove master argument Sakari Ailus
@ 2007-10-16 15:08 ` Sakari Ailus
  2007-10-31 12:50   ` Tony Lindgren
  2007-10-31 12:50 ` [PATCH] V4L: Int if: Set slave's master before attach, remove master argument Tony Lindgren
  1 sibling, 1 reply; 4+ messages in thread
From: Sakari Ailus @ 2007-10-16 15:08 UTC (permalink / raw)
  To: linux-omap-open-source

omap24xxcam_device_unregister expected the argument to be its own
device structure but it's actually that of its slave.

Also get master from slave's structure in omap24xxcam_device_register.

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 drivers/media/video/omap24xxcam.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
index 7da1668..8fda9e1 100644
--- a/drivers/media/video/omap24xxcam.c
+++ b/drivers/media/video/omap24xxcam.c
@@ -46,7 +46,7 @@
 
 static void omap24xxcam_reset(struct omap24xxcam_device *cam);
 static int omap24xxcam_sensor_if_enable(struct omap24xxcam_device *cam);
-static void omap24xxcam_device_unregister(struct v4l2_int_device *ctl);
+static void omap24xxcam_device_unregister(struct v4l2_int_device *s);
 static int omap24xxcam_remove(struct platform_device *pdev);
 
 /* module parameters */
@@ -1603,10 +1603,9 @@ static int omap24xxcam_resume(struct platform_device *pdev)
  *
  */
 
-static int omap24xxcam_device_register(struct v4l2_int_device *ctl,
-				       struct v4l2_int_device *s)
+static int omap24xxcam_device_register(struct v4l2_int_device *s)
 {
-	struct omap24xxcam_device *cam = ctl->priv;
+	struct omap24xxcam_device *cam = s->u.slave->master->priv;
 	struct video_device *vfd;
 	int rval;
 
@@ -1681,14 +1680,14 @@ static int omap24xxcam_device_register(struct v4l2_int_device *ctl,
 	return 0;
 
 err:
-	omap24xxcam_device_unregister(ctl);
+	omap24xxcam_device_unregister(s);
 
 	return rval;
 }
 
-static void omap24xxcam_device_unregister(struct v4l2_int_device *ctl)
+static void omap24xxcam_device_unregister(struct v4l2_int_device *s)
 {
-	struct omap24xxcam_device *cam = ctl->priv;
+	struct omap24xxcam_device *cam = s->u.slave->master->priv;
 
 	omap24xxcam_sensor_exit(cam);
 
-- 
1.5.0.6

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

* Re: [PATCH] V4L: Int if: Set slave's master before attach, remove master argument
  2007-10-16 15:08 [PATCH] V4L: Int if: Set slave's master before attach, remove master argument Sakari Ailus
  2007-10-16 15:08 ` [PATCH] ARM: OMAP2: Camera: Fix v4l2 int device detach Sakari Ailus
@ 2007-10-31 12:50 ` Tony Lindgren
  1 sibling, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2007-10-31 12:50 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-omap-open-source

* Sakari Ailus <sakari.ailus@nokia.com> [071016 08:17]:
> Set slave's master before master's attach call.
> 
> The master also now gets its own pointer from slave's structure.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
> ---
>  drivers/media/video/v4l2-int-device.c |    6 +++---
>  include/media/v4l2-int-device.h       |    5 ++---
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/video/v4l2-int-device.c b/drivers/media/video/v4l2-int-device.c
> index f497c94..286b7f0 100644
> --- a/drivers/media/video/v4l2-int-device.c
> +++ b/drivers/media/video/v4l2-int-device.c
> @@ -65,12 +65,12 @@ static void v4l2_int_device_try_attach_all(void)
>  			if (!try_module_get(m->module))
>  				continue;
>  
> -			if (m->u.master->attach(m, s)) {
> +			s->u.slave->master = m;
> +			if (m->u.master->attach(s)) {
> +				s->u.slave->master = NULL;
>  				module_put(m->module);
>  				continue;
>  			}
> -
> -			s->u.slave->master = m;
>  		}
>  	}
>  }
> diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
> index 066ebfc..c8b80e0 100644
> --- a/include/media/v4l2-int-device.h
> +++ b/include/media/v4l2-int-device.h
> @@ -44,9 +44,8 @@ enum v4l2_int_type {
>  struct v4l2_int_device;
>  
>  struct v4l2_int_master {
> -	int (*attach)(struct v4l2_int_device *master,
> -		      struct v4l2_int_device *slave);
> -	void (*detach)(struct v4l2_int_device *master);
> +	int (*attach)(struct v4l2_int_device *slave);
> +	void (*detach)(struct v4l2_int_device *slave);
>  };
>  
>  typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *);
> -- 
> 1.5.0.6
> 

Pushing today.

Tony

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

* Re: [PATCH] ARM: OMAP2: Camera: Fix v4l2 int device detach
  2007-10-16 15:08 ` [PATCH] ARM: OMAP2: Camera: Fix v4l2 int device detach Sakari Ailus
@ 2007-10-31 12:50   ` Tony Lindgren
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2007-10-31 12:50 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-omap-open-source

* Sakari Ailus <sakari.ailus@nokia.com> [071016 08:17]:
> omap24xxcam_device_unregister expected the argument to be its own
> device structure but it's actually that of its slave.
> 
> Also get master from slave's structure in omap24xxcam_device_register.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
> ---
>  drivers/media/video/omap24xxcam.c |   13 ++++++-------
>  1 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
> index 7da1668..8fda9e1 100644
> --- a/drivers/media/video/omap24xxcam.c
> +++ b/drivers/media/video/omap24xxcam.c
> @@ -46,7 +46,7 @@
>  
>  static void omap24xxcam_reset(struct omap24xxcam_device *cam);
>  static int omap24xxcam_sensor_if_enable(struct omap24xxcam_device *cam);
> -static void omap24xxcam_device_unregister(struct v4l2_int_device *ctl);
> +static void omap24xxcam_device_unregister(struct v4l2_int_device *s);
>  static int omap24xxcam_remove(struct platform_device *pdev);
>  
>  /* module parameters */
> @@ -1603,10 +1603,9 @@ static int omap24xxcam_resume(struct platform_device *pdev)
>   *
>   */
>  
> -static int omap24xxcam_device_register(struct v4l2_int_device *ctl,
> -				       struct v4l2_int_device *s)
> +static int omap24xxcam_device_register(struct v4l2_int_device *s)
>  {
> -	struct omap24xxcam_device *cam = ctl->priv;
> +	struct omap24xxcam_device *cam = s->u.slave->master->priv;
>  	struct video_device *vfd;
>  	int rval;
>  
> @@ -1681,14 +1680,14 @@ static int omap24xxcam_device_register(struct v4l2_int_device *ctl,
>  	return 0;
>  
>  err:
> -	omap24xxcam_device_unregister(ctl);
> +	omap24xxcam_device_unregister(s);
>  
>  	return rval;
>  }
>  
> -static void omap24xxcam_device_unregister(struct v4l2_int_device *ctl)
> +static void omap24xxcam_device_unregister(struct v4l2_int_device *s)
>  {
> -	struct omap24xxcam_device *cam = ctl->priv;
> +	struct omap24xxcam_device *cam = s->u.slave->master->priv;
>  
>  	omap24xxcam_sensor_exit(cam);
>  

Pushing today.

Tony

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

end of thread, other threads:[~2007-10-31 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-16 15:08 [PATCH] V4L: Int if: Set slave's master before attach, remove master argument Sakari Ailus
2007-10-16 15:08 ` [PATCH] ARM: OMAP2: Camera: Fix v4l2 int device detach Sakari Ailus
2007-10-31 12:50   ` Tony Lindgren
2007-10-31 12:50 ` [PATCH] V4L: Int if: Set slave's master before attach, remove master argument Tony Lindgren

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.