diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-06-08 07:48:11 -0600 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-07-05 16:14:27 -0600 |
commit | 3930f294d081c9e2a65f137a7d5fb6c161e4aa94 (patch) | |
tree | 7067d9ca87a0c2e885801dd91d72944a0aee2d22 /drivers/of/address.c | |
parent | 154063a9c03d31228b6f9366d2ffc2b7c4961698 (diff) | |
download | lwn-3930f294d081c9e2a65f137a7d5fb6c161e4aa94.tar.gz lwn-3930f294d081c9e2a65f137a7d5fb6c161e4aa94.zip |
of/address: restrict 'no-ranges' kludge to powerpc
Certain Apple machines don't use the ranges property correctly, but the
workaround should not be applied on other architectures. This patch
disables the workaround for non-powerpc architectures.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'drivers/of/address.c')
-rw-r--r-- | drivers/of/address.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c index 0b04137f04f7..5c220c3a3acc 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -346,12 +346,21 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, * a 1:1 translation at that level. It's up to the caller not to try * to translate addresses that aren't supposed to be translated in * the first place. --BenH. + * + * As far as we know, this damage only exists on Apple machines, so + * This code is only enabled on powerpc. --gcl */ ranges = of_get_property(parent, rprop, &rlen); +#if !defined(CONFIG_PPC) + if (ranges == NULL) { + pr_err("OF: no ranges; cannot translate\n"); + return 1; + } +#endif /* !defined(CONFIG_PPC) */ if (ranges == NULL || rlen == 0) { offset = of_read_number(addr, na); memset(addr, 0, pna * 4); - pr_debug("OF: no ranges, 1:1 translation\n"); + pr_debug("OF: empty ranges; 1:1 translation\n"); goto finish; } |