Skip to contentSkip to conversation

net: dsa: mv88e6xxx: add common and ppu remove function

RFC PATCH Superseded Neil Armstrong 2 participants 4 messages Oct 28, 2015

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 3/4 net: dsa: mv88e6xxx: add common and ppu remove function

With the previously introduced remove callback, add a mv88e6xxx common remove function to cleanup all resources.

---
 drivers/net/dsa/mv88e6xxx.c | 18 ++++++++++++++++++
 drivers/net/dsa/mv88e6xxx.h |  2 ++
 2 files changed, 20 insertions(+)
drivers/net/dsa/mv88e6xxx.c +18 -0
index b1b14f5..6287096 100644
@@ -331,6 +331,16 @@ void mv88e6xxx_ppu_state_init(struct dsa_switch *ds)
 	ps->ppu_timer.function = mv88e6xxx_ppu_reenable_timer;
 }
 
+void mv88e6xxx_ppu_state_remove(struct dsa_switch *ds)
+{
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	
+	del_timer_sync(&ps->ppu_timer);
+
+	cancel_work_sync(&ps->bridge_work);
+	flush_work(&ps->bridge_work);
+}
+
 int mv88e6xxx_phy_read_ppu(struct dsa_switch *ds, int addr, int regnum)
 {
 	int ret;
@@ -2083,6 +2093,14 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds)
 	return 0;
 }
 
+void mv88e6xxx_remove_common(struct dsa_switch *ds)
+{
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+
+	cancel_work_sync(&ps->bridge_work);
+	flush_work(&ps->bridge_work);
+}
+
 int mv88e6xxx_setup_global(struct dsa_switch *ds)
 {
 	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
drivers/net/dsa/mv88e6xxx.h +2 -0
index 6f9ed5d..64d37a0 100644
@@ -417,6 +417,7 @@ struct mv88e6xxx_hw_stat {
 int mv88e6xxx_switch_reset(struct dsa_switch *ds, bool ppu_active);
 int mv88e6xxx_setup_ports(struct dsa_switch *ds);
 int mv88e6xxx_setup_common(struct dsa_switch *ds);
+void mv88e6xxx_remove_common(struct dsa_switch *ds);
 int mv88e6xxx_setup_global(struct dsa_switch *ds);
 int __mv88e6xxx_reg_read(struct mii_bus *bus, int sw_addr, int addr, int reg);
 int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg);
@@ -431,6 +432,7 @@ int mv88e6xxx_phy_read_indirect(struct dsa_switch *ds, int port, int regnum);
 int mv88e6xxx_phy_write_indirect(struct dsa_switch *ds, int port, int regnum,
 				 u16 val);
 void mv88e6xxx_ppu_state_init(struct dsa_switch *ds);
+void mv88e6xxx_ppu_state_remove(struct dsa_switch *ds);
 int mv88e6xxx_phy_read_ppu(struct dsa_switch *ds, int addr, int regnum);
 int mv88e6xxx_phy_write_ppu(struct dsa_switch *ds, int addr,
 			    int regnum, u16 val);
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 17 lines · Neil Armstrong

With the previously introduced remove callback, add a mv88e6xxx common remove function to cleanup all resources.

---
 drivers/net/dsa/mv88e6xxx.c | 18 ++++++++++++++++++
 drivers/net/dsa/mv88e6xxx.h |  2 ++
 2 files changed, 20 insertions(+)
drivers/net/dsa/mv88e6xxx.c +0 -0
index b1b14f5..6287096 100644
@@ -331,6 +331,16 @@ void mv88e6xxx_ppu_state_init(struct dsa_switch *ds)
 	ps->ppu_timer.function = mv88e6xxx_ppu_reenable_timer;
 }
 

drivers/net/dsa/mv88e6xxx.c void mv88e6xxx_ppu_state_init(struct dsa_switch *ds) · line 343

Quoted 10 lines
drivers/net/dsa/mv88e6xxx.c +10 -0
+void mv88e6xxx_ppu_state_remove(struct dsa_switch *ds)
+{
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	
+	del_timer_sync(&ps->ppu_timer);
+
+	cancel_work_sync(&ps->bridge_work);
+	flush_work(&ps->bridge_work);
+}
+

You add this function, but you don't use it anywhere? Also, why cancel bridge work, not ppu_work? Or has that been consolidated in some patch i'm missing?

Andrew

#2 lore raw

Hi Andrew,

Quoted 24 lines · Andrew Lunn
Quoted 8 lines · Neil Armstrong
drivers/net/dsa/mv88e6xxx.c +0 -0
index b1b14f5..6287096 100644
@@ -331,6 +331,16 @@ void mv88e6xxx_ppu_state_init(struct dsa_switch *ds)
 	ps->ppu_timer.function = mv88e6xxx_ppu_reenable_timer;
 }
 

drivers/net/dsa/mv88e6xxx.c void mv88e6xxx_ppu_state_init(struct dsa_switch *ds) · line 343

Quoted 10 lines
drivers/net/dsa/mv88e6xxx.c +10 -0
+void mv88e6xxx_ppu_state_remove(struct dsa_switch *ds)
+{
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	
+	del_timer_sync(&ps->ppu_timer);
+
+	cancel_work_sync(&ps->bridge_work);
+	flush_work(&ps->bridge_work);
+}
+

You add this function, but you don't use it anywhere? Also, why cancel bridge work, not ppu_work? Or has that been consolidated in some patch i'm missing?

Quoted 2 lines

Andrew

It's called in the next patch, in mv88e6131_remove for mv88e6131.

Neil

maintainer
#3 lore raw
Quoted 27 lines · Neil Armstrong

Hi Andrew,

Quoted 24 lines · Andrew Lunn
Quoted 8 lines · Neil Armstrong
drivers/net/dsa/mv88e6xxx.c +0 -0
index b1b14f5..6287096 100644
@@ -331,6 +331,16 @@ void mv88e6xxx_ppu_state_init(struct dsa_switch *ds)
 	ps->ppu_timer.function = mv88e6xxx_ppu_reenable_timer;
 }
 

drivers/net/dsa/mv88e6xxx.c void mv88e6xxx_ppu_state_init(struct dsa_switch *ds) · line 343

Quoted 10 lines
drivers/net/dsa/mv88e6xxx.c +10 -0
+void mv88e6xxx_ppu_state_remove(struct dsa_switch *ds)
+{
+	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+	
+	del_timer_sync(&ps->ppu_timer);
+
+	cancel_work_sync(&ps->bridge_work);
+	flush_work(&ps->bridge_work);
+}
+

You add this function, but you don't use it anywhere? Also, why cancel bridge work, not ppu_work? Or has that been consolidated in some patch i'm missing?

Quoted 4 lines
Quoted 2 lines

Andrew

It's called in the next patch, in mv88e6131_remove for mv88e6131.

Hi Neil

It would be better to split this out into a patch of its own, and include the mv88e6131 change with it.

Andrew