Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>,
	David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>,
	Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Linus Walleij <linusw@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com, linux-acpi@vger.kernel.org,
	driver-core@lists.linux.dev, linux-gpio@vger.kernel.org
Subject: Re: [PATCH 5/5] gpio: kunit: add test cases verifying swnode devlink support
Date: Mon, 29 Jun 2026 18:58:16 +0300	[thread overview]
Message-ID: <akKWGNpGmHjWYdfX@ashevche-desk.local> (raw)
In-Reply-To: <20260629-swnode-fw-devlink-v1-5-b90058b41839@oss.qualcomm.com>

On Mon, Jun 29, 2026 at 12:52:10PM +0200, Bartosz Golaszewski wrote:
> The software node fw_devlink support already has its own kunit suite, but
> that verifies the fwnode links in isolation. Add GPIO tests that prove
> the ordering works in a real-life use-case: a GPIO consumer that
> references its provider via a software node.
> 
> The first suite registers the provider's software node, adds the consumer
> device first and checks that fw_devlink defers its probe until the
> provider has been added and bound. The second covers the fallback:
> with the provider's software node not yet registered no supplier link is
> created, so the consumer probes, devm_gpiod_get() returns -EPROBE_DEFER
> and the consumer only binds once the provider shows up.
> 
> While at it: the existing gpio_unbind_with_consumers() test keeps the
> consumer bound while the provider goes away and then operates the orphaned
> descriptor. With software nodes now being covered by fw_devlink that would
> instead force-unbind the consumer along with the provider, so opt it out
> by setting FWNODE_FLAG_LINKS_ADDED.

...

+ cleanup.h // guard()()
+ err.h // IS_ERR()

>  #include <linux/platform_device.h>
>  #include <linux/property.h>

+ types.h // bool

> +#include <kunit/fwnode.h>
>  #include <kunit/platform_device.h>
>  #include <kunit/test.h>

...

> +	properties[1] = (struct property_entry){ };

Just zero the whole array at the definition time.

...

> +	pdevinfo = (struct platform_device_info){

It's better to have a space after ).

> +		.name = GPIO_PROBE_ORDER_TEST_CONSUMER,
> +		.id = PLATFORM_DEVID_NONE,
> +		.data = &gpio_probe_order_pdata_template,
> +		.size_data = sizeof(gpio_probe_order_pdata_template),
> +		.properties = properties,
> +	};

...

> +	pdevinfo = (struct platform_device_info){

Ditto.

> +		.name = GPIO_TEST_PROVIDER,
> +		.id = PLATFORM_DEVID_NONE,
> +		.swnode = &gpio_test_provider_swnode,
> +	};

...

> +struct gpio_probe_defer_pdata {
> +	int probe_count;

Why is this signed?

> +	int gpio_err;
> +};

...

> +static int gpio_probe_defer_consumer_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct gpio_probe_defer_pdata *pdata = dev_get_platdata(dev);
> +	struct gpio_desc *desc;

> +	pdata->probe_count++;

Even in case of error?

> +	desc = devm_gpiod_get(dev, "foo", GPIOD_OUT_HIGH);
> +	if (IS_ERR(desc)) {
> +		pdata->gpio_err = PTR_ERR(desc);
> +		return pdata->gpio_err;
> +	}
> +
> +	pdata->gpio_err = 0;
> +
> +	return 0;
> +}

...

> +static void gpio_swnode_probe_defer_on_unregistered(struct kunit *test)

As per above.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-06-29 15:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 10:52 [PATCH 0/5] software node: provide support for fw_devlink Bartosz Golaszewski
2026-06-29 10:52 ` [PATCH 1/5] kunit: provide a set of fwnode-oriented helpers Bartosz Golaszewski
2026-06-29 10:52 ` [PATCH 2/5] software node: add fw_devlink support Bartosz Golaszewski
2026-06-29 15:42   ` Andy Shevchenko
2026-06-30  6:16     ` Herve Codina
2026-07-06 11:34     ` Bartosz Golaszewski
2026-06-29 10:52 ` [PATCH 3/5] software node: add kunit tests for " Bartosz Golaszewski
2026-06-29 15:49   ` Andy Shevchenko
2026-07-06 11:42     ` Bartosz Golaszewski
2026-07-06 20:05       ` Andy Shevchenko
2026-07-07  7:27         ` Bartosz Golaszewski
2026-06-29 10:52 ` [PATCH 4/5] MAINTAINERS: add myself as reviewer of software node support Bartosz Golaszewski
2026-06-29 11:20   ` Andy Shevchenko
2026-06-29 10:52 ` [PATCH 5/5] gpio: kunit: add test cases verifying swnode devlink support Bartosz Golaszewski
2026-06-29 15:58   ` Andy Shevchenko [this message]
2026-07-06 12:32     ` Bartosz Golaszewski
2026-07-06 20:09       ` Andy Shevchenko
2026-07-07  7:25         ` Bartosz Golaszewski

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=akKWGNpGmHjWYdfX@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brendan.higgins@linux.dev \
    --cc=brgl@kernel.org \
    --cc=dakr@kernel.org \
    --cc=david@davidgow.net \
    --cc=djrscally@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linusw@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=raemoar63@gmail.com \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.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