mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Jonas Richardsen <jonasrichardsen@emlix.com>,
	barebox@lists.infradead.org
Subject: Re: raspi: should vc fixups update properties of existing nodes?
Date: Wed, 10 Apr 2024 13:51:29 +0200	[thread overview]
Message-ID: <9010811a-0bf2-45bb-8efa-7ad27f60f565@pengutronix.de> (raw)
In-Reply-To: <3e01cb35-858c-4aef-b0c6-564cc890086d@emlix.com>

Hello Jonas,

On 10.04.24 11:59, Jonas Richardsen wrote:
> Hi,
> 
> the function `rpi_vc_fdt_parse` in arch/arm/boards/raspberry-pi/rpi-common.c registers multiple fixups that take over nodes from the video core device tree. These fixups make use of the `of_copy_property` function to copy the properties of the respective node. In the case of already existing nodes (and properties), this function duplicates the properties instead of updating them.

Ouch.

> If the intention is to not override existing properties, one should probably check for the existence of each property before copying to avoid kernel warnings and misconfiguration due to duplicate properties.

I think that's the way to go. of_copy_property should maybe return
PTR_ERR(-EEXIST) if the property already exists. Users are free to
use of_delete_property_by_name beforehand if they want to remove
the content.

> If existing properties are supposed to be updated, this could be achieved by switching to `of_set_property` (or something similar). Note that this notion of overriding properties also exists in video core, see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/broadcom/bcm2711.dtsi?h=v6.8#n412 for an example.

I think the default should be not to override and exceptions should
be done explicitly.

> I would be glad to submit a patch for either case.

That would be great!

Thanks,
Ahmad

> 
> Regards,
> 
> Jonas
> 
> 
> 

-- 
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:[~2024-04-10 11:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10  9:59 Jonas Richardsen
2024-04-10 11:51 ` Ahmad Fatoum [this message]
2024-04-15  8:14   ` [PATCH] of: do not copy properties if they already exist in the destination Jonas Richardsen
2024-04-15  8:30     ` Ahmad Fatoum
2024-04-15 12:26       ` [PATCH v2] " Jonas Richardsen
2024-04-16 13:38         ` 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=9010811a-0bf2-45bb-8efa-7ad27f60f565@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jonasrichardsen@emlix.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