mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <sha@pengutronix.de>, Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] test: self: add basic regulator selftest
Date: Tue, 2 May 2023 12:04:04 +0200	[thread overview]
Message-ID: <239f2cda-c2ff-e746-cffb-52760fc03d53@pengutronix.de> (raw)
In-Reply-To: <20230502092247.GV13543@pengutronix.de>

Hello Sascha,

On 02.05.23 11:22, Sascha Hauer wrote:
> On Mon, Apr 24, 2023 at 01:59:08PM +0200, Ahmad Fatoum wrote:
>> This simple test verifies registration and always-on enabling and disabling
>> work as they should. It may be extended in future to support more
>> complex cases.
>>
>> +static const struct of_device_id test_regulator_of_match[] = {
>> +	{ .compatible = "barebox,regulator-self-test" },
>> +	{ /* sentintel */ },
>> +};
>> +
>> +static struct driver regulator_test_driver = {
>> +	.name = "regulator-test",
>> +	.probe = regulator_probe,
>> +	.of_match_table = test_regulator_of_match,
>> +};
>> +
>> +static struct device_d *dev;
>> +
>> +static void test_regulator(void)
>> +{
>> +	extern char __dtbo_test_regulator_start[];
>> +	struct device_node *overlay;
>> +	int ret;
>> +
>> +	if (!dev) {
>> +		ret = platform_driver_register(&regulator_test_driver);
>> +		if (ret)
>> +			return;
>> +
>> +		overlay = of_unflatten_dtb(__dtbo_test_regulator_start, INT_MAX);
>> +		of_overlay_apply_tree(of_get_root_node(), overlay);
>> +		of_probe();
> 
> This needs CONFIG_OF_OVERLAY_LIVE enabled to work. Should we make sure
> this option is enabled before running this test?

No, it doesn't. The overlay has no phandle references into the barebox
live tree, so it can be applied without symbols. This is similar to the
QEMU overlay, where the QEMU-provided DT also lacks symbols.

Cheers,
Ahmad

> 
> Sascha
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2023-05-02 10:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 11:59 [PATCH 1/2] regulator: core: add debug print for regulator_resolve_supply Ahmad Fatoum
2023-04-24 11:59 ` [PATCH 2/2] test: self: add basic regulator selftest Ahmad Fatoum
2023-05-02  9:22   ` Sascha Hauer
2023-05-02 10:04     ` Ahmad Fatoum [this message]
2023-05-02 11:22       ` Sascha Hauer
2023-05-02 10:02   ` [PATCH] fixup! " Ahmad Fatoum

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=239f2cda-c2ff-e746-cffb-52760fc03d53@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.de \
    /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