mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pratap Nirujogi <pratap.nirujogi@amd.com>
To: <lee@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <benjamin.chan@amd.com>,
	<bin.du@amd.com>, <grosikop@amd.com>, <king.li@amd.com>,
	<dantony@amd.com>, <phil.jawich@amd.com>,
	Pratap Nirujogi <pratap.nirujogi@amd.com>
Subject: [PATCH] mfd: core: Fix MFD swnode and fwnode conflict
Date: Wed, 11 Jun 2025 18:56:14 -0400	[thread overview]
Message-ID: <20250611225642.266069-1-pratap.nirujogi@amd.com> (raw)

Initializing the MFD child device's fwnode with the parent
or matching ACPI device's fwnode is causing conflict when
software_node (mfd_cell->swnode) is explicitly assigned during
device creation.

Since a device is not expected to have both fwnode and swnode,
this conflict is leading to mfd_add_hotplug_devices() failure.

To fix this issue, skip initializing the fwnode from the parent
or matching ACPI device when a swnode is already present for the
MFD child.

Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
---
 drivers/mfd/mfd-core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 76bd316a50af..d5680132ed21 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -212,17 +212,17 @@ static int mfd_add_device(struct device *parent, int id,
 				cell->name, platform_id);
 	}
 
-	mfd_acpi_add_device(cell, pdev);
-
-	if (cell->pdata_size) {
-		ret = platform_device_add_data(pdev,
-					cell->platform_data, cell->pdata_size);
+	if (cell->swnode) {
+		ret = device_add_software_node(&pdev->dev, cell->swnode);
 		if (ret)
 			goto fail_of_entry;
+	} else {
+		/* add parent dev fwnode only when swnode is not present */
+		mfd_acpi_add_device(cell, pdev);
 	}
 
-	if (cell->swnode) {
-		ret = device_add_software_node(&pdev->dev, cell->swnode);
+	if (cell->pdata_size) {
+		ret = platform_device_add_data(pdev, cell->platform_data, cell->pdata_size);
 		if (ret)
 			goto fail_of_entry;
 	}
-- 
2.43.0


                 reply	other threads:[~2025-06-11 22:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250611225642.266069-1-pratap.nirujogi@amd.com \
    --to=pratap.nirujogi@amd.com \
    --cc=benjamin.chan@amd.com \
    --cc=bin.du@amd.com \
    --cc=dantony@amd.com \
    --cc=grosikop@amd.com \
    --cc=king.li@amd.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phil.jawich@amd.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

all inboxes | Powered by JetHome®