From patchwork Sat Oct 13 18:02:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10640437 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 6DC3B933 for ; Sat, 13 Oct 2018 18:03:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CC8F2AAED for ; Sat, 13 Oct 2018 18:03:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 512A12AB0F; Sat, 13 Oct 2018 18:03:07 +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 019102AAED for ; Sat, 13 Oct 2018 18:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726837AbeJNBlL (ORCPT ); Sat, 13 Oct 2018 21:41:11 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:34674 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726668AbeJNBlL (ORCPT ); Sat, 13 Oct 2018 21:41:11 -0400 Received: by mail-pf1-f195.google.com with SMTP id f78-v6so1956823pfe.1 for ; Sat, 13 Oct 2018 11:03:05 -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=C1pRe86HCiTi27Th0ekV61Pkp9kQL4ww2kyv+bh+Rmg=; b=gN+7y2SF39aEInn9AYs3ZTXTmDGSTN1mRld6kNQFEkNs0JNJSkv/sDBl23PNw/69ID OHBLo4OawrCN5mBtjUm286b2b/j65cUcTvGHQrHCr00aXXz50g4H4Wn3u2GYDJp+a93E 171dyya648SqiOnQlfqgqQhaQ68TJKvAi77xKB6rJUE83+19WaTClUf3thBr/ny0jc/t bh+IM7VmNcxnYzBH2qBzZEMk3FDQ6L9oHoUg6LElGSxuMk4iVA9C6niDNNSDt2Jqhr9X kS+9maSKp4kmJ+L47jnVpdMrIJzyj0UPXuOpmIPDzdag9fv92rMAy888V2+Hvljx2eTr O1rQ== 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=C1pRe86HCiTi27Th0ekV61Pkp9kQL4ww2kyv+bh+Rmg=; b=gm0FAdCnap4tDc55RdZ5y7BPezu22jTt2uAvnW3oA6lYz4hWpc2AalcWiQBzkkxSSY VISZziFUwF3RzVeR8NoepkqGVYCF1g17IdecNDfC18FnIGlZN9LpTzW2kpj+FZoZr5jh TOs/YmVdnwbWjaaaio9OC8+5Y8IDO+MFIsmppPtefR5UvC9c9Cr45oL4FceAkwo2fdu8 6xU8V/finFKDALGdg3m1CKAXHVcWlLRNJpGJNKMTqMwUsYdonko2T7LwKtFl03lHYGj2 v1/0aatna9UP1G6IPcwcPSzSOUlFvEu5kNKuyUIM4VF6xlPWicOZoD9iqSVg+dYCB3UL 1eSQ== X-Gm-Message-State: ABuFfoiQoBIu698MBTyI2rkF1KWcbZ65LMNJ1R9w4iV+K311nxSi/BUx PWATW1BHkVv7pMT83EXcx+oQ4r1f X-Google-Smtp-Source: ACcGV60CKC7LWPfaYwmRYPp1os9bZ0PeOoUyquoiXhYdgRkZ4X/tyqxAwiRJ5gsaM7YHj9JX+eQrVQ== X-Received: by 2002:a63:f60f:: with SMTP id m15-v6mr10108326pgh.293.1539453785142; Sat, 13 Oct 2018 11:03:05 -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.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Oct 2018 11:03:04 -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 3/6] media: v4l2-common: add V4L2_FRACT_COMPARE Date: Sun, 14 Oct 2018 03:02:36 +0900 Message-Id: <1539453759-29976-4-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 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 --- * v3 - Add Acked-by line 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_ */