linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tushar.behera@linaro.org (Tushar Behera)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v2 1/2] mfd: syscon: Support early initialization
Date: Fri, 09 May 2014 17:43:21 +0530	[thread overview]
Message-ID: <536CC661.7000706@linaro.org> (raw)
In-Reply-To: <fa3178534fcf4488fc45a9a24e44b2588acb38c6.1392807832.git.michal.simek@xilinx.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/19/2014 04:34 PM, Michal Simek wrote:
> Some platforms need to get system controller ready as soon as
> possible. The patch provides early_syscon_initialization which
> create early mapping for all syscon compatible devices in
> early_syscon_probe. Regmap is get via
> syscon_early_regmap_lookup_by_phandle()
> 
> Regular device probes attach device to regmap via
> regmap_attach_dev().
> 
> For early syscon initialization is necessary to extend struct
> syscon and provide remove function which unmap all early init
> structures.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com> ---
> 

I don't have V3 in my mailbox, hence replying to this thread. The
content is applicable to V3.

[...]
> @@ -95,6 +98,24 @@ struct regmap
> *syscon_regmap_lookup_by_pdevname(const char *s) } 
> EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_pdevname);
> 
> +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;

This fails while derefencing syscon if if early_syscon_init() has not
yet been not yet been called. Something like this would be helpful.

struct regmap *regmap = ERR_PTR(-ENODEV);

syscon = syscon_np->data;
if (syscon)
	regmap = syscon->regmap;

return regmap;


- -- 
Tushar Behera
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTbMZMAAoJELqclMPPkq4NoZEH/j/vTBLu0VmKm01jZqJUUC59
siD+DvRclRcdRGCzsf7iN9Zjw2g+abDtEBynBNdC6swTJJUwDyMtkcguiHn/ytPN
B/5bli3rKpRkDlg9i/Cfgqd2KmYh1U6Q2LJ3+pyRAQqe0zm+bI5+fp/cn1PGLBIW
1R2rexJO98GhGO/Yhh62FD366rB15bgApC2+XjYb2Wcka3f8VY47gqkxnAwxZzvU
ovG/rqXEuGW7H3o/+BLDtmQREEjKg20ggRo2FEj0WozhTo6Sn2YUJg70DKioguu0
eteP+X4DsShluJfxq9/51bfFutlXPPYZIbLIZxwyiFSJiAIR8hjLO/Ed/GicybQ=
=HCI5
-----END PGP SIGNATURE-----

  parent reply	other threads:[~2014-05-09 12:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 11:04 [RFC PATCH v2 0/2] Syscon early initialization Michal Simek
2014-02-19 11:04 ` [RFC PATCH v2 1/2] mfd: syscon: Support " Michal Simek
2014-02-19 11:14   ` Alexander Shiyan
2014-02-19 11:16     ` Alexander Shiyan
2014-02-19 11:41   ` Lee Jones
2014-02-19 11:44     ` Michal Simek
2014-02-19 12:17       ` Mark Brown
2014-02-19 13:51         ` Michal Simek
2014-02-19 13:59           ` Mark Brown
2014-05-09 12:13   ` Tushar Behera [this message]
2014-02-19 11:04 ` [RFC PATCH v2 2/2] ARM: zynq: Use early syscon initialization Michal Simek

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=536CC661.7000706@linaro.org \
    --to=tushar.behera@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).