From patchwork Thu Oct 12 23:01:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jasmin J." X-Patchwork-Id: 10003155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA8F6602BF for ; Thu, 12 Oct 2017 23:01:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC5B72876B for ; Thu, 12 Oct 2017 23:01:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0BF728869; Thu, 12 Oct 2017 23:01:20 +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=-6.9 required=2.0 tests=BAYES_00,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 BC0512876B for ; Thu, 12 Oct 2017 23:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753867AbdJLXBR (ORCPT ); Thu, 12 Oct 2017 19:01:17 -0400 Received: from mail.anw.at ([195.234.101.228]:41009 "EHLO mail.anw.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753576AbdJLXBQ (ORCPT ); Thu, 12 Oct 2017 19:01:16 -0400 Received: from hoppel.217.196.72.190 (anwhome.anw.at [195.234.103.23]) by mail.anw.at (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id v9CN1EXG012702; Fri, 13 Oct 2017 01:01:14 +0200 From: "Jasmin J." To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, d.scheller@gmx.net, jasmin@anw.at Subject: [PATCH] build: Add bsearch if not defined Date: Fri, 13 Oct 2017 01:01:08 +0200 Message-Id: <1507849268-31034-1-git-send-email-jasmin@anw.at> X-Mailer: git-send-email 2.7.4 X-Antivirus: checked in 0.018sec at mail.anw.at ([195.234.102.72]) by smf-clamd v1.2.1 - http://smfs.sf.net/ 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 From: Jasmin Jessich Compiling for Kernel 2.6.x failed in "rc-main.c" with linux/bsearch.h: No such file or directory Beside adding the missing function, also the include of "linux/bsearch.h" has been removed by new patch "v2.6_rc_main_bsearch_h.patch". Signed-off-by: Jasmin Jessich --- backports/backports.txt | 3 +++ backports/v2.6_rc_main_bsearch_h.patch | 10 ++++++++++ v4l/compat.h | 25 +++++++++++++++++++++++++ v4l/scripts/make_config_compat.pl | 1 + 4 files changed, 39 insertions(+) create mode 100644 backports/v2.6_rc_main_bsearch_h.patch diff --git a/backports/backports.txt b/backports/backports.txt index 87b9ee8..b245e3b 100644 --- a/backports/backports.txt +++ b/backports/backports.txt @@ -127,6 +127,9 @@ add no_atomic_include.patch add v4l2-compat-timespec.patch add v3.0_ida2bit.patch +[2.6.39] +add v2.6_rc_main_bsearch_h.patch + [2.6.38] add v2.6.38_use_getkeycode_new_setkeycode_new.patch add v2.6.38_config_of_for_of_node.patch diff --git a/backports/v2.6_rc_main_bsearch_h.patch b/backports/v2.6_rc_main_bsearch_h.patch new file mode 100644 index 0000000..9ed45b4 --- /dev/null +++ b/backports/v2.6_rc_main_bsearch_h.patch @@ -0,0 +1,10 @@ +--- a/drivers/media/rc/rc-main.c ++++ b/drivers/media/rc/rc-main.c +@@ -16,7 +16,6 @@ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + + #include +-#include + #include + #include + #include diff --git a/v4l/compat.h b/v4l/compat.h index 15f2cd6..3504288 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -2170,4 +2170,29 @@ static inline unsigned long nsecs_to_jiffies_static(u64 n) #define U32_MAX ((u32)~0U) #endif +#ifdef NEED_BSEARCH +static inline void *bsearch(const void *key, const void *base, size_t num, size_t size, + int (*cmp)(const void *key, const void *elt)) +{ + const char *pivot; + int result; + + while (num > 0) { + pivot = base + (num >> 1) * size; + result = cmp(key, pivot); + + if (result == 0) + return (void *)pivot; + + if (result > 0) { + base = pivot + size; + num--; + } + num >>= 1; + } + + return NULL; +} +#endif + #endif /* _COMPAT_H */ diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl index 9fdf10d..8ebeea3 100644 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -705,6 +705,7 @@ sub check_other_dependencies() check_files_for_func("PCI_DEVICE_SUB", "NEED_PCI_DEVICE_SUB", "include/linux/pci.h"); check_files_for_func("annotate_reachable", "NEED_ANNOTATE_REACHABLE", "include/linux/compiler.h"); check_files_for_func("U32_MAX", "NEED_U32_MAX", "include/linux/kernel.h"); + check_files_for_func("bsearch", "NEED_BSEARCH", "include/linux/bsearch.h"); # For tests for uapi-dependent logic check_files_for_func_uapi("usb_endpoint_maxp", "NEED_USB_ENDPOINT_MAXP", "usb/ch9.h");