Commit 1860e688 authored by David S. Miller's avatar David S. Miller

Merge branch 'dsa-set_addr-optional'

John Crispin says:

====================
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.
====================
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents f361bdde 8941ee36
...@@ -764,11 +764,6 @@ static int b53_get_sset_count(struct dsa_switch *ds) ...@@ -764,11 +764,6 @@ static int b53_get_sset_count(struct dsa_switch *ds)
return b53_get_mib_size(dev); 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) static int b53_setup(struct dsa_switch *ds)
{ {
struct b53_device *dev = ds->priv; struct b53_device *dev = ds->priv;
...@@ -1466,7 +1461,6 @@ static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds) ...@@ -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 = { static struct dsa_switch_ops b53_switch_ops = {
.get_tag_protocol = b53_get_tag_protocol, .get_tag_protocol = b53_get_tag_protocol,
.setup = b53_setup, .setup = b53_setup,
.set_addr = b53_set_addr,
.get_strings = b53_get_strings, .get_strings = b53_get_strings,
.get_ethtool_stats = b53_get_ethtool_stats, .get_ethtool_stats = b53_get_ethtool_stats,
.get_sset_count = b53_get_sset_count, .get_sset_count = b53_get_sset_count,
......
...@@ -585,13 +585,6 @@ qca8k_setup(struct dsa_switch *ds) ...@@ -585,13 +585,6 @@ qca8k_setup(struct dsa_switch *ds)
return 0; return 0;
} }
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 static int
qca8k_phy_read(struct dsa_switch *ds, int phy, int regnum) qca8k_phy_read(struct dsa_switch *ds, int phy, int regnum)
{ {
...@@ -921,7 +914,6 @@ qca8k_get_tag_protocol(struct dsa_switch *ds) ...@@ -921,7 +914,6 @@ qca8k_get_tag_protocol(struct dsa_switch *ds)
static struct dsa_switch_ops qca8k_switch_ops = { static struct dsa_switch_ops qca8k_switch_ops = {
.get_tag_protocol = qca8k_get_tag_protocol, .get_tag_protocol = qca8k_get_tag_protocol,
.setup = qca8k_setup, .setup = qca8k_setup,
.set_addr = qca8k_set_addr,
.get_strings = qca8k_get_strings, .get_strings = qca8k_get_strings,
.phy_read = qca8k_phy_read, .phy_read = qca8k_phy_read,
.phy_write = qca8k_phy_write, .phy_write = qca8k_phy_write,
......
...@@ -378,9 +378,11 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent) ...@@ -378,9 +378,11 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
if (ret < 0) if (ret < 0)
goto out; goto out;
if (ops->set_addr) {
ret = ops->set_addr(ds, dst->master_netdev->dev_addr); ret = ops->set_addr(ds, dst->master_netdev->dev_addr);
if (ret < 0) if (ret < 0)
goto out; goto out;
}
if (!ds->slave_mii_bus && ops->phy_read) { if (!ds->slave_mii_bus && ops->phy_read) {
ds->slave_mii_bus = devm_mdiobus_alloc(parent); ds->slave_mii_bus = devm_mdiobus_alloc(parent);
......
...@@ -304,13 +304,11 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds) ...@@ -304,13 +304,11 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
if (err < 0) if (err < 0)
return err; return err;
if (ds->ops->set_addr) {
err = ds->ops->set_addr(ds, dst->master_netdev->dev_addr); err = ds->ops->set_addr(ds, dst->master_netdev->dev_addr);
if (err < 0) if (err < 0)
return err; 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) { if (!ds->slave_mii_bus && ds->ops->phy_read) {
ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev); ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment