devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: David Gow <davidgow@google.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	patches@lists.linux.dev, kunit-dev@googlegroups.com,
	linux-kselftest@vger.kernel.org, devicetree@vger.kernel.org,
	Brendan Higgins <brendan.higgins@linux.dev>,
	Rae Moar <rmoar@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rafael J . Wysocki <rafael@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	Daniel Latypov <dlatypov@google.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Maxime Ripard <maxime@cerno.tech>
Subject: Re: [PATCH v6 5/8] platform: Add test managed platform_device/driver APIs
Date: Sun, 07 Jul 2024 11:08:52 -0700	[thread overview]
Message-ID: <b07579a09b59a75cbf74aa972165f90d.sboyd@kernel.org> (raw)
In-Reply-To: <34d38e79a2008ed6e4303e6911b1cf08.sboyd@kernel.org>

Quoting Stephen Boyd (2024-07-07 11:02:06)
> Quoting David Gow (2024-07-06 01:04:25)
> > On Sat, 6 Jul 2024 at 12:55, Stephen Boyd <sboyd@kernel.org> wrote:
> > >
> > > Introduce KUnit resource wrappers around platform_driver_register(),
> > > platform_device_alloc(), and platform_device_add() so that test authors
> > > can register platform drivers/devices from their tests and have the
> > > drivers/devices automatically be unregistered when the test is done.
> > >
> > > This makes test setup code simpler when a platform driver or platform
> > > device is needed. Add a few test cases at the same time to make sure the
> > > APIs work as intended.
> > >
> > > Cc: Brendan Higgins <brendan.higgins@linux.dev>
> > > Reviewed-by: David Gow <davidgow@google.com>
> > > Cc: Rae Moar <rmoar@google.com>
> > > Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > > Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> > > ---
> > 
> > Hmm... this is failing under KASAN for me. I'll take a closer look
> > next week, but in case there's anything super-obvious, here's the
> > report:
> 
> Thanks. I reproduced with your commandline and I'll take a look.
> 

Seems that I forgot to fold this in when I was testing.

----8<---
diff --git a/lib/kunit/platform.c b/lib/kunit/platform.c
index ba1b0006dc45..0b518de26065 100644
--- a/lib/kunit/platform.c
+++ b/lib/kunit/platform.c
@@ -75,7 +75,7 @@ kunit_platform_device_alloc_match(struct kunit *test,
 {
 	struct platform_device *pdev = match_data;
 
-	return res->data == pdev && res->free != kunit_platform_device_alloc_exit;
+	return res->data == pdev && res->free == kunit_platform_device_alloc_exit;
 }
 
 KUNIT_DEFINE_ACTION_WRAPPER(platform_device_unregister_wrapper,

  reply	other threads:[~2024-07-07 18:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-06  4:54 [PATCH v6 0/8] clk: Add kunit tests for fixed rate and parent data Stephen Boyd
2024-07-06  4:54 ` [PATCH v6 1/8] of/platform: Allow overlays to create platform devices from the root node Stephen Boyd
2024-07-06  4:54 ` [PATCH v6 2/8] of: Add test managed wrappers for of_overlay_apply()/of_node_put() Stephen Boyd
2024-07-06  4:54 ` [PATCH v6 3/8] dt-bindings: vendor-prefixes: Add "test" vendor for KUnit and friends Stephen Boyd
2024-07-06  4:54 ` [PATCH v6 4/8] of: Add a KUnit test for overlays and test managed APIs Stephen Boyd
2024-07-09 14:49   ` Jeff Johnson
2024-07-09 19:49     ` Stephen Boyd
2024-07-06  4:54 ` [PATCH v6 5/8] platform: Add test managed platform_device/driver APIs Stephen Boyd
2024-07-06  8:04   ` David Gow
2024-07-07 18:02     ` Stephen Boyd
2024-07-07 18:08       ` Stephen Boyd [this message]
2024-07-06  4:54 ` [PATCH v6 6/8] clk: Add test managed clk provider/consumer APIs Stephen Boyd
2024-07-06  4:54 ` [PATCH v6 7/8] clk: Add KUnit tests for clk fixed rate basic type Stephen Boyd
2024-07-06  4:54 ` [PATCH v6 8/8] clk: Add KUnit tests for clks registered with struct clk_parent_data Stephen Boyd

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=b07579a09b59a75cbf74aa972165f90d.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=ansuelsmth@gmail.com \
    --cc=brendan.higgins@linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=davidgow@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dlatypov@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=mturquette@baylibre.com \
    --cc=patches@lists.linux.dev \
    --cc=rafael@kernel.org \
    --cc=rmoar@google.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.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;
as well as URLs for NNTP newsgroup(s).