V4L/DVB (12686): dvb-core: check supported QAM modulations
authorJanne Grunau <j@jannau.net>
Tue, 1 Sep 2009 22:24:08 +0000 (19:24 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 12 Sep 2009 15:20:04 +0000 (12:20 -0300)
Check the modulation in dvb_frontend_check_parameters against
frontend's capabilties for FE_QAM devices.

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-core/dvb_frontend.c

index 0cb6c09719f256c56b100dea08c346aed7f0d6d1..d13ebcb0c6b650f5dda000631f4985c7d7bcb171 100644 (file)
@@ -838,6 +838,15 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe,
                }
        }
 
+       /* check for supported modulation */
+       if (fe->ops.info.type == FE_QAM &&
+           (parms->u.qam.modulation > QAM_AUTO ||
+            !((1 << (parms->u.qam.modulation + 10)) & fe->ops.info.caps))) {
+               printk(KERN_WARNING "DVB: adapter %i frontend %i modulation %u not supported\n",
+                      fe->dvb->num, fe->id, parms->u.qam.modulation);
+                       return -EINVAL;
+       }
+
        return 0;
 }