Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] em28xx: fix tuner/frequency handling

v4l2-compliance found problems with frequency clamping that wasn't
reported correctly and missing tuner index checks.
Also removed unnecessary tuner type checks (these are now done by the
v4l2 core).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
20deebfe 319a55fb

+5 -8
+5 -8
drivers/media/usb/em28xx/em28xx-video.c
··· 1322 1322 return -EINVAL; 1323 1323 1324 1324 strcpy(t->name, "Tuner"); 1325 - t->type = V4L2_TUNER_ANALOG_TV; 1326 1325 1327 1326 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); 1328 1327 return 0; ··· 1351 1352 struct em28xx_fh *fh = priv; 1352 1353 struct em28xx *dev = fh->dev; 1353 1354 1354 - f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; 1355 + if (0 != f->tuner) 1356 + return -EINVAL; 1357 + 1355 1358 f->frequency = dev->ctl_freq; 1356 1359 return 0; 1357 1360 } ··· 1372 1371 if (0 != f->tuner) 1373 1372 return -EINVAL; 1374 1373 1375 - if (unlikely(0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV)) 1376 - return -EINVAL; 1377 - if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO)) 1378 - return -EINVAL; 1379 - 1380 - dev->ctl_freq = f->frequency; 1381 1374 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); 1375 + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, f); 1376 + dev->ctl_freq = f->frequency; 1382 1377 1383 1378 return 0; 1384 1379 }