Re: patch[bttv7-20031024;0.7.109pre]: snapshot oopses in bttvp.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



>  struct bttv {
> -       struct bttv_core c;
> -
> +       // FIXME:  some code silently assumes "&btv == &btv->video_dev", so
> +       // this struct has to start with "video_dev" ! else: oopses.
> +       // (e.g. see bttv_open vs. init_video_dev)
>         struct video_device video_dev;

Good catch, thanks.  The patch below fixes bttv_(open|close) to not
assume that any more.  Untested, but obviously correct :) 

  Gerd

--- bttv-0.7.108/driver/bttv-driver.c~	Thu Oct 16 12:42:36 2003
+++ bttv-0.7.108/driver/bttv-driver.c	Tue Nov  4 09:42:01 2003
@@ -1498,7 +1498,7 @@
 
 static int bttv_open(struct video_device *dev, int flags)
 {
-	struct bttv *btv = (struct bttv *)dev;
+	struct bttv *btv = container_of(dev, struct bttv, video_dev);
         unsigned int i;
 	int ret;
 
@@ -1536,7 +1536,7 @@
 
 static void bttv_close(struct video_device *dev)
 {
-	struct bttv *btv=(struct bttv *)dev;
+	struct bttv *btv = container_of(dev, struct bttv, video_dev);
  	unsigned long irq_flags;
 	int need_wait;
 




[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux