Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a93c1a3 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: dsa: Allow compiling out legacy support



Introduce a configuration option: CONFIG_NET_DSA_LEGACY allowing to compile out
support for the old platform device and Device Tree binding registration.
Support for these configurations is scheduled to be removed in 4.17.

Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a8168b6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ config NET_DSA_MT7530

config NET_DSA_MV88E6060
	tristate "Marvell 88E6060 ethernet switch chip support"
	depends on NET_DSA
	depends on NET_DSA && NET_DSA_LEGACY
	select NET_DSA_TAG_TRAILER
	---help---
	  This enables support for the Marvell 88E6060 ethernet switch
+4 −0
Original line number Diff line number Diff line
@@ -3755,6 +3755,7 @@ static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,
	return chip->info->tag_protocol;
}

#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
static const char *mv88e6xxx_drv_probe(struct device *dsa_dev,
				       struct device *host_dev, int sw_addr,
				       void **priv)
@@ -3802,6 +3803,7 @@ static const char *mv88e6xxx_drv_probe(struct device *dsa_dev,

	return NULL;
}
#endif

static int mv88e6xxx_port_mdb_prepare(struct dsa_switch *ds, int port,
				      const struct switchdev_obj_port_mdb *mdb)
@@ -3841,7 +3843,9 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port,
}

static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
	.probe			= mv88e6xxx_drv_probe,
#endif
	.get_tag_protocol	= mv88e6xxx_get_tag_protocol,
	.setup			= mv88e6xxx_setup,
	.adjust_link		= mv88e6xxx_adjust_link,
+11 −0
Original line number Diff line number Diff line
@@ -321,12 +321,14 @@ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port)
typedef int dsa_fdb_dump_cb_t(const unsigned char *addr, u16 vid,
			      bool is_static, void *data);
struct dsa_switch_ops {
#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
	/*
	 * Legacy probing.
	 */
	const char	*(*probe)(struct device *dsa_dev,
				  struct device *host_dev, int sw_addr,
				  void **priv);
#endif

	enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds,
						  int port);
@@ -474,11 +476,20 @@ struct dsa_switch_driver {
	const struct dsa_switch_ops *ops;
};

#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
/* Legacy driver registration */
void register_switch_driver(struct dsa_switch_driver *type);
void unregister_switch_driver(struct dsa_switch_driver *type);
struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);

#else
static inline void register_switch_driver(struct dsa_switch_driver *type) { }
static inline void unregister_switch_driver(struct dsa_switch_driver *type) { }
static inline struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev)
{
	return NULL;
}
#endif
struct net_device *dsa_dev_to_net_device(struct device *dev);

/* Keep inline for faster access in hot path */
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,15 @@ config NET_DSA

if NET_DSA

config NET_DSA_LEGACY
	bool "Support for older platform device and Device Tree registration"
	default y
	---help---
	  Say Y if you want to enable support for the older platform device and
	  deprecated Device Tree binding registration.

	  This feature is scheduled for removal in 4.17.

# tagging formats
config NET_DSA_TAG_BRCM
	bool
+2 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
# the core
obj-$(CONFIG_NET_DSA) += dsa_core.o
dsa_core-y += dsa.o dsa2.o legacy.o master.o port.o slave.o switch.o
dsa_core-y += dsa.o dsa2.o master.o port.o slave.o switch.o
dsa_core-$(CONFIG_NET_DSA_LEGACY) += legacy.o

# tagging formats
dsa_core-$(CONFIG_NET_DSA_TAG_BRCM) += tag_brcm.o
Loading