Subject: [PATCH] dsa: dsa2: fix compile error for !CONFIG_OF

From: Arend van Spriel <[email-masked]>
Date: Thu, 23 Nov 2017 13:00:51 +0100

Compilation fails building on x86_64 platform which does not
have CONFIG_OF enabled.

Signed-off-by: Arend van Spriel <[email-masked]>
---
After rebasing my branch to v4.14 I attempted to build the kernel and 
hit the following compile issue:

net/dsa/dsa2.c: In function \u2018dsa_switch_parse_member_of\u2019:
net/dsa/dsa2.c:678:2: error: implicit declaration of function 
'of_property_read_variable_u32_array' 
[-Werror=implicit-function-declaration]
   sz = of_property_read_variable_u32_array(dn, "dsa,member", m, 2, 2);
   ^
cc1: some warnings being treated as errors
make[4]: *** [net/dsa/dsa2.o] Error 1

Basically I do not have CONFIG_OF set and the function above is not 
stubbed for !CONFIG_OF. Attached is my v4.14 config.
---
  net/dsa/dsa2.c | 7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 283104e..5e15fc2 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -612,6 +612,7 @@ static int dsa_dst_parse(struct dsa_switch_tree *dst)
  	return 0;
  }

+#ifdef CONFIG_OF
  static int dsa_port_parse_of(struct dsa_port *dp, struct device_node *dn)
  {
  	struct device_node *ethernet = of_parse_phandle(dn, "ethernet", 0);
@@ -700,6 +701,12 @@ static int dsa_switch_parse_of(struct dsa_switch 
*ds, struct device_node *dn)

  	return dsa_switch_parse_ports_of(ds, dn);
  }
+#else
+static int dsa_switch_parse_of(struct dsa_switch *ds, struct 
device_node *dn)
+{
+	return 0;
+}
+#endif /* CONFIG_OF */

  static int dsa_port_parse(struct dsa_port *dp, const char *name,
  			  struct device *dev)