RE: [PATCH] [RFC] pinctrl: add a driver for Energy Micro's efm32SoCs
From: Stephen Warren
Date: Fri Dec 09 2011 - 11:49:16 EST
Dong Aisheng wrote at Friday, December 09, 2011 8:03 AM:
...
> I agree that parsing data from device tree increases much effort
> because we can not using any help functions like microes in dts file and we have
> to construct the structure we need in driver by parsing that data.
> And it will increase dtsi file's size a lot when after adding all functions.
>
> I wonder if we can define that data as a pdata in a .c file and only
> get a pointer from dts file. That would make life much easier.
You can't get pointers themselves directly from a .dts file, since the
.dts file author has no idea what the memory layout (or even which OS)
is present on the running system.
An alternative is to key off the compatible flag in the device tree,
and use that to index a table that points at the various structures you
want pointers to.
struct of_device_id's .data field, and the function of_match_device()
are for exactly that purpose; see the way the Tegra pinctrl driver that
I posted uses them for an example of mapping compatible flag to per-
SoC initialization function pointers.
--
nvpublic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/