From patchwork Tue Jul 6 10:09:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 470625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FF99C07E9C for ; Tue, 6 Jul 2021 10:09:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79366619A1 for ; Tue, 6 Jul 2021 10:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231267AbhGFKMg (ORCPT ); Tue, 6 Jul 2021 06:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbhGFKMf (ORCPT ); Tue, 6 Jul 2021 06:12:35 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF22BC06175F for ; Tue, 6 Jul 2021 03:09:56 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:fd03:2275:4427:8d01]) by albert.telenet-ops.be with bizsmtp id Rm9u250082pudom06m9ujs; Tue, 06 Jul 2021 12:09:54 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1m0i1Z-007CxI-Lf; Tue, 06 Jul 2021 12:09:53 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1m0i1Z-00FxWm-2v; Tue, 06 Jul 2021 12:09:53 +0200 From: Geert Uytterhoeven To: Trent Piepho , Colin Ian King , Andy Shevchenko , Andrew Morton , Brendan Higgins Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 1/2] math: Make RATIONAL tristate Date: Tue, 6 Jul 2021 12:09:44 +0200 Message-Id: <20210706100945.3803694-2-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210706100945.3803694-1-geert@linux-m68k.org> References: <20210706100945.3803694-1-geert@linux-m68k.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org All but one symbols that select RATIONAL are tristate, but RATIONAL itself is bool. Change it to tristate, so the rational fractions support code can be modular if no builtin code relies on it. Signed-off-by: Geert Uytterhoeven --- Exposed by commit b6c75c4afceb8bc0 ("lib/math/rational: add Kunit test cases") and CONFIG_KUNIT_ALL_TESTS=m. v2: - Drop compile-testing and help text. --- lib/math/Kconfig | 2 +- lib/math/rational.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/math/Kconfig b/lib/math/Kconfig index f19bc9734fa7cc4b..0634b428d0cb7f86 100644 --- a/lib/math/Kconfig +++ b/lib/math/Kconfig @@ -14,4 +14,4 @@ config PRIME_NUMBERS If unsure, say N. config RATIONAL - bool + tristate diff --git a/lib/math/rational.c b/lib/math/rational.c index c0ab51d8fbb98d17..ec59d426ea638b0f 100644 --- a/lib/math/rational.c +++ b/lib/math/rational.c @@ -13,6 +13,7 @@ #include #include #include +#include /* * calculate best rational approximation for a given fraction @@ -106,3 +107,5 @@ void rational_best_approximation( } EXPORT_SYMBOL(rational_best_approximation); + +MODULE_LICENSE("GPL v2"); From patchwork Tue Jul 6 10:09:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 470624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F157BC07E9B for ; Tue, 6 Jul 2021 10:09:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5842619A0 for ; Tue, 6 Jul 2021 10:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231309AbhGFKMg (ORCPT ); Tue, 6 Jul 2021 06:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231244AbhGFKMf (ORCPT ); Tue, 6 Jul 2021 06:12:35 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02A03C061765 for ; Tue, 6 Jul 2021 03:09:56 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:fd03:2275:4427:8d01]) by laurent.telenet-ops.be with bizsmtp id Rm9u250012pudom01m9u5u; Tue, 06 Jul 2021 12:09:54 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1m0i1Z-007CxJ-Hd; Tue, 06 Jul 2021 12:09:53 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1m0i1Z-00FxWs-3f; Tue, 06 Jul 2021 12:09:53 +0200 From: Geert Uytterhoeven To: Trent Piepho , Colin Ian King , Andy Shevchenko , Andrew Morton , Brendan Higgins Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 2/2] math: RATIONAL_KUNIT_TEST should depend on RATIONAL instead of selecting it Date: Tue, 6 Jul 2021 12:09:45 +0200 Message-Id: <20210706100945.3803694-3-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210706100945.3803694-1-geert@linux-m68k.org> References: <20210706100945.3803694-1-geert@linux-m68k.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org RATIONAL_KUNIT_TEST selects RATIONAL, thus enabling an optional feature the user may not want to have enabled. Fix this by making the test depend on RATIONAL instead. Fixes: b6c75c4afceb8bc0 ("lib/math/rational: add Kunit test cases") Signed-off-by: Geert Uytterhoeven --- The RATIONAL config symbol is not visible, which means that this test can only be enabled when there is a user of RATIONAL. v2: - New. --- lib/Kconfig.debug | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 8acc01d7d816518c..f368764ff4a91f4a 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2449,8 +2449,7 @@ config SLUB_KUNIT_TEST config RATIONAL_KUNIT_TEST tristate "KUnit test for rational.c" if !KUNIT_ALL_TESTS - depends on KUNIT - select RATIONAL + depends on KUNIT && RATIONAL default KUNIT_ALL_TESTS help This builds the rational math unit test.