aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-05-17 15:06:31 +0200
committerArnd Bergmann <arnd@arndb.de>2016-05-17 15:06:31 +0200
commit2e629ebc24d463ffb6c17b15daf908e6f968a1de (patch)
tree49c44ffee62d06955bff6c928b5d349078f3a12c /drivers/of
parentARM: debug: remove extraneous DEBUG_HI3716_UART option (diff)
parentMerge tag 'omap-for-v4.7/auxdata-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/fixes-non-critical (diff)
downloadlinux-dev-2e629ebc24d463ffb6c17b15daf908e6f968a1de.tar.xz
linux-dev-2e629ebc24d463ffb6c17b15daf908e6f968a1de.zip
Merge branches 'next/cleanup' and 'next/fixes-non-critical' into next/cleanups-fixes
This is a merge of the cleanup and fixes-non-critical branches for the 4.7 merge window. It seems more appropriate to send a single pull request for these than two separate ones, as both branches really contain both fixes and cleanups. * next/cleanup: ARM: debug: remove extraneous DEBUG_HI3716_UART option ARM: davinci: use IRQCHIP_DECLARE for cp_intc ARM: davinci: remove unused DA8XX_NUM_UARTS ARM: davinci: simplify call to of populate ARM: DaVinci USB: removed deprecated properties from MUSB config ARM: rockchip: Fix use of plain integer as NULL pointer ARM: realview: hide unused 'pmu_device' object soc: versatile: dynamically detect RealView HBI numbers * next/fixes-non-critical: ARM: dts: exynos: Add interrupt line to MAX8997 PMIC on exynos4210-trats ARM: dts: exynos: Fix regulator name to avoid forbidden character on exynos4210-trats ARM: dts: exynos: Add MFC memory banks for Peach boards ARM: OMAP2+: n900 needs MMC slot names for legacy user space ARM: OMAP2+: Add more functions to pwm pdata for ir-rx51 ARM: EXYNOS: Properly skip unitialized parent clock in power domain on ARM: OMAP2+: Simplify auxdata by using the generic match of/platform: Allow secondary compatible match in of_dev_lookup
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/platform.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 8d103e4968be..16e8daffac06 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -297,19 +297,37 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup,
struct device_node *np)
{
+ const struct of_dev_auxdata *auxdata;
struct resource res;
+ int compatible = 0;
if (!lookup)
return NULL;
- for(; lookup->compatible != NULL; lookup++) {
- if (!of_device_is_compatible(np, lookup->compatible))
+ auxdata = lookup;
+ for (; auxdata->compatible; auxdata++) {
+ if (!of_device_is_compatible(np, auxdata->compatible))
continue;
+ compatible++;
if (!of_address_to_resource(np, 0, &res))
- if (res.start != lookup->phys_addr)
+ if (res.start != auxdata->phys_addr)
continue;
- pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
- return lookup;
+ pr_debug("%s: devname=%s\n", np->full_name, auxdata->name);
+ return auxdata;
+ }
+
+ if (!compatible)
+ return NULL;
+
+ /* Try compatible match if no phys_addr and name are specified */
+ auxdata = lookup;
+ for (; auxdata->compatible; auxdata++) {
+ if (!of_device_is_compatible(np, auxdata->compatible))
+ continue;
+ if (!auxdata->phys_addr && !auxdata->name) {
+ pr_debug("%s: compatible match\n", np->full_name);
+ return auxdata;
+ }
}
return NULL;