Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486485 > unrolled thread

[PATCH 0/4] net-next: dsa: set_addr should be optional

Started byJohn Crispin <john@phrozen.org>
First post2016-09-19 15:30 +0200
Last post2016-09-20 10:50 +0200
Articles 9 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin <john@phrozen.org> - 2016-09-19 15:30 +0200
    [PATCH 3/4] net-next: dsa: b53: remove empty set_addr() stub John Crispin <john@phrozen.org> - 2016-09-19 15:30 +0200
    [PATCH 2/4] net-next: dsa: make the set_addr() operation optional John Crispin <john@phrozen.org> - 2016-09-19 15:30 +0200
    [PATCH 4/4] net-next: dsa: qca8k: remove empty set_addr() stub John Crispin <john@phrozen.org> - 2016-09-19 15:30 +0200
    [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr() John Crispin <john@phrozen.org> - 2016-09-19 15:30 +0200
      Re: [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr() Andrew Lunn <andrew@lunn.ch> - 2016-09-19 15:50 +0200
    Re: [PATCH 0/4] net-next: dsa: set_addr should be optional Andrew Lunn <andrew@lunn.ch> - 2016-09-19 15:50 +0200
    Re: [PATCH 0/4] net-next: dsa: set_addr should be optional Florian Fainelli <f.fainelli@gmail.com> - 2016-09-19 21:50 +0200
    Re: [PATCH 0/4] net-next: dsa: set_addr should be optional David Miller <davem@davemloft.net> - 2016-09-20 10:50 +0200

#1486485 — [PATCH 0/4] net-next: dsa: set_addr should be optional

FromJohn Crispin <john@phrozen.org>
Date2016-09-19 15:30 +0200
Subject[PATCH 0/4] net-next: dsa: set_addr should be optional
Message-ID<sj6NX-5YW-5@gated-at.bofh.it>
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(-)

-- 
1.7.10.4

[toc] | [next] | [standalone]


#1486489 — [PATCH 3/4] net-next: dsa: b53: remove empty set_addr() stub

FromJohn Crispin <john@phrozen.org>
Date2016-09-19 15:30 +0200
Subject[PATCH 3/4] net-next: dsa: b53: remove empty set_addr() stub
Message-ID<sj6NX-5YW-13@gated-at.bofh.it>
In reply to#1486485
The set_addr() callback is now optional. Remove the empty stub that b53
has.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/net/dsa/b53/b53_common.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 0afc2e5..1a492c0 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -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,
-- 
1.7.10.4

[toc] | [prev] | [next] | [standalone]


#1486508 — [PATCH 2/4] net-next: dsa: make the set_addr() operation optional

FromJohn Crispin <john@phrozen.org>
Date2016-09-19 15:30 +0200
Subject[PATCH 2/4] net-next: dsa: make the set_addr() operation optional
Message-ID<sj6NY-5YW-33@gated-at.bofh.it>
In reply to#1486485
Only 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.

Signed-off-by: John Crispin <john@phrozen.org>
---
 net/dsa/dsa.c  |    8 +++++---
 net/dsa/dsa2.c |    8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 66e31ac..a6902c1 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -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);
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index cffc19e..f8a7d9a 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -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);
-- 
1.7.10.4

[toc] | [prev] | [next] | [standalone]


#1486509 — [PATCH 4/4] net-next: dsa: qca8k: remove empty set_addr() stub

FromJohn Crispin <john@phrozen.org>
Date2016-09-19 15:30 +0200
Subject[PATCH 4/4] net-next: dsa: qca8k: remove empty set_addr() stub
Message-ID<sj6NZ-5YW-83@gated-at.bofh.it>
In reply to#1486485
The set_addr() callback is now optional. Remove the empty stub that qca8k
has.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/net/dsa/qca8k.c |    8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 7f3f178..4788a89 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -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,
-- 
1.7.10.4

[toc] | [prev] | [next] | [standalone]


#1486510 — [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr()

FromJohn Crispin <john@phrozen.org>
Date2016-09-19 15:30 +0200
Subject[PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr()
Message-ID<sj6NZ-5YW-67@gated-at.bofh.it>
In reply to#1486485
commit 83c0afaec7b730b ("net: dsa: Add new binding implementation")
has a duplicate invocation of the set_addr() operation callback. Remove one
of them.

Signed-off-by: John Crispin <john@phrozen.org>
---
 net/dsa/dsa2.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 8278385..cffc19e 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -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)
-- 
1.7.10.4

[toc] | [prev] | [next] | [standalone]


#1486520 — Re: [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr()

FromAndrew Lunn <andrew@lunn.ch>
Date2016-09-19 15:50 +0200
SubjectRe: [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr()
Message-ID<sj77j-65S-19@gated-at.bofh.it>
In reply to#1486510
On Mon, Sep 19, 2016 at 03:28:00PM +0200, John Crispin wrote:
> commit 83c0afaec7b730b ("net: dsa: Add new binding implementation")
> has a duplicate invocation of the set_addr() operation callback. Remove one
> of them.

Upps. My error...

> 
> Signed-off-by: John Crispin <john@phrozen.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

[toc] | [prev] | [next] | [standalone]


#1486521

FromAndrew Lunn <andrew@lunn.ch>
Date2016-09-19 15:50 +0200
Message-ID<sj77j-65S-9@gated-at.bofh.it>
In reply to#1486485
On Mon, Sep 19, 2016 at 03:27:59PM +0200, John Crispin wrote:
> 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,

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

[toc] | [prev] | [next] | [standalone]


#1486799

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2016-09-19 21:50 +0200
Message-ID<sjcJH-1aU-1@gated-at.bofh.it>
In reply to#1486485
On 09/19/2016 06:27 AM, John Crispin wrote:
> 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

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

[toc] | [prev] | [next] | [standalone]


#1487154

FromDavid Miller <davem@davemloft.net>
Date2016-09-20 10:50 +0200
Message-ID<sjoUy-Bu-7@gated-at.bofh.it>
In reply to#1486485
From: John Crispin <john@phrozen.org>
Date: Mon, 19 Sep 2016 15:27:59 +0200

> 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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web