Re: [PATCH v3] mfd: syscon: Support early initialization

From: Michal Simek
Date: Wed Apr 23 2014 - 09:04:47 EST


On 04/23/2014 01:42 PM, Mark Brown wrote:
> On Wed, Apr 23, 2014 at 11:05:30AM +0100, Lee Jones wrote:
>
>>> +struct regmap *syscon_early_regmap_lookup_by_phandle(struct device_node *np,
>>> + const char *property)
>>> +{
>>> + struct device_node *syscon_np;
>>> + struct syscon *syscon;
>>> +
>>> + syscon_np = of_parse_phandle(np, property, 0);
>>> + if (!syscon_np)
>>> + return ERR_PTR(-ENODEV);
>>> +
>>> + syscon = syscon_np->data;
>>> +
>>> + of_node_put(syscon_np);
>>> +
>>> + return syscon->regmap;
>>> +}
>>> +EXPORT_SYMBOL_GPL(syscon_early_regmap_lookup_by_phandle);
>
> I don't know what this is doing but it looks dodgy, we're returning
> something stored in the DT node after dropping our reference to the DT
> node. For FDT systems this probably makes no difference since we don't
> actually free the node but someone might decide to do something like
> clear data that's associated with a node (however that happened) when
> the node goes unreferenced.

In early_syscon_probe np->data contains pointer to struct syscon which
stores base, regmap and res - driver private data for system controller.
(init in early_syscon_probe)
This is the way I am aware of how to share driver private data without pdev.
Maybe there is better way how to do it that's why please let me know
if you are aware about it.

Thanks,
Michal

--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


Attachment: signature.asc
Description: OpenPGP digital signature