Skip to content

Commit

Permalink
devicetree: Add empty of_platform_populate() for !CONFIG_OF_ADDRESS (…
Browse files Browse the repository at this point in the history
…sparc)

Sparc has its own helpers for translating address ranges when the device
tree is parsed at boot time, and it isn't able to use of_platform_populate().
However, there are some device drivers that want to use that function on
other DT enabled platforms (ie. TWL4030).  This patch adds an empty
of_platform_populate() implementation that returns an error when
CONFIG_OF_ADDRESS is not selected.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Grant Likely committed Feb 26, 2012
1 parent d593f25 commit 964dba2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 2 additions & 3 deletions drivers/mfd/twl-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1305,11 +1305,10 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
}

#ifdef CONFIG_OF_DEVICE
status = -ENODEV;
if (node)
status = of_platform_populate(node, NULL, NULL, &client->dev);
else
#endif
if (status)
status = add_children(pdata, id->driver_data);

fail:
Expand Down
4 changes: 2 additions & 2 deletions drivers/of/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
#include <asm/dcr.h>
#endif

#if !defined(CONFIG_SPARC)
#ifdef CONFIG_OF_ADDRESS
/*
* The following routines scan a subtree and registers a device for
* each applicable node.
Expand Down Expand Up @@ -462,4 +462,4 @@ int of_platform_populate(struct device_node *root,
of_node_put(root);
return rc;
}
#endif /* !CONFIG_SPARC */
#endif /* CONFIG_OF_ADDRESS */
12 changes: 10 additions & 2 deletions include/linux/of_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
struct device *parent);
extern struct platform_device *of_find_device_by_node(struct device_node *np);

#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */
/* Platform devices and busses creation */
extern struct platform_device *of_platform_device_create(struct device_node *np,
const char *bus_id,
Expand All @@ -94,7 +94,15 @@ extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
struct device *parent);
#endif /* !CONFIG_SPARC */
#else
static inline int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
struct device *parent)
{
return -ENODEV;
}
#endif /* !CONFIG_OF_ADDRESS */

#endif /* CONFIG_OF_DEVICE */

Expand Down

0 comments on commit 964dba2

Please sign in to comment.