V4L/DVB (12853): tm6000: Fix almost all warnings at the driver
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 14 Sep 2009 20:16:32 +0000 (17:16 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:40:25 +0000 (00:40 -0300)
Onr warning is left, since it is there for a purpose:
tm6000-core.c:218: warning: ISO C90 forbids mixed declarations and code

It indicates a place where a temporary hack were added. Tests are needed to be sure that
we can remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/tm6000/tm6000-cards.c
drivers/staging/tm6000/tm6000-i2c.c
drivers/staging/tm6000/tm6000-video.c

index 29029685962085e1f5edd6ac12681c7d9fabd41a..f848840c8a859b6ca1e9cd1f2cdb3020329d761f 100644 (file)
@@ -191,6 +191,61 @@ struct usb_device_id tm6000_id_table [] = {
        { },
 };
 
+/* Tuner callback to provide the proper gpio changes needed for xc2028 */
+
+static int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
+{
+       int rc=0;
+       struct tm6000_core *dev = ptr;
+
+       if (dev->tuner_type!=TUNER_XC2028)
+               return 0;
+
+       switch (command) {
+       case XC2028_RESET_CLK:
+               tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
+                                       0x02, arg);
+               msleep(10);
+               rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+                                       TM6000_GPIO_CLK, 0);
+               if (rc<0)
+                       return rc;
+               msleep(10);
+               rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+                                       TM6000_GPIO_CLK, 1);
+               break;
+       case XC2028_TUNER_RESET:
+               /* Reset codes during load firmware */
+               switch (arg) {
+               case 0:
+                       tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+                                       dev->tuner_reset_gpio, 0x00);
+                       msleep(130);
+                       tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+                                       dev->tuner_reset_gpio, 0x01);
+                       msleep(130);
+                       break;
+               case 1:
+                       tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
+                                               0x02, 0x01);
+                       msleep(10);
+                       break;
+
+               case 2:
+                       rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+                                               TM6000_GPIO_CLK, 0);
+                       if (rc<0)
+                               return rc;
+                       msleep(100);
+                       rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+                                               TM6000_GPIO_CLK, 1);
+                       msleep(100);
+                       break;
+               }
+       }
+       return (rc);
+}
+
 static void tm6000_config_tuner (struct tm6000_core *dev)
 {
        struct tuner_setup           tun_setup;
@@ -202,6 +257,8 @@ static void tm6000_config_tuner (struct tm6000_core *dev)
        memset(&tun_setup, 0, sizeof(tun_setup));
        tun_setup.type   = dev->tuner_type;
        tun_setup.addr   = dev->tuner_addr;
+       tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
+       tun_setup.tuner_callback = tm6000_tuner_callback;
 
        v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
 
index e9ad516175611cc995b59c5063da5c609e24b001..7a296ec82278f7cae43ad42a8a97174dc270755c 100644 (file)
@@ -203,62 +203,6 @@ static void dec_use(struct i2c_adapter *adap)
        msleep (10);                                                    \
        }
 
-/* Tuner callback to provide the proper gpio changes needed for xc2028 */
-
-static int tm6000_tuner_callback(void *ptr, int command, int arg)
-{
-       int rc=0;
-       struct tm6000_core *dev = ptr;
-
-       if (dev->tuner_type!=TUNER_XC2028)
-               return 0;
-
-       switch (command) {
-       case XC2028_RESET_CLK:
-               tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
-                                       0x02, arg);
-               msleep(10);
-               rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
-                                       TM6000_GPIO_CLK, 0);
-               if (rc<0)
-                       return rc;
-               msleep(10);
-               rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
-                                       TM6000_GPIO_CLK, 1);
-               break;
-       case XC2028_TUNER_RESET:
-               /* Reset codes during load firmware */
-               switch (arg) {
-               case 0:
-                       tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
-                                       dev->tuner_reset_gpio, 0x00);
-                       msleep(130);
-                       tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
-                                       dev->tuner_reset_gpio, 0x01);
-                       msleep(130);
-                       break;
-               case 1:
-                       tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
-                                               0x02, 0x01);
-                       msleep(10);
-                       break;
-
-               case 2:
-                       rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
-                                               TM6000_GPIO_CLK, 0);
-                       if (rc<0)
-                               return rc;
-                       msleep(100);
-                       rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
-                                               TM6000_GPIO_CLK, 1);
-                       msleep(100);
-                       break;
-               }
-       }
-       return (rc);
-}
-
-
 static struct i2c_algorithm tm6000_algo = {
        .master_xfer   = tm6000_i2c_xfer,
        .functionality = functionality,
index 8e93eb0bc8f695427835386466aabfecc99b3eab..fc5a9089ab6874dba13f58617767959423b4a0d9 100644 (file)
@@ -1299,7 +1299,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
 
 //     mutex_lock(&dev->lock);
        dev->freq = f->frequency;
-       v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
+       v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f);
 //     mutex_unlock(&dev->lock);
 
        return 0;
@@ -1309,9 +1309,9 @@ static int vidioc_s_frequency (struct file *file, void *priv,
        File operations for the device
    ------------------------------------------------------------------*/
 
-static int tm6000_open(struct inode *inode, struct file *file)
+static int tm6000_open(struct file *file)
 {
-       int minor = iminor(inode);
+       int minor = video_devdata(file)->minor;
        struct tm6000_core *h,*dev = NULL;
        struct tm6000_fh *fh;
        struct list_head *list;
@@ -1432,11 +1432,11 @@ tm6000_poll(struct file *file, struct poll_table_struct *wait)
        return 0;
 }
 
-static int tm6000_release(struct inode *inode, struct file *file)
+static int tm6000_release(struct file *file)
 {
        struct tm6000_fh         *fh = file->private_data;
        struct tm6000_core      *dev = fh->dev;
-       int minor = iminor(inode);
+       int minor = video_devdata(file)->minor;
 
        dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users);
 
@@ -1462,7 +1462,7 @@ static int tm6000_mmap(struct file *file, struct vm_area_struct * vma)
        return ret;
 }
 
-static struct file_operations tm6000_fops = {
+static struct v4l2_file_operations tm6000_fops = {
        .owner          = THIS_MODULE,
        .open           = tm6000_open,
        .release        = tm6000_release,
@@ -1470,7 +1470,6 @@ static struct file_operations tm6000_fops = {
        .read           = tm6000_read,
        .poll           = tm6000_poll,
        .mmap           = tm6000_mmap,
-       .llseek         = no_llseek,
 };
 
 static const struct v4l2_ioctl_ops video_ioctl_ops = {