linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: lan9303: Drop port range check
@ 2017-11-06 14:19 Egil Hjelmeland
  2017-11-06 14:39 ` Egil Hjelmeland
  2017-11-08  4:44 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Egil Hjelmeland @ 2017-11-06 14:19 UTC (permalink / raw)
  To: andrew, vivien.didelot, f.fainelli, netdev, linux-kernel; +Cc: Egil Hjelmeland

Now that ds->num_ports is 3, there is no need to check range of "port"
parameter.

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
---
 drivers/net/dsa/lan9303-core.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index 70ecd18a5e7d..320651a57c6f 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -1057,17 +1057,7 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port,
 {
 	struct lan9303 *chip = ds->priv;
 
-	/* enable internal packet processing */
-	switch (port) {
-	case 1:
-	case 2:
-		return lan9303_enable_processing_port(chip, port);
-	default:
-		dev_dbg(chip->dev,
-			"Error: request to power up invalid port %d\n", port);
-	}
-
-	return -ENODEV;
+	return lan9303_enable_processing_port(chip, port);
 }
 
 static void lan9303_port_disable(struct dsa_switch *ds, int port,
@@ -1075,18 +1065,9 @@ static void lan9303_port_disable(struct dsa_switch *ds, int port,
 {
 	struct lan9303 *chip = ds->priv;
 
-	/* disable internal packet processing */
-	switch (port) {
-	case 1:
-	case 2:
-		lan9303_disable_processing_port(chip, port);
-		lan9303_phy_write(ds, chip->phy_addr_sel_strap + port,
-				  MII_BMCR, BMCR_PDOWN);
-		break;
-	default:
-		dev_dbg(chip->dev,
-			"Error: request to power down invalid port %d\n", port);
-	}
+	lan9303_disable_processing_port(chip, port);
+	lan9303_phy_write(ds, chip->phy_addr_sel_strap + port,
+			  MII_BMCR, BMCR_PDOWN);
 }
 
 static int lan9303_port_bridge_join(struct dsa_switch *ds, int port,
-- 
2.11.0

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

* Re: [PATCH net-next] net: dsa: lan9303: Drop port range check
  2017-11-06 14:19 [PATCH net-next] net: dsa: lan9303: Drop port range check Egil Hjelmeland
@ 2017-11-06 14:39 ` Egil Hjelmeland
  2017-11-08  4:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Egil Hjelmeland @ 2017-11-06 14:39 UTC (permalink / raw)
  To: andrew, vivien.didelot, f.fainelli, netdev, linux-kernel

On 06. nov. 2017 15:19, Egil Hjelmeland wrote:
> Now that ds->num_ports is 3, there is no need to check range of "port"
> parameter.
> 
> +	lan9303_disable_processing_port(chip, port);
> +	lan9303_phy_write(ds, chip->phy_addr_sel_strap + port,
> +			  MII_BMCR, BMCR_PDOWN);
>   }

I see now that line breaking could be adjusted here. But I am going to 
touch that line in a upcomming patch about phy_addr_sel_strap. I
promise fix it then, making it to a one-liner.

>   
>   static int lan9303_port_bridge_join(struct dsa_switch *ds, int port,
> 

Egil

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

* Re: [PATCH net-next] net: dsa: lan9303: Drop port range check
  2017-11-06 14:19 [PATCH net-next] net: dsa: lan9303: Drop port range check Egil Hjelmeland
  2017-11-06 14:39 ` Egil Hjelmeland
@ 2017-11-08  4:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-11-08  4:44 UTC (permalink / raw)
  To: privat; +Cc: andrew, vivien.didelot, f.fainelli, netdev, linux-kernel

From: Egil Hjelmeland <privat@egil-hjelmeland.no>
Date: Mon,  6 Nov 2017 15:19:49 +0100

> Now that ds->num_ports is 3, there is no need to check range of "port"
> parameter.
> 
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>

Applied.

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

end of thread, other threads:[~2017-11-08  4:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 14:19 [PATCH net-next] net: dsa: lan9303: Drop port range check Egil Hjelmeland
2017-11-06 14:39 ` Egil Hjelmeland
2017-11-08  4:44 ` 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).