Skip to contentSkip to conversation

net: dsa: make dsa_switch_ops const

PATCH Applied Bhumika Goyal 3 participants 3 messages Aug 9, 2017 – Aug 10, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: make dsa_switch_ops const

Make these structures const as they are only stored in the ops field of a dsa_switch structure, which is const.
Done using Coccinelle.

---
 drivers/net/dsa/dsa_loop.c     | 2 +-
 drivers/net/dsa/lan9303-core.c | 2 +-
 drivers/net/dsa/mt7530.c       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/dsa/dsa_loop.c +1 -1
index 76d6660..7819a9f 100644
@@ -257,7 +257,7 @@ static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,
 	return 0;
 }
 
-static struct dsa_switch_ops dsa_loop_driver = {
+static const struct dsa_switch_ops dsa_loop_driver = {
 	.get_tag_protocol	= dsa_loop_get_protocol,
 	.setup			= dsa_loop_setup,
 	.get_strings		= dsa_loop_get_strings,
drivers/net/dsa/lan9303-core.c +1 -1
index 15befd1..f058f98 100644
@@ -797,7 +797,7 @@ static void lan9303_port_disable(struct dsa_switch *ds, int port,
 	}
 }
 
-static struct dsa_switch_ops lan9303_switch_ops = {
+static const struct dsa_switch_ops lan9303_switch_ops = {
 	.get_tag_protocol = lan9303_get_tag_protocol,
 	.setup = lan9303_setup,
 	.get_strings = lan9303_get_strings,
drivers/net/dsa/mt7530.c +1 -1
index 1270071..7d8cf927 100644
@@ -979,7 +979,7 @@ static void mt7530_adjust_link(struct dsa_switch *ds, int port,
 	return 0;
 }
 
-static struct dsa_switch_ops mt7530_switch_ops = {
+static const struct dsa_switch_ops mt7530_switch_ops = {
 	.get_tag_protocol	= mtk_get_tag_protocol,
 	.setup			= mt7530_setup,
 	.get_strings		= mt7530_get_strings,
Signature · 1 line
1.9.1