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: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2016-09-20 04:47:50 -04:00
commit 1860e688ed
4 changed files with 10 additions and 24 deletions

View file

@ -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,

View file

@ -585,13 +585,6 @@ qca8k_setup(struct dsa_switch *ds)
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
qca8k_phy_read(struct dsa_switch *ds, int phy, int regnum)
{
@ -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,

View file

@ -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);

View file

@ -304,13 +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;
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);