From patchwork Fri Jan 4 20:59:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 1934671 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id EE1C0DFABD for ; Fri, 4 Jan 2013 21:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754959Ab3ADU76 (ORCPT ); Fri, 4 Jan 2013 15:59:58 -0500 Received: from mail-vb0-f42.google.com ([209.85.212.42]:64660 "EHLO mail-vb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754939Ab3ADU75 (ORCPT ); Fri, 4 Jan 2013 15:59:57 -0500 Received: by mail-vb0-f42.google.com with SMTP id fa15so17261950vbb.29 for ; Fri, 04 Jan 2013 12:59:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=JNuFpIx0IDtl4Yqflk1cF2viDo37dx2kxBp7yBQh0Oc=; b=MEGYcKqILTRJhfymo/WlfP407zE2LWD3LnM5NBh0OHNmi6K6mrV6H2Zac54wFII2i5 MU2frfUGA7wyskthQ2RMrgUNYhv5JkBOMymsIh4klVL1MDWwKnZIF1UNXctidZ/6jJI6 Y2T/uFNwCayvlWfVtHAUEvQfwffNAAOMS/g3W+YlPp6at3yRohRLBSJcpfhucEYVklit 0C4BzXtalET7jHaXXaMu/yr0YpMXwG77CLQ1p+UCwKI6rkqTvfo0dVdctN50j1XdUpfH Snn4wzWM0HKlvhiR251LClrCvD7R6fubUVHMWPF9LwbcYSshyzIKanOMaXuZWrl8Me5Y 9dog== X-Received: by 10.58.2.226 with SMTP id 2mr78537571vex.53.1357333196382; Fri, 04 Jan 2013 12:59:56 -0800 (PST) Received: from devin-ubuntu2.home (pool-108-54-72-165.nycmny.fios.verizon.net. [108.54.72.165]) by mx.google.com with ESMTPS id z20sm47278440vds.12.2013.01.04.12.59.55 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 12:59:56 -0800 (PST) From: Devin Heitmueller To: linux-media@vger.kernel.org Cc: Devin Heitmueller , Hans Verkuil Subject: [PATCH 04/15] em28xx: fix tuner/frequency handling Date: Fri, 4 Jan 2013 15:59:34 -0500 Message-Id: <1357333186-8466-5-git-send-email-dheitmueller@kernellabs.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1357333186-8466-1-git-send-email-dheitmueller@kernellabs.com> References: <1357333186-8466-1-git-send-email-dheitmueller@kernellabs.com> X-Gm-Message-State: ALoCoQlXJonKsS2jwBcw/sHeY9Eu1oa3StZSQM2NzIb5VCKnqeFuRQkHgvscLKWo7IRCe4V8MyWg Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 Signed-off-by: Devin Heitmueller --- drivers/media/usb/em28xx/em28xx-video.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index b71df42..89cbfaf 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1322,7 +1322,6 @@ static int vidioc_g_tuner(struct file *file, void *priv, return -EINVAL; strcpy(t->name, "Tuner"); - t->type = V4L2_TUNER_ANALOG_TV; v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); return 0; @@ -1352,7 +1351,9 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct em28xx_fh *fh = priv; struct em28xx *dev = fh->dev; - f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; + if (0 != f->tuner) + return -EINVAL; + f->frequency = dev->ctl_freq; return 0; } @@ -1371,13 +1372,9 @@ static int vidioc_s_frequency(struct file *file, void *priv, if (0 != f->tuner) return -EINVAL; - if (unlikely(0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV)) - return -EINVAL; - if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO)) - return -EINVAL; - - dev->ctl_freq = f->frequency; v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, f); + dev->ctl_freq = f->frequency; return 0; }