From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Cesar Cibrian <cesarcibrian.ai@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Lee Jones <lee@kernel.org>,
mfd@lists.linux.dev,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, Danilo Krummrich <dakr@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Johan Hovold <johan@kernel.org>
Subject: Re: [PATCH] mfd: core: Remove software node after unregistering platform device
Date: Fri, 4 Dec 2026 21:47:14 +0200 [thread overview]
Message-ID: <axMYwoqm-MtmhL6_@ashevche-desk.local> (raw)
In-Reply-To: <20261204181605.22364-1-cesarcibrian.ai@gmail.com>
On Fri, Dec 04, 2026 at 10:16:05AM -0800, Cesar Cibrian wrote:
> mfd_add_device() attaches cell->swnode before calling
> platform_device_add(), but mfd_remove_devices_fn() calls
> device_remove_software_node() before platform_device_unregister().
>
> If the child driver propagates dev_fwnode() to a sub-device (for
> example, i2c-designware sharing its fwnode with the i2c_adapter
> device on Intel LPSS), removing the software node first clears
> fwnode->secondary while the sub-device is still registered. When
> platform_device_unregister() subsequently tears down the child,
> software_node_notify_remove() sees dev_to_swnode() == NULL on the
> sub-device and skips cleanup, leaking a swnode reference and
> leaving a stale sysfs symlink that triggers a warning on rebind:
>
> sysfs: cannot create duplicate filename '/kernel/software_nodes/node0/i2c-0'
>
> Move device_remove_software_node() after platform_device_unregister()
> (device_for_each_child_reverse() holds a reference on dev throughout
> mfd_remove_devices_fn()). Because acpi_unbind_one() calls
> set_primary_fwnode(dev, NULL), which skips clearing fn->secondary
> when fn == dev->parent->fwnode, also clear the parent's secondary
> fwnode when the child shared its parent's fwnode so rebinding does
> not fail with -EBUSY.
I believe it's a local hack against bigger issue which is discussed here
https://lore.kernel.org/lkml/20261202-swnode-shared-primary-fix-v1-0-7ff23caaa1ed@gmail.com/
I Cc'ed people from that thread. Meanwhile, can you test the proposed series
and confirm if it fixes your issue or not?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-12-04 19:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:16 Cesar Cibrian
2026-12-04 19:47 ` Andy Shevchenko [this message]
2026-12-04 20:12 ` Dmitry Torokhov
2026-12-04 20:21 ` Andy Shevchenko
2026-12-04 20:27 ` Dmitry Torokhov
2026-12-04 22:29 ` Julio Cesar Martinez Cibrian
2026-12-04 22:34 ` Dmitry Torokhov
2026-12-05 23:06 ` Danilo Krummrich
2026-12-05 11:00 ` Andy Shevchenko
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=axMYwoqm-MtmhL6_@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=cesarcibrian.ai@gmail.com \
--cc=dakr@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=johan@kernel.org \
--cc=lee@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfd@lists.linux.dev \
/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
all inboxes | Powered by JetHome®