{"id":2219068,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2219068/?format=json","project":{"id":59,"url":"http://patchwork.ozlabs.org/api/1.0/projects/59/?format=json","name":"Linux Test Project development","link_name":"ltp","list_id":"ltp.lists.linux.it","list_email":"ltp@lists.linux.it","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260402121356.31266-4-chrubis@suse.cz>","date":"2026-04-02T12:13:42","name":"[03/17] lib: tst_kernel: Add tst_check_module_driver()","commit_ref":null,"pull_url":null,"state":"needs-review-ack","archived":false,"hash":"cb5a2256c3fcb3cf3403620aab1af865d44cf810","submitter":{"id":8530,"url":"http://patchwork.ozlabs.org/api/1.0/people/8530/?format=json","name":"Cyril Hrubis","email":"chrubis@suse.cz"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ltp/patch/20260402121356.31266-4-chrubis@suse.cz/mbox/","series":[{"id":498474,"url":"http://patchwork.ozlabs.org/api/1.0/series/498474/?format=json","date":"2026-04-02T12:13:40","name":"Replace needs_drivers with needs_kconfigs","version":1,"mbox":"http://patchwork.ozlabs.org/series/498474/mbox/"}],"check":"success","checks":"http://patchwork.ozlabs.org/api/patches/2219068/checks/","tags":{},"headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=cqQzUqnY;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.cz\n header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=SYp42VuD;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa\n header.b=cqQzUqnY;\n\tdkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=SYp42VuD;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)","smtp-out2.suse.de;\n\tnone"],"Received":["from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmglQ6W6nz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 23:14:42 +1100 (AEDT)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id D68AD3E2F46\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  2 Apr 2026 14:14:40 +0200 (CEST)","from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 846A73E2F44\n for <ltp@lists.linux.it>; Thu,  2 Apr 2026 14:14:02 +0200 (CEST)","from smtp-out2.suse.de (smtp-out2.suse.de\n [IPv6:2a07:de40:b251:101:10:150:64:2])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 208C9200B76\n for <ltp@lists.linux.it>; Thu,  2 Apr 2026 14:14:02 +0200 (CEST)","from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 2F2D15BDB1\n for <ltp@lists.linux.it>; Thu,  2 Apr 2026 12:13:57 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1B1924A0B1\n for <ltp@lists.linux.it>; Thu,  2 Apr 2026 12:13:57 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id 1QScBYVdzmmiDgAAD6G6ig\n (envelope-from <chrubis@suse.cz>)\n for <ltp@lists.linux.it>; Thu, 02 Apr 2026 12:13:57 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1775132037; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=cbmxdaQTbThmsDUiN9e4Cd1ONuk/j7IUEpPn5vRaZxA=;\n b=cqQzUqnYDxmqftAD/sQNaUormeWAn+UTxCPViTDWRip/zshyByt3mMeHTZjP/NLkEC7TWm\n 7icxCeTikKxsz4Q7oJFJkBGdKSoeBruQpwQs/Nnvn8ti8B+6G2q9rJX7ueRpmdtDviJb0w\n Nd/aTx4ErZYQyz8ztuUB5OWhVb74mB4=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1775132037;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=cbmxdaQTbThmsDUiN9e4Cd1ONuk/j7IUEpPn5vRaZxA=;\n b=SYp42VuDYwqYvCKf8XLfdENMoz7wPJ2TjuKS8YsAwO3sMc5aKpLfhXcV7ufj3AJ/9g4sDI\n E03qZQ6fZkAK6KBg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1775132037; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=cbmxdaQTbThmsDUiN9e4Cd1ONuk/j7IUEpPn5vRaZxA=;\n b=cqQzUqnYDxmqftAD/sQNaUormeWAn+UTxCPViTDWRip/zshyByt3mMeHTZjP/NLkEC7TWm\n 7icxCeTikKxsz4Q7oJFJkBGdKSoeBruQpwQs/Nnvn8ti8B+6G2q9rJX7ueRpmdtDviJb0w\n Nd/aTx4ErZYQyz8ztuUB5OWhVb74mB4=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1775132037;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=cbmxdaQTbThmsDUiN9e4Cd1ONuk/j7IUEpPn5vRaZxA=;\n b=SYp42VuDYwqYvCKf8XLfdENMoz7wPJ2TjuKS8YsAwO3sMc5aKpLfhXcV7ufj3AJ/9g4sDI\n E03qZQ6fZkAK6KBg=="],"From":"Cyril Hrubis <chrubis@suse.cz>","To":"ltp@lists.linux.it","Date":"Thu,  2 Apr 2026 14:13:42 +0200","Message-ID":"<20260402121356.31266-4-chrubis@suse.cz>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260402121356.31266-1-chrubis@suse.cz>","References":"<20260402121356.31266-1-chrubis@suse.cz>","MIME-Version":"1.0","X-Spamd-Result":"default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[];\n R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000];\n MIME_GOOD(-0.10)[text/plain];\n FUZZY_RATELIMITED(0.00)[rspamd.com];\n RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1];\n ARC_NA(0.00)[];\n DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.cz:mid,suse.cz:email];\n FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[];\n MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2];\n TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[];\n PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it];\n RCVD_TLS_ALL(0.00)[]","X-Spam-Score":"-2.80","X-Spam-Level":"","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-7.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-7.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"[LTP] [PATCH 03/17] lib: tst_kernel: Add tst_check_module_driver()","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"},"content":"This function allows us to check for presence of drivers build as\nmodules.\n\nSigned-off-by: Cyril Hrubis <chrubis@suse.cz>\n---\n include/tst_kernel.h | 10 ++++++++++\n lib/tst_kernel.c     | 12 +++++++-----\n 2 files changed, 17 insertions(+), 5 deletions(-)","diff":"diff --git a/include/tst_kernel.h b/include/tst_kernel.h\nindex 63ecb19a4..d5a4a9625 100644\n--- a/include/tst_kernel.h\n+++ b/include/tst_kernel.h\n@@ -45,6 +45,16 @@ bool tst_abi_bits(int abi);\n  */\n int tst_check_builtin_driver(const char *driver);\n \n+/**\n+ * tst_check_module_driver() - Check if the kernel module is present.\n+ *\n+ * @driver: the name of the driver.\n+ *\n+ * Return: 0 if module driver is present or -1 when driver is missing or config file not\n+ * available. On Android *always* 0 (always expect the module is present).\n+ */\n+int tst_check_module_driver(const char *driver);\n+\n /**\n  * tst_check_driver() - Check support for the kernel module.\n  *\ndiff --git a/lib/tst_kernel.c b/lib/tst_kernel.c\nindex 8bb7e080a..8f7503c02 100644\n--- a/lib/tst_kernel.c\n+++ b/lib/tst_kernel.c\n@@ -200,16 +200,18 @@ static int tst_search_driver(const char *driver, const char *file)\n \n int tst_check_builtin_driver(const char *driver)\n {\n-\tif (!tst_search_driver(driver, \"modules.builtin\"))\n-\t\treturn 0;\n+\treturn tst_search_driver(driver, \"modules.builtin\");\n+}\n \n-\treturn -1;\n+int tst_check_module_driver(const char *driver)\n+{\n+\treturn tst_search_driver(driver, \"modules.dep\");\n }\n \n int tst_check_driver(const char *driver)\n {\n-\tif (!tst_search_driver(driver, \"modules.dep\") ||\n-\t\t!tst_check_builtin_driver(driver))\n+\tif (!tst_check_module_driver(driver) ||\n+\t    !tst_check_builtin_driver(driver))\n \t\treturn 0;\n \n \treturn -1;\n","prefixes":["03/17"]}