devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mfd: always assign of_node in mfd_add_device()
@ 2013-12-09 22:06 Stephen Warren
       [not found] ` <1386626809-6251-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Warren @ 2013-12-09 22:06 UTC (permalink / raw)
  To: Lee Jones, Samuel Ortiz, Alessandro Zummo, Andrew Morton
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw, Stephen Warren

From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

mfd_add_device() assigns .of_node in the device objects it creates only
if the mfd_cell for the device has the .of_compatible field set and the
DT node for the top-level MFD device contains a child whose compatible
property matches the cell's .of_compatible field.

This leaves .of_node unset in many cases. When this happens, entries in
the DT /aliases property which refer to the top-level MFD DT node will
never match the MFD child devices, hence causing the requested alias not
to be honored.

Solve this by setting each MFD child device's .of_node equal to the top-
level MFD device's .of_node field in the cases where it would otherwise
remain unset.

The first use-case for this will be aliases for the TPS6586x's RTC
device.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
The 3 patches in this series are all independent; they can be applied
to their respective subsystems in any order. I'm simply posting them as
a series to make the use-case more obvious.
---
 drivers/mfd/mfd-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 267649244737..32e8d47d9002 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -117,6 +117,8 @@ static int mfd_add_device(struct device *parent, int id,
 			}
 		}
 	}
+	if (!pdev->dev.of_node)
+		pdev->dev.of_node = parent->of_node;
 
 	if (cell->pdata_size) {
 		ret = platform_device_add_data(pdev,
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-01-07  8:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-09 22:06 [PATCH 1/3] mfd: always assign of_node in mfd_add_device() Stephen Warren
     [not found] ` <1386626809-6251-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-09 22:06   ` [PATCH 2/3] rtc: honor device tree /alias entries when assigning IDs Stephen Warren
2013-12-09 22:06   ` [PATCH 3/3] ARM: tegra: set up /aliases entries for RTCs Stephen Warren
2013-12-10  8:40   ` [PATCH 1/3] mfd: always assign of_node in mfd_add_device() Lee Jones
2013-12-10 16:54     ` Stephen Warren
2013-12-11  9:24   ` Lee Jones
2013-12-13 19:28     ` Stephen Warren
     [not found]       ` <52AB5FE2.5060803-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-16  8:12         ` Lee Jones
2013-12-19 17:25     ` Stephen Warren
     [not found]       ` <52B32C05.5010204-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-20 14:20         ` Lee Jones
2013-12-20 14:25       ` Lee Jones
2013-12-20 16:11         ` Stephen Warren
2014-01-06 18:12         ` Stephen Warren
     [not found]           ` <52CAF1FF.9090709-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-01-07  8:23             ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).