Re: [PATCH 2/2] test: self: add basic regulator selftest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 02, 2023 at 12:04:04PM +0200, Ahmad Fatoum wrote:
> 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.

Ok, I see. It still needs CONFIG_OF_OVERLAY though. Without it
of_overlay_apply_tree will be a stub.

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 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux