linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] net-next: dsa: set_addr should be optional
@ 2016-09-19 13:27 John Crispin
  2016-09-19 13:28 ` [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr() John Crispin
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: John Crispin @ 2016-09-19 13:27 UTC (permalink / raw)
  To: David S. Miller, Andrew Lunn, Florian Fainelli
  Cc: netdev, linux-kernel, 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 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr()
  2016-09-19 13:27 [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin
@ 2016-09-19 13:28 ` John Crispin
  2016-09-19 13:44   ` Andrew Lunn
  2016-09-19 13:28 ` [PATCH 2/4] net-next: dsa: make the set_addr() operation optional John Crispin
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: John Crispin @ 2016-09-19 13:28 UTC (permalink / raw)
  To: David S. Miller, Andrew Lunn, Florian Fainelli
  Cc: netdev, linux-kernel, John Crispin

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] net-next: dsa: make the set_addr() operation optional
  2016-09-19 13:27 [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin
  2016-09-19 13:28 ` [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr() John Crispin
@ 2016-09-19 13:28 ` John Crispin
  2016-09-19 13:28 ` [PATCH 3/4] net-next: dsa: b53: remove empty set_addr() stub John Crispin
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: John Crispin @ 2016-09-19 13:28 UTC (permalink / raw)
  To: David S. Miller, Andrew Lunn, Florian Fainelli
  Cc: netdev, linux-kernel, John Crispin

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] net-next: dsa: b53: remove empty set_addr() stub
  2016-09-19 13:27 [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin
  2016-09-19 13:28 ` [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr() John Crispin
  2016-09-19 13:28 ` [PATCH 2/4] net-next: dsa: make the set_addr() operation optional John Crispin
@ 2016-09-19 13:28 ` John Crispin
  2016-09-19 13:28 ` [PATCH 4/4] net-next: dsa: qca8k: " John Crispin
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: John Crispin @ 2016-09-19 13:28 UTC (permalink / raw)
  To: David S. Miller, Andrew Lunn, Florian Fainelli
  Cc: netdev, linux-kernel, John Crispin

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] net-next: dsa: qca8k: remove empty set_addr() stub
  2016-09-19 13:27 [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin
                   ` (2 preceding siblings ...)
  2016-09-19 13:28 ` [PATCH 3/4] net-next: dsa: b53: remove empty set_addr() stub John Crispin
@ 2016-09-19 13:28 ` John Crispin
  2016-09-19 13:45 ` [PATCH 0/4] net-next: dsa: set_addr should be optional Andrew Lunn
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: John Crispin @ 2016-09-19 13:28 UTC (permalink / raw)
  To: David S. Miller, Andrew Lunn, Florian Fainelli
  Cc: netdev, linux-kernel, John Crispin

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr()
  2016-09-19 13:28 ` [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr() John Crispin
@ 2016-09-19 13:44   ` Andrew Lunn
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2016-09-19 13:44 UTC (permalink / raw)
  To: John Crispin; +Cc: David S. Miller, Florian Fainelli, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] net-next: dsa: set_addr should be optional
  2016-09-19 13:27 [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin
                   ` (3 preceding siblings ...)
  2016-09-19 13:28 ` [PATCH 4/4] net-next: dsa: qca8k: " John Crispin
@ 2016-09-19 13:45 ` Andrew Lunn
  2016-09-19 19:41 ` Florian Fainelli
  2016-09-20  8:48 ` David Miller
  6 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2016-09-19 13:45 UTC (permalink / raw)
  To: John Crispin; +Cc: David S. Miller, Florian Fainelli, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] net-next: dsa: set_addr should be optional
  2016-09-19 13:27 [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin
                   ` (4 preceding siblings ...)
  2016-09-19 13:45 ` [PATCH 0/4] net-next: dsa: set_addr should be optional Andrew Lunn
@ 2016-09-19 19:41 ` Florian Fainelli
  2016-09-20  8:48 ` David Miller
  6 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2016-09-19 19:41 UTC (permalink / raw)
  To: John Crispin, David S. Miller, Andrew Lunn; +Cc: netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] net-next: dsa: set_addr should be optional
  2016-09-19 13:27 [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin
                   ` (5 preceding siblings ...)
  2016-09-19 19:41 ` Florian Fainelli
@ 2016-09-20  8:48 ` David Miller
  6 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2016-09-20  8:48 UTC (permalink / raw)
  To: john; +Cc: andrew, f.fainelli, netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-09-20  8:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19 13:27 [PATCH 0/4] net-next: dsa: set_addr should be optional John Crispin
2016-09-19 13:28 ` [PATCH 1/4] net-next: dsa: fix duplicate invocation of set_addr() John Crispin
2016-09-19 13:44   ` Andrew Lunn
2016-09-19 13:28 ` [PATCH 2/4] net-next: dsa: make the set_addr() operation optional John Crispin
2016-09-19 13:28 ` [PATCH 3/4] net-next: dsa: b53: remove empty set_addr() stub John Crispin
2016-09-19 13:28 ` [PATCH 4/4] net-next: dsa: qca8k: " John Crispin
2016-09-19 13:45 ` [PATCH 0/4] net-next: dsa: set_addr should be optional Andrew Lunn
2016-09-19 19:41 ` Florian Fainelli
2016-09-20  8:48 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).