public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Tzung-Bi Shih <tzungbi@kernel.org>,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	Linus Walleij <linusw@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Simona Vetter <simona.vetter@ffwll.ch>,
	Dan Williams <dan.j.williams@intel.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>
Subject: [PATCH 2/3] Revert "revocable: Add Kunit test cases"
Date: Sat, 24 Jan 2026 18:05:34 +0100	[thread overview]
Message-ID: <20260124170535.11756-3-johan@kernel.org> (raw)
In-Reply-To: <20260124170535.11756-1-johan@kernel.org>

This reverts commit d9a1ff40f5aa9b493f26812c8850423e386ba7c9.

The new revocable functionality is fundamentally broken and at a minimum
needs to be redesigned.

Drop the revocable Kunit tests to allow the implementation to be reverted.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 MAINTAINERS                   |   1 -
 drivers/base/Kconfig          |   8 --
 drivers/base/Makefile         |   3 -
 drivers/base/revocable_test.c | 142 ----------------------------------
 4 files changed, 154 deletions(-)
 delete mode 100644 drivers/base/revocable_test.c

diff --git a/MAINTAINERS b/MAINTAINERS
index bf38181c07e4..fac638cbb40a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22375,7 +22375,6 @@ M:	Tzung-Bi Shih <tzungbi@kernel.org>
 L:	linux-kernel@vger.kernel.org
 S:	Maintained
 F:	drivers/base/revocable.c
-F:	drivers/base/revocable_test.c
 F:	include/linux/revocable.h
 
 RFKILL
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 8f7d7b9d81ac..1786d87b29e2 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -250,11 +250,3 @@ config FW_DEVLINK_SYNC_STATE_TIMEOUT
 	  work on.
 
 endmenu
-
-# Kunit test cases
-config REVOCABLE_KUNIT_TEST
-	tristate "Kunit tests for revocable" if !KUNIT_ALL_TESTS
-	depends on KUNIT
-	default KUNIT_ALL_TESTS
-	help
-	  Kunit tests for the revocable API.
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index 4185aaa9bbb9..bdf854694e39 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -35,6 +35,3 @@ ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
 # define_trace.h needs to know how to find our header
 CFLAGS_trace.o		:= -I$(src)
 obj-$(CONFIG_TRACING)	+= trace.o
-
-# Kunit test cases
-obj-$(CONFIG_REVOCABLE_KUNIT_TEST)	+= revocable_test.o
diff --git a/drivers/base/revocable_test.c b/drivers/base/revocable_test.c
deleted file mode 100644
index 873a44082b6c..000000000000
--- a/drivers/base/revocable_test.c
+++ /dev/null
@@ -1,142 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright 2026 Google LLC
- *
- * Kunit tests for the revocable API.
- *
- * The test cases cover the following scenarios:
- *
- * - Basic: Verifies that a consumer can successfully access the resource
- *   provided via the provider.
- *
- * - Revocation: Verifies that after the provider revokes the resource,
- *   the consumer correctly receives a NULL pointer on a subsequent access.
- *
- * - Try Access Macro: Same as "Revocation" but uses the
- *   REVOCABLE_TRY_ACCESS_WITH() and REVOCABLE_TRY_ACCESS_SCOPED().
- */
-
-#include <kunit/test.h>
-#include <linux/revocable.h>
-
-static void revocable_test_basic(struct kunit *test)
-{
-	struct revocable_provider *rp;
-	struct revocable *rev;
-	void *real_res = (void *)0x12345678, *res;
-
-	rp = revocable_provider_alloc(real_res);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rp);
-
-	rev = revocable_alloc(rp);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rev);
-
-	res = revocable_try_access(rev);
-	KUNIT_EXPECT_PTR_EQ(test, res, real_res);
-	revocable_withdraw_access(rev);
-
-	revocable_free(rev);
-	revocable_provider_revoke(rp);
-}
-
-static void revocable_test_revocation(struct kunit *test)
-{
-	struct revocable_provider *rp;
-	struct revocable *rev;
-	void *real_res = (void *)0x12345678, *res;
-
-	rp = revocable_provider_alloc(real_res);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rp);
-
-	rev = revocable_alloc(rp);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rev);
-
-	res = revocable_try_access(rev);
-	KUNIT_EXPECT_PTR_EQ(test, res, real_res);
-	revocable_withdraw_access(rev);
-
-	revocable_provider_revoke(rp);
-
-	res = revocable_try_access(rev);
-	KUNIT_EXPECT_PTR_EQ(test, res, NULL);
-	revocable_withdraw_access(rev);
-
-	revocable_free(rev);
-}
-
-static void revocable_test_try_access_macro(struct kunit *test)
-{
-	struct revocable_provider *rp;
-	struct revocable *rev;
-	void *real_res = (void *)0x12345678, *res;
-
-	rp = revocable_provider_alloc(real_res);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rp);
-
-	rev = revocable_alloc(rp);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rev);
-
-	{
-		REVOCABLE_TRY_ACCESS_WITH(rev, res);
-		KUNIT_EXPECT_PTR_EQ(test, res, real_res);
-	}
-
-	revocable_provider_revoke(rp);
-
-	{
-		REVOCABLE_TRY_ACCESS_WITH(rev, res);
-		KUNIT_EXPECT_PTR_EQ(test, res, NULL);
-	}
-
-	revocable_free(rev);
-}
-
-static void revocable_test_try_access_macro2(struct kunit *test)
-{
-	struct revocable_provider *rp;
-	struct revocable *rev;
-	void *real_res = (void *)0x12345678, *res;
-	bool accessed;
-
-	rp = revocable_provider_alloc(real_res);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rp);
-
-	rev = revocable_alloc(rp);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rev);
-
-	accessed = false;
-	REVOCABLE_TRY_ACCESS_SCOPED(rev, res) {
-		KUNIT_EXPECT_PTR_EQ(test, res, real_res);
-		accessed = true;
-	}
-	KUNIT_EXPECT_TRUE(test, accessed);
-
-	revocable_provider_revoke(rp);
-
-	accessed = false;
-	REVOCABLE_TRY_ACCESS_SCOPED(rev, res) {
-		KUNIT_EXPECT_PTR_EQ(test, res, NULL);
-		accessed = true;
-	}
-	KUNIT_EXPECT_TRUE(test, accessed);
-
-	revocable_free(rev);
-}
-
-static struct kunit_case revocable_test_cases[] = {
-	KUNIT_CASE(revocable_test_basic),
-	KUNIT_CASE(revocable_test_revocation),
-	KUNIT_CASE(revocable_test_try_access_macro),
-	KUNIT_CASE(revocable_test_try_access_macro2),
-	{}
-};
-
-static struct kunit_suite revocable_test_suite = {
-	.name = "revocable_test",
-	.test_cases = revocable_test_cases,
-};
-
-kunit_test_suite(revocable_test_suite);
-
-MODULE_DESCRIPTION("KUnit tests for the revocable API");
-MODULE_LICENSE("GPL");
-- 
2.52.0


  parent reply	other threads:[~2026-01-24 17:15 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-24 17:05 [PATCH 0/3] Revert "revocable: Revocable resource management" Johan Hovold
2026-01-24 17:05 ` [PATCH 1/3] Revert "selftests: revocable: Add kselftest cases" Johan Hovold
2026-01-24 17:05 ` Johan Hovold [this message]
2026-01-24 17:05 ` [PATCH 3/3] Revert "revocable: Revocable resource management" Johan Hovold
2026-01-24 17:37   ` Johan Hovold
2026-01-24 17:46   ` Danilo Krummrich
2026-01-26 13:20     ` Johan Hovold
2026-01-27 15:57       ` Tzung-Bi Shih
2026-01-24 18:42 ` [PATCH 0/3] " Laurent Pinchart
2026-01-24 19:08 ` Danilo Krummrich
2026-01-25 12:47   ` Greg Kroah-Hartman
2026-01-25 13:22     ` Laurent Pinchart
2026-01-25 14:07       ` Danilo Krummrich
2026-01-29  1:09         ` Laurent Pinchart
2026-01-25 13:24     ` Laurent Pinchart
2026-01-25 17:53     ` Danilo Krummrich
2026-01-26  0:07       ` Jason Gunthorpe
2026-01-26 16:08         ` Danilo Krummrich
2026-01-26 17:07           ` Jason Gunthorpe
2026-01-26 22:36             ` Danilo Krummrich
2026-01-28 23:40             ` Laurent Pinchart
2026-01-26 13:50     ` Johan Hovold
2026-01-27 21:18       ` Bartosz Golaszewski
2026-01-27 23:52         ` Jason Gunthorpe
2026-01-28  9:40           ` Bartosz Golaszewski
2026-01-28 10:01             ` Wolfram Sang
2026-01-28 15:05               ` Jason Gunthorpe
2026-01-28 15:20                 ` Bartosz Golaszewski
2026-01-28 16:01                   ` Jason Gunthorpe
2026-01-30 11:27                     ` Bartosz Golaszewski
2026-01-28 16:58                 ` Wolfram Sang
2026-01-29  1:08           ` Laurent Pinchart
2026-01-29  1:23             ` Jason Gunthorpe
2026-01-29  3:42               ` dan.j.williams
2026-01-29  9:56                 ` Danilo Krummrich
2026-01-29 10:43                   ` Laurent Pinchart
2026-01-30  0:36                   ` dan.j.williams
2026-01-29 10:38               ` Laurent Pinchart
2026-01-29 13:34                 ` Jason Gunthorpe
2026-01-29 14:52                   ` Laurent Pinchart
2026-01-29 22:29             ` Danilo Krummrich
2026-01-30  9:10               ` Laurent Pinchart
2026-02-03  9:10                 ` Maxime Ripard
2026-02-03 13:59                   ` Laurent Pinchart
2026-01-28 15:48         ` Johan Hovold
2026-01-29  9:11           ` Bartosz Golaszewski
2026-01-29 10:56             ` Laurent Pinchart
2026-01-29 13:50               ` Bartosz Golaszewski
2026-01-29 14:28                 ` Jason Gunthorpe
2026-01-29 14:45                   ` Laurent Pinchart
2026-01-29 14:49                 ` Laurent Pinchart
2026-01-29 22:00                   ` Danilo Krummrich
2026-01-30 11:19                   ` Bartosz Golaszewski
2026-01-29 13:27           ` Linus Walleij
2026-02-03 12:15       ` Johan Hovold
2026-02-03 12:26         ` Greg Kroah-Hartman
2026-02-03 12:30           ` [PATCH] driver core: disable revocable code from build Greg Kroah-Hartman
2026-02-03 13:20             ` Danilo Krummrich
2026-02-04  2:14             ` Tzung-Bi Shih
2026-02-04  5:28               ` [PATCH] selftests: Disable " Tzung-Bi Shih
2026-02-04  8:21                 ` Greg Kroah-Hartman
2026-02-03 13:57           ` [PATCH 0/3] Revert "revocable: Revocable resource management" Laurent Pinchart
2026-02-03 15:44             ` Greg Kroah-Hartman
2026-02-04 14:36           ` Johan Hovold
2026-01-27 15:57 ` Tzung-Bi Shih
2026-01-28 14:23   ` Johan Hovold
2026-01-28 23:28     ` Laurent Pinchart
2026-01-29 15:01   ` Tzung-Bi Shih
2026-01-30  9:12     ` Laurent Pinchart
2026-01-30 17:41       ` Danilo Krummrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260124170535.11756-3-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=corbet@lwn.net \
    --cc=dakr@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@nvidia.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linusw@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=shuah@kernel.org \
    --cc=simona.vetter@ffwll.ch \
    --cc=tzungbi@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox