devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How-to: Uniquely identify a DT node in the driver?
@ 2015-07-28 19:38 Lina Iyer
       [not found] ` <20150728193833.GC51847-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Lina Iyer @ 2015-07-28 19:38 UTC (permalink / raw)
  To: Device Tree

Hello,

I am looking to find a way to uniquely identify a device in the driver.
Here is an example -

	big: power-controller@1 {
		compatible = "soc,foo";
		...
	};

	little: power-controller@2 {
		compatible = "soc,foo";
		...
	};


In the driver for the power-controller foo.c, would like to do -

	struct xyz {
		const char *name;
		...
	};

	static struct xyz a = {
		.name = "big"; // To be associated with big device
		...
	};

	static struct xyz b = {
		.name = "little"; // To be associated with little device
		...
	};

What would be the best way to associate the power-controller devices 'big'
and 'little' with 'a' and 'b' respectively? A string comparison would be
ideal but possibly can work with other ways.

I could think of adding compatibles to achieve this, but was hoping to
find something more elegant and appropriate. Or, is compatible the
recommended way to uniquely identify devices by the driver?

Thanks,
Lina
--
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	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-31 15:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 19:38 How-to: Uniquely identify a DT node in the driver? Lina Iyer
     [not found] ` <20150728193833.GC51847-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-28 19:56   ` Lina Iyer
2015-07-29  9:44   ` Sudeep Holla
     [not found]     ` <55B8A061.6060306-5wv7dgnIgG8@public.gmane.org>
2015-07-29 16:01       ` Lina Iyer
     [not found]         ` <20150729160120.GH51847-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-30 18:53           ` Mark Rutland
2015-07-31 15:57             ` Lina Iyer
2015-07-29 16:39   ` Mark Rutland
2015-07-30 15:33     ` Lina Iyer

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).