From patchwork Sat Oct 13 18:02:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10640439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 006D514E2 for ; Sat, 13 Oct 2018 18:03:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E34C72AAED for ; Sat, 13 Oct 2018 18:03:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7BA32AB0F; Sat, 13 Oct 2018 18:03:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74B8C2AAED for ; Sat, 13 Oct 2018 18:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726878AbeJNBlP (ORCPT ); Sat, 13 Oct 2018 21:41:15 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:34678 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726668AbeJNBlP (ORCPT ); Sat, 13 Oct 2018 21:41:15 -0400 Received: by mail-pf1-f195.google.com with SMTP id f78-v6so1956865pfe.1 for ; Sat, 13 Oct 2018 11:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+XZ6O1aLw3nY1S+rZehsGulLQzIRkzMdu3biGynecf0=; b=Kw3s5c3dNt0kmVg2fU+wY5LLksItiz8mXA5lKEBqai/79bKRGITAzbQmRuuj55MJoI ZrI2qR5IXelegmM5cgStZ9xQ4NqwCjKEyYxScNMmyqMDScaJ2vsIPWB0SGm8a+0s2m0U 4PrSUBvO/nzHZ5oNQf4FyZttRaiRCurPozjAaeDtGx0toYFpXqWn63HSpLfx1yNYAfWC mdOA+VXprUtlsOrjGb0yGTfa498G35AzCxRo3zW7r2EdcsBt59zqoO6QUvwtLWeuKDLS vI9ShBf2iXJgUnsYMm1h2LFVeN4xucBC7KZCcTY39RT2XasSMeY2E5cKE8Tgdzjf56fm TXIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+XZ6O1aLw3nY1S+rZehsGulLQzIRkzMdu3biGynecf0=; b=k8EoJyiNTuZ7edUdZKeDUP/tzN1TAknjMMz8cJo9O1FEcGeZJaauWh2HgdX3honyyd 34F/4BPjbosWQ4j638zRsqd1XbYw550u0vVCgj4KA7LJhLLk3jjNnAJuP60PBFuhvdH9 JDIa34cwf2wkeK/QGAfj1tciRQeqzl0hpqhNWfyFhLCGjqWBRZ0kfqvNh5IzbABPGufF nfiTOidfUHdUptmS+c64f4yEnUjRTw13MTu1gacp4x/aahygXSVraqg5XDMD5sI96xlo wRc2iLdy5D7/pbAhRjZLTwpBnv39ps4l956nz89pbL47xVLeZxif5nk3yJyYXVjEOCMg UjWw== X-Gm-Message-State: ABuFfohWPbUOqgl1KxfT0M85xcFKHQbqKGMW3PrN2HVzg0XRBTVNngp3 4WidnW2wWIkuPNkP18k27PuxlHwX X-Google-Smtp-Source: ACcGV60IoI1/4dexCgQGe6QRedqw6Vtsd74MilAgMLyeTMpuPp1RB8pEpZxm2pBAbPY4o3R2VTCJTw== X-Received: by 2002:a63:5726:: with SMTP id l38-v6mr10093954pgb.118.1539453788438; Sat, 13 Oct 2018 11:03:08 -0700 (PDT) Received: from localhost.localdomain ([240f:34:212d:1:40bf:70f3:985:17ed]) by smtp.gmail.com with ESMTPSA id w187-v6sm2513858pfw.3.2018.10.13.11.03.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Oct 2018 11:03:07 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Matt Ranostay , Sakari Ailus , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH v3 4/6] media: vivid: use V4L2_FRACT_COMPARE Date: Sun, 14 Oct 2018 03:02:37 +0900 Message-Id: <1539453759-29976-5-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539453759-29976-1-git-send-email-akinobu.mita@gmail.com> References: <1539453759-29976-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now the equivalent of FRACT_CMP() is added in v4l2 common internal API header. Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Acked-by: Sakari Ailus Signed-off-by: Akinobu Mita --- * v3 - Add Acked-by line drivers/media/platform/vivid/vivid-vid-cap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index 1599159..f19c701 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -1824,9 +1824,6 @@ int vivid_vid_cap_g_parm(struct file *file, void *priv, return 0; } -#define FRACT_CMP(a, OP, b) \ - ((u64)(a).numerator * (b).denominator OP (u64)(b).numerator * (a).denominator) - int vivid_vid_cap_s_parm(struct file *file, void *priv, struct v4l2_streamparm *parm) { @@ -1847,14 +1844,14 @@ int vivid_vid_cap_s_parm(struct file *file, void *priv, if (tpf.denominator == 0) tpf = webcam_intervals[ival_sz - 1]; for (i = 0; i < ival_sz; i++) - if (FRACT_CMP(tpf, >=, webcam_intervals[i])) + if (V4L2_FRACT_COMPARE(tpf, >=, webcam_intervals[i])) break; if (i == ival_sz) i = ival_sz - 1; dev->webcam_ival_idx = i; tpf = webcam_intervals[dev->webcam_ival_idx]; - tpf = FRACT_CMP(tpf, <, tpf_min) ? tpf_min : tpf; - tpf = FRACT_CMP(tpf, >, tpf_max) ? tpf_max : tpf; + tpf = V4L2_FRACT_COMPARE(tpf, <, tpf_min) ? tpf_min : tpf; + tpf = V4L2_FRACT_COMPARE(tpf, >, tpf_max) ? tpf_max : tpf; /* resync the thread's timings */ dev->cap_seq_resync = true;