From patchwork Sun Sep 23 16:34:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10611819 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 1020013A4 for ; Sun, 23 Sep 2018 16:35:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1B132925E for ; Sun, 23 Sep 2018 16:35:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E60C2292ED; Sun, 23 Sep 2018 16:35:19 +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 94A9A2925E for ; Sun, 23 Sep 2018 16:35:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726463AbeIWWdU (ORCPT ); Sun, 23 Sep 2018 18:33:20 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:41224 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbeIWWdU (ORCPT ); Sun, 23 Sep 2018 18:33:20 -0400 Received: by mail-pl1-f196.google.com with SMTP id b12-v6so8059141plr.8 for ; Sun, 23 Sep 2018 09:35:18 -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=G3vFzAMBOhKX8eSaSr6JUcFFkCqYMNOVufFUtvNTwQc=; b=TE2wWgh4RbzQwyal+7QAFUft12IfIINLXLtPFaQ0ZRVK3yyHeQz+szlEx3s5hf/rq+ aWAYJFieVBgLGrpVZQu0/00107/7Wxv4Rh+qm5d0l1AJXNUq3grgPy0Diq/yw6e3KGeh Roti+9IxUEQB+l+vElZniXD2Xu7e5o6G2PCRIuRfBHWpGmtlDEgcUal1EymynzoG0Gku 9vbx6eVqo+qMIaVZToNbq0wdNRuGKnCsJiS1Yl4IZ8Dqnivjaa3iG+2RerLkiCvQGtq/ DRwcBy5n80V980C5Kx+ztee0cN4rSCdBEPSH1jIpN5wf6dbAqVCNP+QvsmL5qkSmCYUh ElQQ== 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=G3vFzAMBOhKX8eSaSr6JUcFFkCqYMNOVufFUtvNTwQc=; b=VB7txI2aYh5ZlvMyW6rYwiZacnmgAu0QRF//AySLU9nt0Kq6+x1tyo5udiFSV5bUDB WchRq/gdyUS87Jse4067Bfxo/yZkDLqULfVoeL9y7qdBa72DYFGoVcgvf3r9LEcpvdJv na9cU2jj4trcscv6zYamaykPXCe1vQXovaKHMLrlFtRSLdecd4C5BUk2zjnTL937fV+1 a4+HOh+iwzujRgHWeMoSab0pMltlGqOLOq1zNHp8yynLi/znQel8dJU4buNtXTAVyPjt V5Kg8A9CycFByL6uvMYBJbWaQ0Db+rrfnKWFjaR29OLkfrto+Ku0OH+zhwBJ2+fwpVPH 0A6w== X-Gm-Message-State: ABuFfohvSUAyd5HUo7NzKw6gc4vd804Tbw02cglD8XqtKdEQQ506dAvm uVVI4U51UXRBr4dmBgNL8igPfD7D X-Google-Smtp-Source: ACcGV61qlnxyjd2U79cUUo4H77QFau8Uuvk87lCAB9jaNJUiVYkS99ZORIWEQtT+NzuhWiAPZW8/IQ== X-Received: by 2002:a17:902:4d45:: with SMTP id o5-v6mr7255810plh.78.1537720517895; Sun, 23 Sep 2018 09:35:17 -0700 (PDT) Received: from mita-MS-7A45.lan ([240f:34:212d:1:9f:aa8:eeac:60f7]) by smtp.gmail.com with ESMTPSA id d129-v6sm18286250pga.69.2018.09.23.09.35.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Sep 2018 09:35:17 -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 v2 3/6] media: v4l2-common: add V4L2_FRACT_COMPARE Date: Mon, 24 Sep 2018 01:34:49 +0900 Message-Id: <1537720492-31201-4-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537720492-31201-1-git-send-email-akinobu.mita@gmail.com> References: <1537720492-31201-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 Add macro to compare two v4l2_fract values in v4l2 common internal API. The same macro FRACT_CMP() is used by vivid and bcm2835-camera. This just renames it to V4L2_FRACT_COMPARE in order to avoid namespace collision. Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- * v2 - New patch include/media/v4l2-common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index cdc87ec..eafb8a3 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -384,4 +384,9 @@ int v4l2_g_parm_cap(struct video_device *vdev, int v4l2_s_parm_cap(struct video_device *vdev, struct v4l2_subdev *sd, struct v4l2_streamparm *a); +/* Compare two v4l2_fract structs */ +#define V4L2_FRACT_COMPARE(a, OP, b) \ + ((u64)(a).numerator * (b).denominator OP \ + (u64)(b).numerator * (a).denominator) + #endif /* V4L2_COMMON_H_ */