]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/media/video/tuner-core.c
V4L/DVB (6471): tuner: i2c_client cannot be part of the tuner struct
[mirror_ubuntu-artful-kernel.git] / drivers / media / video / tuner-core.c
index 94843086cda90f41f32e2b876b23b0e63908abb9..41ff4d2604af91a7b51d91a3684f9ca756699d4a 100644 (file)
 #include "tda8290.h"
 #include "tea5761.h"
 #include "tea5767.h"
+#include "tuner-xc2028.h"
 #include "tuner-simple.h"
+#include "tda9887.h"
 
 #define UNSET (-1U)
 
 /* standard i2c insmod options */
 static unsigned short normal_i2c[] = {
-#ifdef CONFIG_TUNER_TEA5761
+#if defined(CONFIG_TUNER_TEA5761) || (defined(CONFIG_TUNER_TEA5761_MODULE) && defined(MODULE))
        0x10,
 #endif
        0x42, 0x43, 0x4a, 0x4b,                 /* tda8290 */
@@ -76,9 +78,10 @@ static struct i2c_client client_template;
 
 /* ---------------------------------------------------------------------- */
 
-static void fe_set_freq(struct tuner *t, unsigned int freq)
+static void fe_set_freq(struct dvb_frontend *fe, unsigned int freq)
 {
-       struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
+       struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops;
+       struct tuner *t = fe->analog_demod_priv;
 
        struct analog_parameters params = {
                .frequency = freq,
@@ -91,46 +94,67 @@ static void fe_set_freq(struct tuner *t, unsigned int freq)
                tuner_warn("Tuner frontend module has no way to set freq\n");
                return;
        }
-       fe_tuner_ops->set_analog_params(&t->fe, &params);
+       fe_tuner_ops->set_analog_params(fe, &params);
 }
 
-static void fe_release(struct tuner *t)
+static void fe_release(struct dvb_frontend *fe)
 {
-       struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
-
-       if (fe_tuner_ops->release)
-               fe_tuner_ops->release(&t->fe);
+       if (fe->ops.tuner_ops.release)
+               fe->ops.tuner_ops.release(fe);
+
+       fe->ops.analog_demod_ops = NULL;
+
+       /* DO NOT kfree(fe->analog_demod_priv)
+        *
+        * If we are in this function, analog_demod_priv contains a pointer
+        * to struct tuner *t.  This will be kfree'd in tuner_detach().
+        *
+        * Otherwise, fe->ops.analog_demod_ops->release will
+        * handle the cleanup for analog demodulator modules.
+        */
+       fe->analog_demod_priv = NULL;
 }
 
-static void fe_standby(struct tuner *t)
+static void fe_standby(struct dvb_frontend *fe)
 {
-       struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
+       struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops;
 
        if (fe_tuner_ops->sleep)
-               fe_tuner_ops->sleep(&t->fe);
+               fe_tuner_ops->sleep(fe);
 }
 
-static int fe_has_signal(struct tuner *t)
+static int fe_has_signal(struct dvb_frontend *fe)
 {
-       struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
-       u16 strength;
+       u16 strength = 0;
 
-       if (fe_tuner_ops->get_rf_strength)
-               fe_tuner_ops->get_rf_strength(&t->fe, &strength);
+       if (fe->ops.tuner_ops.get_rf_strength)
+               fe->ops.tuner_ops.get_rf_strength(fe, &strength);
 
        return strength;
 }
 
+static void tuner_status(struct dvb_frontend *fe);
+
+static struct analog_tuner_ops tuner_core_ops = {
+       .set_tv_freq    = fe_set_freq,
+       .set_radio_freq = fe_set_freq,
+       .standby        = fe_standby,
+       .release        = fe_release,
+       .has_signal     = fe_has_signal,
+       .tuner_status   = tuner_status
+};
+
 /* Set tuner frequency,  freq in Units of 62.5kHz = 1/16MHz */
 static void set_tv_freq(struct i2c_client *c, unsigned int freq)
 {
        struct tuner *t = i2c_get_clientdata(c);
+       struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
 
        if (t->type == UNSET) {
                tuner_warn ("tuner type not set\n");
                return;
        }
-       if (NULL == t->ops.set_tv_freq) {
+       if ((NULL == ops) || (NULL == ops->set_tv_freq)) {
                tuner_warn ("Tuner has no way to set tv freq\n");
                return;
        }
@@ -145,18 +169,19 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
                else
                        freq = tv_range[1] * 16;
        }
-       t->ops.set_tv_freq(t, freq);
+       ops->set_tv_freq(&t->fe, freq);
 }
 
 static void set_radio_freq(struct i2c_client *c, unsigned int freq)
 {
        struct tuner *t = i2c_get_clientdata(c);
+       struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
 
        if (t->type == UNSET) {
                tuner_warn ("tuner type not set\n");
                return;
        }
-       if (NULL == t->ops.set_radio_freq) {
+       if ((NULL == ops) || (NULL == ops->set_radio_freq)) {
                tuner_warn ("tuner has no way to set radio frequency\n");
                return;
        }
@@ -172,7 +197,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
                        freq = radio_range[1] * 16000;
        }
 
-       t->ops.set_radio_freq(t, freq);
+       ops->set_radio_freq(&t->fe, freq);
 }
 
 static void set_freq(struct i2c_client *c, unsigned long freq)
@@ -193,46 +218,39 @@ static void set_freq(struct i2c_client *c, unsigned long freq)
                set_tv_freq(c, freq);
                t->tv_freq = freq;
                break;
+       default:
+               tuner_dbg("freq set: unknown mode: 0x%04x!\n",t->mode);
        }
 }
 
 static void tuner_i2c_address_check(struct tuner *t)
 {
        if ((t->type == UNSET || t->type == TUNER_ABSENT) ||
-           ((t->i2c.addr < 0x64) || (t->i2c.addr > 0x6f)))
+           ((t->i2c->addr < 0x64) || (t->i2c->addr > 0x6f)))
                return;
 
        tuner_warn("====================== WARNING! ======================\n");
        tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n");
        tuner_warn("will soon be dropped. This message indicates that your\n");
        tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n",
-                  t->i2c.name, t->i2c.addr);
+                  t->i2c->name, t->i2c->addr);
        tuner_warn("To ensure continued support for your device, please\n");
        tuner_warn("send a copy of this message, along with full dmesg\n");
        tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n");
        tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n");
        tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n",
-                  t->i2c.adapter->name, t->i2c.addr, t->type,
+                  t->i2c->adapter->name, t->i2c->addr, t->type,
                   tuners[t->type].name);
        tuner_warn("====================== WARNING! ======================\n");
 }
 
-static void attach_tda8290(struct tuner *t)
-{
-       struct tda8290_config cfg = {
-               .lna_cfg        = &t->config,
-               .tuner_callback = t->tuner_callback
-       };
-       tda8290_attach(&t->fe, t->i2c.adapter, t->i2c.addr, &cfg);
-}
-
 static void attach_simple_tuner(struct tuner *t)
 {
        struct simple_tuner_config cfg = {
                .type = t->type,
                .tun  = &tuners[t->type]
        };
-       simple_tuner_attach(&t->fe, t->i2c.adapter, t->i2c.addr, &cfg);
+       simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg);
 }
 
 static void set_type(struct i2c_client *c, unsigned int type,
@@ -241,6 +259,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
 {
        struct tuner *t = i2c_get_clientdata(c);
        struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
+       struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
        unsigned char buffer[4];
 
        if (type == UNSET || type == TUNER_ABSENT) {
@@ -268,40 +287,34 @@ static void set_type(struct i2c_client *c, unsigned int type,
        }
 
        /* discard private data, in case set_type() was previously called */
-       if (t->ops.release)
-               t->ops.release(t);
-       else {
-               kfree(t->priv);
-               t->priv = NULL;
-       }
+       if (ops && ops->release)
+               ops->release(&t->fe);
 
        switch (t->type) {
        case TUNER_MT2032:
-               microtune_attach(&t->fe, t->i2c.adapter, t->i2c.addr);
+               microtune_attach(&t->fe, t->i2c->adapter, t->i2c->addr);
                break;
        case TUNER_PHILIPS_TDA8290:
        {
-               attach_tda8290(t);
+               tda829x_attach(t);
                break;
        }
        case TUNER_TEA5767:
-               if (tea5767_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) {
+               if (tea5767_attach(&t->fe, t->i2c->adapter, t->i2c->addr) == NULL) {
                        t->type = TUNER_ABSENT;
                        t->mode_mask = T_UNINITIALIZED;
                        return;
                }
                t->mode_mask = T_RADIO;
                break;
-#ifdef CONFIG_TUNER_TEA5761
        case TUNER_TEA5761:
-               if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) {
+               if (tea5761_attach(&t->fe, t->i2c->adapter, t->i2c->addr) == NULL) {
                        t->type = TUNER_ABSENT;
                        t->mode_mask = T_UNINITIALIZED;
                        return;
                }
                t->mode_mask = T_RADIO;
                break;
-#endif
        case TUNER_PHILIPS_FMD1216ME_MK3:
                buffer[0] = 0x0b;
                buffer[1] = 0xdc;
@@ -323,24 +336,26 @@ static void set_type(struct i2c_client *c, unsigned int type,
                attach_simple_tuner(t);
                break;
        case TUNER_TDA9887:
-               tda9887_tuner_init(t);
+               tda9887_attach(t);
                break;
        default:
                attach_simple_tuner(t);
                break;
        }
 
-       if (fe_tuner_ops->set_analog_params) {
-               strlcpy(t->i2c.name, fe_tuner_ops->info.name, sizeof(t->i2c.name));
+       ops = t->fe.ops.analog_demod_ops;
+
+       if (((NULL == ops) ||
+            ((NULL == ops->set_tv_freq) && (NULL == ops->set_radio_freq))) &&
+           (fe_tuner_ops->set_analog_params)) {
+               strlcpy(t->i2c->name, fe_tuner_ops->info.name,
+                       sizeof(t->i2c->name));
 
-               t->ops.set_tv_freq    = fe_set_freq;
-               t->ops.set_radio_freq = fe_set_freq;
-               t->ops.standby        = fe_standby;
-               t->ops.release        = fe_release;
-               t->ops.has_signal     = fe_has_signal;
+               t->fe.ops.analog_demod_ops = &tuner_core_ops;
+               t->fe.analog_demod_priv = t;
        }
 
-       tuner_info("type set to %s\n", t->i2c.name);
+       tuner_info("type set to %s\n", t->i2c->name);
 
        if (t->mode_mask == T_UNINITIALIZED)
                t->mode_mask = new_mode_mask;
@@ -510,10 +525,12 @@ static int tuner_fixup_std(struct tuner *t)
        return 0;
 }
 
-static void tuner_status(struct tuner *t)
+static void tuner_status(struct dvb_frontend *fe)
 {
+       struct tuner *t = fe->analog_demod_priv;
        unsigned long freq, freq_fraction;
        struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
+       struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
        const char *p;
 
        switch (t->mode) {
@@ -543,11 +560,13 @@ static void tuner_status(struct tuner *t)
                if (tuner_status & TUNER_STATUS_STEREO)
                        tuner_info("Stereo:          yes\n");
        }
-       if (t->ops.has_signal) {
-               tuner_info("Signal strength: %d\n", t->ops.has_signal(t));
-       }
-       if (t->ops.is_stereo) {
-               tuner_info("Stereo:          %s\n", t->ops.is_stereo(t) ? "yes" : "no");
+       if (ops) {
+               if (ops->has_signal)
+                       tuner_info("Signal strength: %d\n",
+                                  ops->has_signal(fe));
+               if (ops->is_stereo)
+                       tuner_info("Stereo:          %s\n",
+                                  ops->is_stereo(fe) ? "yes" : "no");
        }
 }
 
@@ -561,27 +580,33 @@ static unsigned default_mode_mask;
  */
 static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
 {
+       struct i2c_client *client;
        struct tuner *t;
 
-       client_template.adapter = adap;
-       client_template.addr = addr;
+       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       if (NULL == client)
+               return -ENOMEM;
 
        t = kzalloc(sizeof(struct tuner), GFP_KERNEL);
-       if (NULL == t)
+       if (NULL == t) {
+               kfree(client);
                return -ENOMEM;
-       memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
-       i2c_set_clientdata(&t->i2c, t);
+       }
+       t->i2c = client;
+       client_template.adapter = adap;
+       client_template.addr = addr;
+       memcpy(client, &client_template, sizeof(struct i2c_client));
+       i2c_set_clientdata(client, t);
        t->type = UNSET;
        t->audmode = V4L2_TUNER_MODE_STEREO;
        t->mode_mask = T_UNINITIALIZED;
-       t->ops.tuner_status = tuner_status;
 
        if (show_i2c) {
                unsigned char buffer[16];
                int i,rc;
 
                memset(buffer, 0, sizeof(buffer));
-               rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer));
+               rc = i2c_master_recv(client, buffer, sizeof(buffer));
                tuner_info("I2C RECV = ");
                for (i=0;i<rc;i++)
                        printk("%02x ",buffer[i]);
@@ -594,9 +619,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
        /* autodetection code based on the i2c addr */
        if (!no_autodetect) {
                switch (addr) {
-#ifdef CONFIG_TUNER_TEA5761
                case 0x10:
-                       if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) {
+                       if (tea5761_autodetection(t->i2c->adapter, t->i2c->addr) != EINVAL) {
                                t->type = TUNER_TEA5761;
                                t->mode_mask = T_RADIO;
                                t->mode = T_STANDBY;
@@ -606,14 +630,13 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
                                goto register_client;
                        }
                        break;
-#endif
                case 0x42:
                case 0x43:
                case 0x4a:
                case 0x4b:
                        /* If chip is not tda8290, don't register.
                           since it can be tda9887*/
-                       if (tda8290_probe(t->i2c.adapter, t->i2c.addr) == 0) {
+                       if (tda8290_probe(t) == 0) {
                                tuner_dbg("chip at addr %x is a tda8290\n", addr);
                        } else {
                                /* Default is being tda9887 */
@@ -624,7 +647,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
                        }
                        break;
                case 0x60:
-                       if (tea5767_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) {
+                       if (tea5767_autodetection(t->i2c->adapter, t->i2c->addr) != EINVAL) {
                                t->type = TUNER_TEA5767;
                                t->mode_mask = T_RADIO;
                                t->mode = T_STANDBY;
@@ -649,8 +672,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
        /* Should be just before return */
 register_client:
        tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
-       i2c_attach_client (&t->i2c);
-       set_type (&t->i2c,t->type, t->mode_mask, t->config, t->tuner_callback);
+       i2c_attach_client (client);
+       set_type (client,t->type, t->mode_mask, t->config, t->tuner_callback);
        return 0;
 }
 
@@ -693,21 +716,21 @@ static int tuner_probe(struct i2c_adapter *adap)
 static int tuner_detach(struct i2c_client *client)
 {
        struct tuner *t = i2c_get_clientdata(client);
+       struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
        int err;
 
-       err = i2c_detach_client(&t->i2c);
+       err = i2c_detach_client(t->i2c);
        if (err) {
                tuner_warn
                    ("Client deregistration failed, client not detached.\n");
                return err;
        }
 
-       if (t->ops.release)
-               t->ops.release(t);
-       else {
-               kfree(t->priv);
-       }
+       if (ops && ops->release)
+               ops->release(&t->fe);
+
        kfree(t);
+       kfree(client);
        return 0;
 }
 
@@ -720,6 +743,8 @@ static int tuner_detach(struct i2c_client *client)
 
 static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd)
 {
+       struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
+
        if (mode == t->mode)
                return 0;
 
@@ -727,8 +752,8 @@ static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode,
 
        if (check_mode(t, cmd) == EINVAL) {
                t->mode = T_STANDBY;
-               if (t->ops.standby)
-                       t->ops.standby(t);
+               if (ops && ops->standby)
+                       ops->standby(&t->fe);
                return EINVAL;
        }
        return 0;
@@ -751,9 +776,10 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
 {
        struct tuner *t = i2c_get_clientdata(client);
        struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
+       struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
 
        if (tuner_debug>1)
-               v4l_i2c_print_ioctl(&(t->i2c),cmd);
+               v4l_i2c_print_ioctl(client,cmd);
 
        switch (cmd) {
        /* --- configuration --- */
@@ -777,8 +803,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL)
                        return 0;
                t->mode = T_STANDBY;
-               if (t->ops.standby)
-                       t->ops.standby(t);
+               if (ops && ops->standby)
+                       ops->standby(&t->fe);
                break;
 #ifdef CONFIG_VIDEO_V4L1
        case VIDIOCSAUDIO:
@@ -846,8 +872,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                                        else
                                                vt->flags &= ~VIDEO_TUNER_STEREO_ON;
                                } else {
-                                       if (t->ops.is_stereo) {
-                                               if (t->ops.is_stereo(t))
+                                       if (ops && ops->is_stereo) {
+                                               if (ops->is_stereo(&t->fe))
                                                        vt->flags |=
                                                                VIDEO_TUNER_STEREO_ON;
                                                else
@@ -855,8 +881,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                                                                ~VIDEO_TUNER_STEREO_ON;
                                        }
                                }
-                               if (t->ops.has_signal)
-                                       vt->signal = t->ops.has_signal(t);
+                               if (ops && ops->has_signal)
+                                       vt->signal = ops->has_signal(&t->fe);
 
                                vt->flags |= VIDEO_TUNER_LOW;   /* Allow freqs at 62.5 Hz */
 
@@ -886,21 +912,36 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                                        fe_tuner_ops->get_status(&t->fe, &tuner_status);
                                        va->mode = (tuner_status & TUNER_STATUS_STEREO)
                                            ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
-                               } else if (t->ops.is_stereo)
-                                       va->mode = t->ops.is_stereo(t)
+                               } else if (ops && ops->is_stereo)
+                                       va->mode = ops->is_stereo(&t->fe)
                                            ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
                        }
                        return 0;
                }
 #endif
-       case TDA9887_SET_CONFIG:
-               if (t->type == TUNER_TDA9887) {
-                       int *i = arg;
+       case TUNER_SET_CONFIG:
+       {
+               struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
+               struct v4l2_priv_tun_config *cfg = arg;
 
-                       t->tda9887_config = *i;
+               if (t->type != cfg->tuner)
+                       break;
+
+               if (t->type == TUNER_TDA9887) {
+                       t->tda9887_config = *(unsigned int *)cfg->priv;
                        set_freq(client, t->tv_freq);
+                       break;
                }
+
+               if (NULL == fe_tuner_ops->set_config) {
+                       tuner_warn("Tuner frontend module has no way to "
+                                  "set config\n");
+                       break;
+               }
+               fe_tuner_ops->set_config(&t->fe, cfg->priv);
+
                break;
+       }
        /* --- v4l ioctls --- */
        /* take care: bttv does userspace copying, we'll get a
           kernel pointer here... */
@@ -962,8 +1003,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                        switch_v4l2();
 
                        tuner->type = t->mode;
-                       if (t->ops.get_afc)
-                               tuner->afc=t->ops.get_afc(t);
+                       if (ops && ops->get_afc)
+                               tuner->afc = ops->get_afc(&t->fe);
                        if (t->mode == V4L2_TUNER_ANALOG_TV)
                                tuner->capability |= V4L2_TUNER_CAP_NORM;
                        if (t->mode != V4L2_TUNER_RADIO) {
@@ -979,16 +1020,20 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                                u32 tuner_status;
 
                                fe_tuner_ops->get_status(&t->fe, &tuner_status);
-                               tuner->rxsubchans = (tuner_status & TUNER_STATUS_STEREO) ?
-                                       V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO;
+                               tuner->rxsubchans =
+                                       (tuner_status & TUNER_STATUS_STEREO) ?
+                                       V4L2_TUNER_SUB_STEREO :
+                                       V4L2_TUNER_SUB_MONO;
                        } else {
-                               if (t->ops.is_stereo) {
-                                       tuner->rxsubchans = t->ops.is_stereo(t) ?
-                                               V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO;
+                               if (ops && ops->is_stereo) {
+                                       tuner->rxsubchans =
+                                               ops->is_stereo(&t->fe) ?
+                                               V4L2_TUNER_SUB_STEREO :
+                                               V4L2_TUNER_SUB_MONO;
                                }
                        }
-                       if (t->ops.has_signal)
-                               tuner->signal = t->ops.has_signal(t);
+                       if (ops && ops->has_signal)
+                               tuner->signal = ops->has_signal(&t->fe);
                        tuner->capability |=
                            V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
                        tuner->audmode = t->audmode;
@@ -1013,8 +1058,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                        break;
                }
        case VIDIOC_LOG_STATUS:
-               if (t->ops.tuner_status)
-                       t->ops.tuner_status(t);
+               if (ops && ops->tuner_status)
+                       ops->tuner_status(&t->fe);
                break;
        }