net-next: dsa: set_addr should be optional
cover net-next: dsa: set_addr should be optional
The Marvell driver is the only one that actually sets the switches HW address. All other drivers have an empty stub. fix this by making the callback optional.
John Crispin (4):
net-next: dsa: fix duplicate invocation of set_addr()
net-next: dsa: make the set_addr() operation optional
net-next: dsa: b53: remove empty set_addr() stub
net-next: dsa: qca8k: remove empty set_addr() stub
drivers/net/dsa/b53/b53_common.c | 6 ------ drivers/net/dsa/qca8k.c | 8 -------- net/dsa/dsa.c | 8 +++++--- net/dsa/dsa2.c | 12 +++++------- 4 files changed, 10 insertions(+), 24 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/4 net-next: dsa: fix duplicate invocation of set_addr()
commit 83c0afaec7b730b ("net: dsa: Add new binding implementation") has a duplicate invocation of the set_addr() operation callback. Remove one of them.
--- net/dsa/dsa2.c | 4 ---- 1 file changed, 4 deletions(-)
net/dsa/dsa2.c +0 -4
@@ -308,10 +308,6 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)if (err <0 )return err; - err = ds->ops->set_addr (ds, dst->master_netdev->dev_addr); -if (err <0 ) -return err; -if (!ds->slave_mii_bus && ds->ops->phy_read) { ds->slave_mii_bus =devm_mdiobus_alloc (ds->dev);if (!ds->slave_mii_bus)
Signature · 1 line
1.7.10.4
Re: [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr()
Quoted 3 lines · John Crispin
commit
83c0afaec7b730b("net: dsa: Add new binding implementation") has a duplicate invocation of theset_addr()operation callback. Remove one of them.
Upps. My error...
Quoted 2 lines
Signed-off-by John Crispin <[email protected]>
Andrew
PATCH 2/4 net-next: dsa: make the set_addr() operation optional
In reply to John CrispinOnly 1 of the 3 drivers currently has a set_addr() operation. Make the set_addr() callback optional to reduce the amount of empty stubs inside the drivers.
--- net/dsa/dsa.c | 8 +++++--- net/dsa/dsa2.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-)
net/dsa/dsa.c +5 -3
@@ -378,9 +378,11 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)if (ret <0 ) goto out; - ret = ops->set_addr (ds, dst->master_netdev->dev_addr); -if (ret <0 ) - goto out; +if (ops->set_addr) { + ret = ops->set_addr (ds, dst->master_netdev->dev_addr); +if (ret <0 ) + goto out; + }if (!ds->slave_mii_bus && ops->phy_read) { ds->slave_mii_bus =devm_mdiobus_alloc (parent);
net/dsa/dsa2.c +5 -3
@@ -304,9 +304,11 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)if (err <0 )return err; - err = ds->ops->set_addr (ds, dst->master_netdev->dev_addr); -if (err <0 ) -return err; +if (ds->ops->set_addr) { + err = ds->ops->set_addr (ds, dst->master_netdev->dev_addr); +if (err <0 ) +return err; + }if (!ds->slave_mii_bus && ds->ops->phy_read) { ds->slave_mii_bus =devm_mdiobus_alloc (ds->dev);
Signature · 1 line
1.7.10.4
PATCH 3/4 net-next: dsa: b53: remove empty set_addr() stub
In reply to John CrispinThe set_addr() callback is now optional. Remove the empty stub that b53 has.
--- drivers/net/dsa/b53/b53_common.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/net/dsa/b53/b53_common.c +0 -6
@@ -764,11 +764,6 @@ static int b53_get_sset_count(struct dsa_switch *ds)return b53_get_mib_size (dev); } -static int b53_set_addr (struct dsa_switch *ds,u8 *addr) -{ -return 0 ; -} -static int b53_setup (struct dsa_switch *ds) {struct b53_device *dev = ds->priv;
@@ -1466,7 +1461,6 @@ static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds)static struct dsa_switch_ops b53_switch_ops = { .get_tag_protocol = b53_get_tag_protocol, .setup = b53_setup, - .set_addr = b53_set_addr, .get_strings = b53_get_strings, .get_ethtool_stats = b53_get_ethtool_stats, .get_sset_count = b53_get_sset_count,
Signature · 1 line
1.7.10.4
PATCH 4/4 net-next: dsa: qca8k: remove empty set_addr() stub
In reply to John CrispinThe set_addr() callback is now optional. Remove the empty stub that qca8k has.
--- drivers/net/dsa/qca8k.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/net/dsa/qca8k.c +0 -8
@@ -586,13 +586,6 @@ qca8k_setup(struct dsa_switch *ds) }static int -qca8k_set_addr (struct dsa_switch *ds,u8 *addr) -{ -/* The subsystem always calls this function so add an empty stub */ -return 0 ; -} - -static int qca8k_phy_read (struct dsa_switch *ds,int phy,int regnum) {struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
@@ -921,7 +914,6 @@ qca8k_get_tag_protocol(struct dsa_switch *ds)static struct dsa_switch_ops qca8k_switch_ops = { .get_tag_protocol = qca8k_get_tag_protocol, .setup = qca8k_setup, - .set_addr = qca8k_set_addr, .get_strings = qca8k_get_strings, .phy_read = qca8k_phy_read, .phy_write = qca8k_phy_write,
Signature · 1 line
1.7.10.4
Quoted 3 lines · John Crispin
The Marvell driver is the only one that actually sets the switches HW address. All other drivers have an empty stub. fix this by making the callback optional.
Hi John
Thanks for doing this,
Andrew
Quoted 9 lines · John Crispin
The Marvell driver is the only one that actually sets the switches HW address. All other drivers have an empty stub. fix this by making the callback optional.
John Crispin (4):
net-next: dsa: fix duplicate invocation ofset_addr()
net-next: dsa: make theset_addr()operation optional
net-next: dsa: b53: remove emptyset_addr()stub
net-next: dsa: qca8k: remove emptyset_addr()stub
Signature · 1 line
Florian
David Miller
maintainerFrom: John Crispin <[email protected]>
Date: Mon, 19 Sep 2016 15:27:59 +0200
Quoted 3 lines
The Marvell driver is the only one that actually sets the switches HW address. All other drivers have an empty stub. fix this by making the callback optional.
Series applied, thanks.