From: Marco Felsch <m.felsch@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 15/18] common: add initial barebox deep-probe support
Date: Tue, 29 Sep 2020 17:55:00 +0200 [thread overview]
Message-ID: <20200929155500.GE20189@pengutronix.de> (raw)
In-Reply-To: <748eb0a5-a5ac-7be2-d909-f3af184db38d@pengutronix.de>
Hi Ahmad,
thanks for the review.
On 20-09-28 18:53, Ahmad Fatoum wrote:
> > --- /dev/null
> > +++ b/common/deep-probe.c
> > @@ -0,0 +1,39 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +
> > +#include <common.h>
> > +#include <deep-probe.h>
>
> Shouldn't this rather be under drivers/of/ ?
> maybe also name it something starting with of_ ?
I'm not sure. Currently it works only for OF but it can be adapted to
ACPI too. Therefore I thought it shouldn't be placed into drivers/of and
shouldn't start with of_*.
> > +int deep_probe_add_board(const char *machine)
> > +{
> > + struct deep_probe_entry *new_machine;
> > +
> > + new_machine = xzalloc(sizeof(*new_machine));
> > + if (!new_machine)
> > + return -ENOMEM;
>
> xzalloc can't fail.
>
> > +
> > + new_machine->compatible = machine;
> > + list_add(&new_machine->entry, &boards);
> > +
> > + return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(deep_probe_add_board);
The whole logic was replaced by an static linker array as we do for the
magicvar.
> > --- a/drivers/i2c/i2c.c
> > +++ b/drivers/i2c/i2c.c
> > @@ -406,6 +406,7 @@ static struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
> > return NULL;
> > }
> > client->dev.info = i2c_info;
> > + chip->of_node->dev = &client->dev;
>
> Are you sure, you can always assume of_node != NULL here?
Good catch, didn't checked the non-dt callers.. Fixed it in v2.
> > struct device_d *of_find_device_by_node(struct device_node *np)
> > {
> > struct device_d *dev;
> > +
> > + dev = of_device_create_on_demand(np);
> > + if (IS_ERR(dev))
> > + return NULL;
> > +
> > for_each_device(dev)
> > if (dev->device_node == np)
> > return dev;
> > @@ -106,6 +112,9 @@ struct device_d *of_platform_device_create(struct device_node *np,
> > if (!of_device_is_available(np))
> > return NULL;
> >
> > + if (np->dev)
> > + return np->dev;
> > +
>
> Unsure if this is correct. Seek down to the "check if all address resources match" comment.
> It's possible that devices are registered multiple times and are coalesced later on.
> I can't say for sure though, where we are doing this at the moment.
I see.. Let me check this.
> > +struct device_d *
> > +of_device_create_on_demand_by_dev_id(struct device_node *np,
> > + const struct of_device_id *ids)
> > +{
>
> I find it surprising that this works recursively, while the previous
> by_alias doesn't
I converted the name to of_devices_* to reflect that and added a
function documentation. I hope this avoids further confusions.
> > +static inline struct device_d *
> > +of_device_create_on_demand(struct device_node *np);
>
> Extra semicolon. Could you compile test without CONFIG_OFTREE?
Unfortunately not, thanks for covering that. Fixed it in v2.
Regards,
Marco
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-09-29 15:55 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 15:50 [PATCH 00/18] Barebox Deep-Probe Marco Felsch
2020-09-28 15:50 ` [PATCH 01/18] video: ssd1307fb: fix VBAT supply id Marco Felsch
2020-09-28 15:58 ` Ahmad Fatoum
2020-09-28 15:50 ` [PATCH 02/18] ARM: boards: mx6-sabrelite: [cosmetic] make use of IMX_GPIO_NR Marco Felsch
2020-09-28 16:00 ` Ahmad Fatoum
2020-09-28 15:50 ` [PATCH 03/18] drivers: gpio: treewide: [cosmetic] use register_driver_macros Marco Felsch
2020-09-28 16:04 ` Ahmad Fatoum
2020-09-29 8:20 ` Sascha Hauer
2020-09-28 15:50 ` [PATCH 04/18] ARM: mx6-sabrelite: remove obsolete sabrelite_mem_init() Marco Felsch
2020-09-28 16:07 ` Ahmad Fatoum
2020-09-28 15:50 ` [PATCH 05/18] spi: core: don't ignore register_device failures Marco Felsch
2020-09-28 15:50 ` [PATCH 06/18] regulator: improve of_regulator_register error handling Marco Felsch
2020-09-28 15:50 ` [PATCH 07/18] regulator: test of_regulator_register input before accessing it Marco Felsch
2020-09-28 16:11 ` Ahmad Fatoum
2020-09-28 15:50 ` [PATCH 08/18] regulator: stpmic1: fix registering missed regulators Marco Felsch
2020-09-28 15:50 ` [PATCH 09/18] regulator: add device reference to regulator_dev Marco Felsch
2020-09-28 15:50 ` [PATCH 10/18] regulator: treewide: drop local device_d reference Marco Felsch
2020-09-28 15:50 ` [PATCH 11/18] of: platform: fix of_amba_device_create stub return value Marco Felsch
2020-09-28 15:50 ` [PATCH 12/18] of: base: move memory init from DT to initcall Marco Felsch
2020-09-28 15:50 ` [PATCH 13/18] of: base: move clock init from of_probe() to barebox_register_of() Marco Felsch
2020-09-28 15:50 ` [PATCH 14/18] initcall: add of_populate_initcall Marco Felsch
2020-09-28 15:50 ` [PATCH 15/18] common: add initial barebox deep-probe support Marco Felsch
2020-09-28 16:53 ` Ahmad Fatoum
2020-09-29 15:55 ` Marco Felsch [this message]
2020-09-28 15:50 ` [PATCH 16/18] ARM: i.MX: esdctl: add " Marco Felsch
2020-09-28 15:50 ` [PATCH 17/18] ARM: stm32mp: ddrctrl: " Marco Felsch
2020-09-28 15:50 ` [PATCH 18/18] ARM: boards: mx6-sabrelite: " Marco Felsch
2020-09-28 16:58 ` Ahmad Fatoum
2020-09-29 8:30 ` [PATCH 00/18] Barebox Deep-Probe Sascha Hauer
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=20200929155500.GE20189@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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