Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[safe/jmp/linux-2.6] / drivers / media / video / cx88 / cx88-video.c
index eea23f9..57e6b12 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/kmod.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
+#include <linux/smp_lock.h>
 #include <linux/interrupt.h>
 #include <linux/dma-mapping.h>
 #include <linux/delay.h>
 
 #include "cx88.h"
 #include <media/v4l2-common.h>
-
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
-/* Include V4L1 specific functions. Should be removed soon */
-#include <linux/videodev.h>
-#endif
+#include <media/v4l2-ioctl.h>
 
 MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -297,6 +294,7 @@ static struct cx88_ctrl cx8800_ctls[] = {
 };
 static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls);
 
+/* Must be sorted from low to high control ID! */
 const u32 cx88_user_ctrls[] = {
        V4L2_CID_USER_CLASS,
        V4L2_CID_BRIGHTNESS,
@@ -425,37 +423,27 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
 
        /* if there are audioroutes defined, we have an external
           ADC to deal with audio */
-
        if (INPUT(input).audioroute) {
-
+               /* The wm8775 module has the "2" route hardwired into
+                  the initialization. Some boards may use different
+                  routes for different inputs. HVR-1300 surely does */
+               if (core->board.audio_chip &&
+                   core->board.audio_chip == V4L2_IDENT_WM8775) {
+                       call_all(core, audio, s_routing,
+                                       INPUT(input).audioroute, 0, 0);
+               }
                /* cx2388's C-ADC is connected to the tuner only.
                   When used with S-Video, that ADC is busy dealing with
                   chroma, so an external must be used for baseband audio */
-
-               if (INPUT(input).type != CX88_VMUX_TELEVISION &&
-                       INPUT(input).type != CX88_RADIO) {
-                       /* "ADC mode" */
-                       cx_write(AUD_I2SCNTL, 0x1);
-                       cx_set(AUD_CTL, EN_I2SIN_ENABLE);
+               if (INPUT(input).type != CX88_VMUX_TELEVISION ) {
+                       /* "I2S ADC mode" */
+                       core->tvaudio = WW_I2SADC;
+                       cx88_set_tvaudio(core);
                } else {
                        /* Normal mode */
                        cx_write(AUD_I2SCNTL, 0x0);
                        cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
                }
-
-               /* The wm8775 module has the "2" route hardwired into
-                  the initialization. Some boards may use different
-                  routes for different inputs. HVR-1300 surely does */
-               if (core->board.audio_chip &&
-                   core->board.audio_chip == AUDIO_CHIP_WM8775) {
-                       struct v4l2_routing route;
-
-                       route.input = INPUT(input).audioroute;
-                       cx88_call_i2c_clients(core,
-                               VIDIOC_INT_S_AUDIO_ROUTING, &route);
-
-               }
-
        }
 
        return 0;
@@ -763,15 +751,16 @@ static int get_ressource(struct cx8800_fh *fh)
        }
 }
 
-static int video_open(struct inode *inode, struct file *file)
+static int video_open(struct file *file)
 {
-       int minor = iminor(inode);
+       int minor = video_devdata(file)->minor;
        struct cx8800_dev *h,*dev = NULL;
        struct cx88_core *core;
        struct cx8800_fh *fh;
        enum v4l2_buf_type type = 0;
        int radio = 0;
 
+       lock_kernel();
        list_for_each_entry(h, &cx8800_devlist, devlist) {
                if (h->video_dev->minor == minor) {
                        dev  = h;
@@ -787,8 +776,10 @@ static int video_open(struct inode *inode, struct file *file)
                        dev   = h;
                }
        }
-       if (NULL == dev)
+       if (NULL == dev) {
+               unlock_kernel();
                return -ENODEV;
+       }
 
        core = dev->core;
 
@@ -797,8 +788,10 @@ static int video_open(struct inode *inode, struct file *file)
 
        /* allocate + initialize per filehandle data */
        fh = kzalloc(sizeof(*fh),GFP_KERNEL);
-       if (NULL == fh)
+       if (NULL == fh) {
+               unlock_kernel();
                return -ENOMEM;
+       }
        file->private_data = fh;
        fh->dev      = dev;
        fh->radio    = radio;
@@ -826,11 +819,26 @@ static int video_open(struct inode *inode, struct file *file)
                cx_write(MO_GP0_IO, core->board.radio.gpio0);
                cx_write(MO_GP1_IO, core->board.radio.gpio1);
                cx_write(MO_GP2_IO, core->board.radio.gpio2);
-               core->tvaudio = WW_FM;
-               cx88_set_tvaudio(core);
-               cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
-               cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL);
+               if (core->board.radio.audioroute) {
+                       if(core->board.audio_chip &&
+                               core->board.audio_chip == V4L2_IDENT_WM8775) {
+                               call_all(core, audio, s_routing,
+                                       core->board.radio.audioroute, 0, 0);
+                       }
+                       /* "I2S ADC mode" */
+                       core->tvaudio = WW_I2SADC;
+                       cx88_set_tvaudio(core);
+               } else {
+                       /* FM Mode */
+                       core->tvaudio = WW_FM;
+                       cx88_set_tvaudio(core);
+                       cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
+               }
+               call_all(core, tuner, s_radio);
        }
+       unlock_kernel();
+
+       atomic_inc(&core->users);
 
        return 0;
 }
@@ -862,6 +870,7 @@ video_poll(struct file *file, struct poll_table_struct *wait)
 {
        struct cx8800_fh *fh = file->private_data;
        struct cx88_buffer *buf;
+       unsigned int rc = POLLERR;
 
        if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
                if (!res_get(fh->dev,fh,RESOURCE_VBI))
@@ -869,25 +878,30 @@ video_poll(struct file *file, struct poll_table_struct *wait)
                return videobuf_poll_stream(file, &fh->vbiq, wait);
        }
 
+       mutex_lock(&fh->vidq.vb_lock);
        if (res_check(fh,RESOURCE_VIDEO)) {
                /* streaming capture */
                if (list_empty(&fh->vidq.stream))
-                       return POLLERR;
+                       goto done;
                buf = list_entry(fh->vidq.stream.next,struct cx88_buffer,vb.stream);
        } else {
                /* read() capture */
                buf = (struct cx88_buffer*)fh->vidq.read_buf;
                if (NULL == buf)
-                       return POLLERR;
+                       goto done;
        }
        poll_wait(file, &buf->vb.done, wait);
        if (buf->vb.state == VIDEOBUF_DONE ||
            buf->vb.state == VIDEOBUF_ERROR)
-               return POLLIN|POLLRDNORM;
-       return 0;
+               rc = POLLIN|POLLRDNORM;
+       else
+               rc = 0;
+done:
+       mutex_unlock(&fh->vidq.vb_lock);
+       return rc;
 }
 
-static int video_release(struct inode *inode, struct file *file)
+static int video_release(struct file *file)
 {
        struct cx8800_fh  *fh  = file->private_data;
        struct cx8800_dev *dev = fh->dev;
@@ -919,7 +933,10 @@ static int video_release(struct inode *inode, struct file *file)
        file->private_data = NULL;
        kfree(fh);
 
-       cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
+       mutex_lock(&dev->core->lock);
+       if(atomic_dec_and_test(&dev->core->users))
+               call_all(dev->core, tuner, s_standby);
+       mutex_unlock(&dev->core->lock);
 
        return 0;
 }
@@ -1045,7 +1062,7 @@ static void init_controls(struct cx88_core *core)
 /* ------------------------------------------------------------------ */
 /* VIDEO IOCTLS                                                       */
 
-static int vidioc_g_fmt_cap (struct file *file, void *priv,
+static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
                                        struct v4l2_format *f)
 {
        struct cx8800_fh  *fh   = priv;
@@ -1061,7 +1078,7 @@ static int vidioc_g_fmt_cap (struct file *file, void *priv,
        return 0;
 }
 
-static int vidioc_try_fmt_cap (struct file *file, void *priv,
+static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
                        struct v4l2_format *f)
 {
        struct cx88_core  *core = ((struct cx8800_fh *)priv)->dev->core;
@@ -1095,15 +1112,8 @@ static int vidioc_try_fmt_cap (struct file *file, void *priv,
        }
 
        f->fmt.pix.field = field;
-       if (f->fmt.pix.height < 32)
-               f->fmt.pix.height = 32;
-       if (f->fmt.pix.height > maxh)
-               f->fmt.pix.height = maxh;
-       if (f->fmt.pix.width < 48)
-               f->fmt.pix.width = 48;
-       if (f->fmt.pix.width > maxw)
-               f->fmt.pix.width = maxw;
-       f->fmt.pix.width &= ~0x03;
+       v4l_bound_align_image(&f->fmt.pix.width, 48, maxw, 2,
+                             &f->fmt.pix.height, 32, maxh, 0, 0);
        f->fmt.pix.bytesperline =
                (f->fmt.pix.width * fmt->depth) >> 3;
        f->fmt.pix.sizeimage =
@@ -1112,11 +1122,11 @@ static int vidioc_try_fmt_cap (struct file *file, void *priv,
        return 0;
 }
 
-static int vidioc_s_fmt_cap (struct file *file, void *priv,
+static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
                                        struct v4l2_format *f)
 {
        struct cx8800_fh  *fh   = priv;
-       int err = vidioc_try_fmt_cap (file,priv,f);
+       int err = vidioc_try_fmt_vid_cap (file,priv,f);
 
        if (0 != err)
                return err;
@@ -1147,7 +1157,7 @@ static int vidioc_querycap (struct file *file, void  *priv,
        return 0;
 }
 
-static int vidioc_enum_fmt_cap (struct file *file, void  *priv,
+static int vidioc_enum_fmt_vid_cap (struct file *file, void  *priv,
                                        struct v4l2_fmtdesc *f)
 {
        if (unlikely(f->index >= ARRAY_SIZE(formats)))
@@ -1198,8 +1208,12 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
        struct cx8800_fh  *fh   = priv;
        struct cx8800_dev *dev  = fh->dev;
 
-       if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE))
+       /* We should remember that this driver also supports teletext,  */
+       /* so we have to test if the v4l2_buf_type is VBI capture data. */
+       if (unlikely((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
+                    (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE)))
                return -EINVAL;
+
        if (unlikely(i != fh->type))
                return -EINVAL;
 
@@ -1214,8 +1228,10 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
        struct cx8800_dev *dev  = fh->dev;
        int               err, res;
 
-       if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+       if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
+           (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
                return -EINVAL;
+
        if (i != fh->type)
                return -EINVAL;
 
@@ -1252,15 +1268,12 @@ int cx88_enum_input (struct cx88_core  *core,struct v4l2_input *i)
                [ CX88_VMUX_DVB        ] = "DVB",
                [ CX88_VMUX_DEBUG      ] = "for debug only",
        };
-       unsigned int n;
+       unsigned int n = i->index;
 
-       n = i->index;
        if (n >= 4)
                return -EINVAL;
        if (0 == INPUT(n).type)
                return -EINVAL;
-       memset(i,0,sizeof(*i));
-       i->index = n;
        i->type  = V4L2_INPUT_TYPE_CAMERA;
        strcpy(i->name,iname[INPUT(n).type]);
        if ((CX88_VMUX_TELEVISION == INPUT(n).type) ||
@@ -1378,7 +1391,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
        f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
        f->frequency = core->freq;
 
-       cx88_call_i2c_clients(core,VIDIOC_G_FREQUENCY,f);
+       call_all(core, tuner, g_frequency, f);
 
        return 0;
 }
@@ -1394,7 +1407,7 @@ int cx88_set_freq (struct cx88_core  *core,
        mutex_lock(&core->lock);
        core->freq = f->frequency;
        cx88_newstation(core);
-       cx88_call_i2c_clients(core,VIDIOC_S_FREQUENCY,f);
+       call_all(core, tuner, s_frequency, f);
 
        /* When changing channels it is required to reset TVAUDIO */
        msleep (10);
@@ -1423,25 +1436,26 @@ static int vidioc_s_frequency (struct file *file, void *priv,
 
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static int vidioc_g_register (struct file *file, void *fh,
-                               struct v4l2_register *reg)
+                               struct v4l2_dbg_register *reg)
 {
        struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
 
-       if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
+       if (!v4l2_chip_match_host(&reg->match))
                return -EINVAL;
        /* cx2388x has a 24-bit register space */
-       reg->val = cx_read(reg->reg&0xffffff);
+       reg->val = cx_read(reg->reg & 0xffffff);
+       reg->size = 4;
        return 0;
 }
 
 static int vidioc_s_register (struct file *file, void *fh,
-                               struct v4l2_register *reg)
+                               struct v4l2_dbg_register *reg)
 {
        struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
 
-       if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
+       if (!v4l2_chip_match_host(&reg->match))
                return -EINVAL;
-       cx_write(reg->reg&0xffffff, reg->val);
+       cx_write(reg->reg & 0xffffff, reg->val);
        return 0;
 }
 #endif
@@ -1475,7 +1489,7 @@ static int radio_g_tuner (struct file *file, void *priv,
        strcpy(t->name, "Radio");
        t->type = V4L2_TUNER_RADIO;
 
-       cx88_call_i2c_clients(core,VIDIOC_G_TUNER,t);
+       call_all(core, tuner, g_tuner, t);
        return 0;
 }
 
@@ -1495,7 +1509,6 @@ static int radio_g_audio (struct file *file, void *priv, struct v4l2_audio *a)
        if (unlikely(a->index))
                return -EINVAL;
 
-       memset(a,0,sizeof(*a));
        strcpy(a->name,"Radio");
        return 0;
 }
@@ -1510,7 +1523,7 @@ static int radio_s_tuner (struct file *file, void *priv,
        if (0 != t->index)
                return -EINVAL;
 
-       cx88_call_i2c_clients(core,VIDIOC_S_TUNER,t);
+       call_all(core, tuner, s_tuner, t);
 
        return 0;
 }
@@ -1669,7 +1682,7 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id)
 /* ----------------------------------------------------------- */
 /* exported stuff                                              */
 
-static const struct file_operations video_fops =
+static const struct v4l2_file_operations video_fops =
 {
        .owner         = THIS_MODULE,
        .open          = video_open,
@@ -1678,25 +1691,17 @@ static const struct file_operations video_fops =
        .poll          = video_poll,
        .mmap          = video_mmap,
        .ioctl         = video_ioctl2,
-       .compat_ioctl  = v4l_compat_ioctl32,
-       .llseek        = no_llseek,
 };
 
-static struct video_device cx8800_vbi_template;
-static struct video_device cx8800_video_template =
-{
-       .name                 = "cx8800-video",
-       .type                 = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES,
-       .fops                 = &video_fops,
-       .minor                = -1,
+static const struct v4l2_ioctl_ops video_ioctl_ops = {
        .vidioc_querycap      = vidioc_querycap,
-       .vidioc_enum_fmt_cap  = vidioc_enum_fmt_cap,
-       .vidioc_g_fmt_cap     = vidioc_g_fmt_cap,
-       .vidioc_try_fmt_cap   = vidioc_try_fmt_cap,
-       .vidioc_s_fmt_cap     = vidioc_s_fmt_cap,
-       .vidioc_g_fmt_vbi     = cx8800_vbi_fmt,
-       .vidioc_try_fmt_vbi   = cx8800_vbi_fmt,
-       .vidioc_s_fmt_vbi     = cx8800_vbi_fmt,
+       .vidioc_enum_fmt_vid_cap  = vidioc_enum_fmt_vid_cap,
+       .vidioc_g_fmt_vid_cap     = vidioc_g_fmt_vid_cap,
+       .vidioc_try_fmt_vid_cap   = vidioc_try_fmt_vid_cap,
+       .vidioc_s_fmt_vid_cap     = vidioc_s_fmt_vid_cap,
+       .vidioc_g_fmt_vbi_cap     = cx8800_vbi_fmt,
+       .vidioc_try_fmt_vbi_cap   = cx8800_vbi_fmt,
+       .vidioc_s_fmt_vbi_cap     = cx8800_vbi_fmt,
        .vidioc_reqbufs       = vidioc_reqbufs,
        .vidioc_querybuf      = vidioc_querybuf,
        .vidioc_qbuf          = vidioc_qbuf,
@@ -1721,26 +1726,28 @@ static struct video_device cx8800_video_template =
        .vidioc_g_register    = vidioc_g_register,
        .vidioc_s_register    = vidioc_s_register,
 #endif
+};
+
+static struct video_device cx8800_vbi_template;
+
+static struct video_device cx8800_video_template = {
+       .name                 = "cx8800-video",
+       .fops                 = &video_fops,
+       .minor                = -1,
+       .ioctl_ops            = &video_ioctl_ops,
        .tvnorms              = CX88_NORMS,
        .current_norm         = V4L2_STD_NTSC_M,
 };
 
-static const struct file_operations radio_fops =
+static const struct v4l2_file_operations radio_fops =
 {
        .owner         = THIS_MODULE,
        .open          = video_open,
        .release       = video_release,
        .ioctl         = video_ioctl2,
-       .compat_ioctl  = v4l_compat_ioctl32,
-       .llseek        = no_llseek,
 };
 
-static struct video_device cx8800_radio_template =
-{
-       .name                 = "cx8800-radio",
-       .type                 = VID_TYPE_TUNER,
-       .fops                 = &radio_fops,
-       .minor                = -1,
+static const struct v4l2_ioctl_ops radio_ioctl_ops = {
        .vidioc_querycap      = radio_querycap,
        .vidioc_g_tuner       = radio_g_tuner,
        .vidioc_enum_input    = radio_enum_input,
@@ -1759,6 +1766,13 @@ static struct video_device cx8800_radio_template =
 #endif
 };
 
+static struct video_device cx8800_radio_template = {
+       .name                 = "cx8800-radio",
+       .fops                 = &radio_fops,
+       .minor                = -1,
+       .ioctl_ops            = &radio_ioctl_ops,
+};
+
 /* ----------------------------------------------------------- */
 
 static void cx8800_unregister_video(struct cx8800_dev *dev)
@@ -1820,7 +1834,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
               dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
 
        pci_set_master(pci_dev);
-       if (!pci_dma_supported(pci_dev,DMA_32BIT_MASK)) {
+       if (!pci_dma_supported(pci_dev,DMA_BIT_MASK(32))) {
                printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name);
                err = -EIO;
                goto fail_core;
@@ -1830,7 +1844,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
        memcpy( &cx8800_vbi_template, &cx8800_video_template,
                sizeof(cx8800_vbi_template) );
        strcpy(cx8800_vbi_template.name,"cx8800-vbi");
-       cx8800_vbi_template.type = VID_TYPE_TELETEXT|VID_TYPE_TUNER;
 
        /* initialize driver struct */
        spin_lock_init(&dev->slock);
@@ -1866,13 +1879,28 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
 
        /* load and configure helper modules */
 
-       if (core->board.audio_chip == AUDIO_CHIP_WM8775)
-               request_module("wm8775");
+       if (core->board.audio_chip == V4L2_IDENT_WM8775)
+               v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
+                               "wm8775", "wm8775", 0x36 >> 1, NULL);
+
+       if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) {
+               /* This probes for a tda9874 as is used on some
+                  Pixelview Ultra boards. */
+               v4l2_i2c_new_subdev(&core->v4l2_dev,
+                               &core->i2c_adap,
+                               "tvaudio", "tvaudio", 0, I2C_ADDRS(0xb0 >> 1));
+       }
 
        switch (core->boardnr) {
        case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
-       case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
+       case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: {
+               static struct i2c_board_info rtc_info = {
+                       I2C_BOARD_INFO("isl1208", 0x6f)
+               };
+
                request_module("rtc-isl1208");
+               core->i2c_rtc = i2c_new_device(&core->i2c_adap, &rtc_info);
+       }
                /* break intentionally omitted */
        case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
                request_module("ir-kbd-i2c");
@@ -1889,7 +1917,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
                goto fail_unreg;
        }
        printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n",
-              core->name,dev->video_dev->minor & 0x1f);
+              core->name, dev->video_dev->num);
 
        dev->vbi_dev = cx88_vdev_init(core,dev->pci,&cx8800_vbi_template,"vbi");
        err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI,
@@ -1900,7 +1928,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
                goto fail_unreg;
        }
        printk(KERN_INFO "%s/0: registered device vbi%d\n",
-              core->name,dev->vbi_dev->minor & 0x1f);
+              core->name, dev->vbi_dev->num);
 
        if (core->board.radio.type == CX88_RADIO) {
                dev->radio_dev = cx88_vdev_init(core,dev->pci,
@@ -1913,7 +1941,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
                        goto fail_unreg;
                }
                printk(KERN_INFO "%s/0: registered device radio%d\n",
-                      core->name,dev->radio_dev->minor & 0x1f);
+                      core->name, dev->radio_dev->num);
        }
 
        /* everything worked */
@@ -2085,7 +2113,7 @@ static struct pci_driver cx8800_pci_driver = {
 #endif
 };
 
-static int cx8800_init(void)
+static int __init cx8800_init(void)
 {
        printk(KERN_INFO "cx88/0: cx2388x v4l2 driver version %d.%d.%d loaded\n",
               (CX88_VERSION_CODE >> 16) & 0xff,
@@ -2098,7 +2126,7 @@ static int cx8800_init(void)
        return pci_register_driver(&cx8800_pci_driver);
 }
 
-static void cx8800_fini(void)
+static void __exit cx8800_fini(void)
 {
        pci_unregister_driver(&cx8800_pci_driver);
 }