Skip to content

Commit

Permalink
of/platform: Add stubs for of_platform_device_create/destroy()
Browse files Browse the repository at this point in the history
Code for platform_device_create() and of_platform_device_destroy() is
only generated if CONFIG_OF_ADDRESS=y. Add stubs to avoid unresolved
symbols when CONFIG_OF_ADDRESS is not set.

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20220630123445.v24.1.I08fd2e1c775af04f663730e9fb4d00e6bbb38541@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Matthias Kaehlcke authored and Greg Kroah-Hartman committed Jul 8, 2022
1 parent 1742b76 commit 620e8e8
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions include/linux/of_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,18 @@ static inline struct platform_device *of_find_device_by_node(struct device_node
}
#endif

extern int of_platform_bus_probe(struct device_node *root,
const struct of_device_id *matches,
struct device *parent);

#ifdef CONFIG_OF_ADDRESS
/* Platform devices and busses creation */
extern struct platform_device *of_platform_device_create(struct device_node *np,
const char *bus_id,
struct device *parent);

extern int of_platform_device_destroy(struct device *dev, void *data);
extern int of_platform_bus_probe(struct device_node *root,
const struct of_device_id *matches,
struct device *parent);
#ifdef CONFIG_OF_ADDRESS

extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
Expand All @@ -84,6 +86,18 @@ extern int devm_of_platform_populate(struct device *dev);

extern void devm_of_platform_depopulate(struct device *dev);
#else
/* Platform devices and busses creation */
static inline struct platform_device *of_platform_device_create(struct device_node *np,
const char *bus_id,
struct device *parent)
{
return NULL;
}
static inline int of_platform_device_destroy(struct device *dev, void *data)
{
return -ENODEV;
}

static inline int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
Expand Down

0 comments on commit 620e8e8

Please sign in to comment.