mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Jyri Sarha <jsarha@ti.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [v2] of: add more dummy helper functions
Date: Wed,  8 Jan 2020 14:49:28 +0100	[thread overview]
Message-ID: <20200108134936.3617013-1-arnd@arndb.de> (raw)

The new phy-j721e-wiz driver causes a link failure without CONFIG_OF:

drivers/phy/ti/phy-j721e-wiz.o: In function `wiz_remove':
phy-j721e-wiz.c:(.text+0x40): undefined reference to `of_platform_device_destroy'

Add a dummy version of of_platform_device_destroy to avoid having to add
Kconfig dependencies for the driver. As there are a few other functions
without dummy implementations, add those as well for completeness.

Fixes: 42440de5438a ("phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/of_platform.h | 39 ++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 84a966623e78..f5dea3de4856 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -48,28 +48,49 @@ struct of_dev_auxdata {
 
 extern const struct of_device_id of_default_bus_match_table[];
 
+#ifdef CONFIG_OF
 /* Platform drivers register/unregister */
 extern struct platform_device *of_device_alloc(struct device_node *np,
 					 const char *bus_id,
 					 struct device *parent);
-#ifdef CONFIG_OF
 extern struct platform_device *of_find_device_by_node(struct device_node *np);
-#else
-static inline struct platform_device *of_find_device_by_node(struct device_node *np)
-{
-	return NULL;
-}
-#endif
-
 /* 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);
+#else
+static inline struct platform_device *of_device_alloc(struct device_node *np,
+						      const char *bus_id,
+						      struct device *parent)
+{
+	return NULL;
+}
+static inline struct platform_device *of_find_device_by_node(struct device_node *np)
+{
+	return NULL;
+}
+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 0;
+}
+static inline int of_platform_bus_probe(struct device_node *root,
+					const struct of_device_id *matches,
+					struct device *parent)
+{
+	return -ENODEV;
+}
+#endif
+
 #ifdef CONFIG_OF_ADDRESS
 extern int of_platform_populate(struct device_node *root,
 				const struct of_device_id *matches,
-- 
2.20.0


             reply	other threads:[~2020-01-08 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 13:49 Arnd Bergmann [this message]
2020-01-14 23:55 ` Rob Herring

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=20200108134936.3617013-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=jsarha@ti.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.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

all inboxes | Powered by JetHome®