From patchwork Sat Oct 20 14:26:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10650547 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 368DD17EF for ; Sat, 20 Oct 2018 14:26:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25CB328622 for ; Sat, 20 Oct 2018 14:26:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1769628632; Sat, 20 Oct 2018 14:26:51 +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 AF42628622 for ; Sat, 20 Oct 2018 14:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727453AbeJTWh3 (ORCPT ); Sat, 20 Oct 2018 18:37:29 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46003 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbeJTWh2 (ORCPT ); Sat, 20 Oct 2018 18:37:28 -0400 Received: by mail-pf1-f193.google.com with SMTP id u12-v6so17783133pfn.12 for ; Sat, 20 Oct 2018 07:26:49 -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=Yw+6seVTs2UOoFuM8wOlZYuvyboxKHwd+Nb+BLXfwIY=; b=s9nl4H/1rDN7xsO3L3Oi0BPhdzavFl+AYfNNevEGgKpLLHK8AjfIezDQtU77gYn3sn 8elfMfYMWKe3kyYHkwBEwZPU2QDu/lb4iaPie4He9LaMTykg70J9AldUweH3JLGnDpcp IFZidZuZCXoRr9n7OV1h9y9uujMYIL4v2zKi7PW24MkuqIBW2Why+AfBUNRROFbtYcCn W8CyC+Jtd0gMkhVtqqoyOnq7gBQzFktOHS/SZBFWnVOsntP2z+LpBVgVQOP/jz2Jbr6H DFKDR2EJLP6+XMl0cPTliDe8PuVJB+Gjj3OZnByk0Z+T253JljCmF7Aov41QhalinjGF JjTw== 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=Yw+6seVTs2UOoFuM8wOlZYuvyboxKHwd+Nb+BLXfwIY=; b=eB6qEz2C1I8WFeHpAvmX+kTZaiLEpDUtt7lp/YlIfzk50kyzbo/zT4yz3oYxS411IP DTnDCyKwfa2Prs1Yox/b0xyCyI+YtKEeLqh6S/XaVBl5xQoEyQjBvG1u5mS45uUcp5A/ kR+V4OOghU0yuNZaS3zZh6RTuawuGTTSaDNhzfjDgFtm8oGzHEmTqEsz1apW/bw7stDv u3MTDrI649SYx6vipMy2MrRP5IXJTJzfXF5uEcTXIW65mPAGKUu/JvyVa991jW6DJm/P cPge4fV843KnXmSR01i+PkRWM+wCtI2yVkLKRy98OWWxLp9j8ahfHm7EPqPrLTbRxoD7 BgQg== X-Gm-Message-State: ABuFfojuwm+AELOL8LqWA6OhO6ChvhXyiGZq+LEG3CjK8jqHCTECl714 shfU8KwPcp8YjX+rnqm0Nz+UHC4p X-Google-Smtp-Source: ACcGV62+RQJFjlHl4Pqm2+Uzkn9Glo+lyr9eE2+Nc9ed9VZ9LdXSnVjbG6frXlw0iGt7IIT+ZXV2ew== X-Received: by 2002:a62:4681:: with SMTP id o1-v6mr38496615pfi.108.1540045609055; Sat, 20 Oct 2018 07:26:49 -0700 (PDT) Received: from mita-MS-7A45.lan ([240f:34:212d:1:28d8:ef69:4040:67dc]) by smtp.gmail.com with ESMTPSA id q68-v6sm28624799pfb.160.2018.10.20.07.26.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 20 Oct 2018 07:26:48 -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 v4 3/6] media: v4l2-common: add V4L2_FRACT_COMPARE Date: Sat, 20 Oct 2018 23:26:25 +0900 Message-Id: <1540045588-9091-4-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540045588-9091-1-git-send-email-akinobu.mita@gmail.com> References: <1540045588-9091-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 Acked-by: Sakari Ailus Signed-off-by: Akinobu Mita --- * v4 - No changes from v3 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_ */