[media] cx23885-dvb: Remove a dirty hack that would require DVBv3
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 26 Dec 2011 23:48:54 +0000 (20:48 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 31 Dec 2011 12:22:54 +0000 (10:22 -0200)
The cx23885-dvb driver has a dirty hack:
1) it hooks the DVBv3 legacy call to FE_SET_FRONTEND;
2) it uses internally the DVBv3 struct to decide some
   configs.

Replace it by a change during the gate control. This will
likely work, but requires testing. Anyway, the current way
will break, as soon as we stop copying data for DVBv3 for
pure DVBv5 calls.

Compile-tested only.

Cc: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23885-dvb.c

index bcb45be..28d51d8 100644 (file)
@@ -111,6 +111,8 @@ static void dvb_buf_release(struct videobuf_queue *q,
        cx23885_free_buffer(q, (struct cx23885_buffer *)vb);
 }
 
+static int cx23885_dvb_set_frontend(struct dvb_frontend *fe);
+
 static void cx23885_dvb_gate_ctrl(struct cx23885_tsport  *port, int open)
 {
        struct videobuf_dvb_frontends *f;
@@ -125,6 +127,12 @@ static void cx23885_dvb_gate_ctrl(struct cx23885_tsport  *port, int open)
 
        if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
                fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, open);
+
+       /*
+        * FIXME: Improve this path to avoid calling the
+        * cx23885_dvb_set_frontend() every time it passes here.
+        */
+       cx23885_dvb_set_frontend(fe->dvb.frontend);
 }
 
 static struct videobuf_queue_ops dvb_qops = {
@@ -479,15 +487,15 @@ static struct xc5000_config mygica_x8506_xc5000_config = {
        .if_khz = 5380,
 };
 
-static int cx23885_dvb_set_frontend(struct dvb_frontend *fe,
-                                   struct dvb_frontend_parameters *param)
+static int cx23885_dvb_set_frontend(struct dvb_frontend *fe)
 {
+       struct dtv_frontend_properties *p = &fe->dtv_property_cache;
        struct cx23885_tsport *port = fe->dvb->priv;
        struct cx23885_dev *dev = port->dev;
 
        switch (dev->board) {
        case CX23885_BOARD_HAUPPAUGE_HVR1275:
-               switch (param->u.vsb.modulation) {
+               switch (p->modulation) {
                case VSB_8:
                        cx23885_gpio_clear(dev, GPIO_5);
                        break;
@@ -507,31 +515,6 @@ static int cx23885_dvb_set_frontend(struct dvb_frontend *fe,
        return 0;
 }
 
-static int cx23885_dvb_fe_ioctl_override(struct dvb_frontend *fe,
-                                        unsigned int cmd, void *parg,
-                                        unsigned int stage)
-{
-       int err = 0;
-
-       switch (stage) {
-       case DVB_FE_IOCTL_PRE:
-
-               switch (cmd) {
-               case FE_SET_FRONTEND:
-                       err = cx23885_dvb_set_frontend(fe,
-                               (struct dvb_frontend_parameters *) parg);
-                       break;
-               }
-               break;
-
-       case DVB_FE_IOCTL_POST:
-               /* no post-ioctl handling required */
-               break;
-       }
-       return err;
-};
-
-
 static struct lgs8gxx_config magicpro_prohdtve2_lgs8g75_config = {
        .prod = LGS8GXX_PROD_LGS8G75,
        .demod_address = 0x19,
@@ -1151,7 +1134,7 @@ static int dvb_register(struct cx23885_tsport *port)
        /* register everything */
        ret = videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port,
                                        &dev->pci->dev, adapter_nr, mfe_shared,
-                                       cx23885_dvb_fe_ioctl_override);
+                                       NULL);
        if (ret)
                goto frontend_detach;