Re: [PATCH v7 3/4] driver core: platform: unify release path
From: Danilo Krummrich
Date: Wed Jul 15 2026 - 11:21:15 EST
On Wed Jul 15, 2026 at 5:06 PM CEST, Bartosz Golaszewski wrote:
> On Wed, 15 Jul 2026 15:52:07 +0200, Bartosz Golaszewski <brgl@xxxxxxxxxx> said:
>> On Mon, 13 Jul 2026 20:45:13 +0200, Danilo Krummrich <dakr@xxxxxxxxxx> said:
>>> On Mon Jul 13, 2026 at 5:11 PM CEST, Bartosz Golaszewski wrote:
>>>
>>> So, either we have to special case platform_device_set_of_node() too (for the
>>> case that a swnode is set already), or just require that the function must only
>>> be called when no node has been set, as all users already do; I'd go for the
>>> latter.
>>
>> This sounds good too and it should be easy to implement another test case while
>> at it.
>
> Oh but wouldn't that require us to introduce an integer return value for these
> functions? Or are you talking about simply updating the API contract?
Yes, we could update the API contract; we could also consider adding a WARN_ON()
for the case a node is already set.
> I think calling device_remove_software_node() on
> is_software_node(dev_fwnode(dev)) in platform_device_set_fwnode() be enough
> to handle that case, right?
Yes, we can special case it, but the "replace the existing node if any" part of
that function is already dead code.
So, if no one needs it now, I'd rather remove it and wait for someone to have a
valid use-case.