aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-04-28 14:14:28 -0400
committerDavid S. Miller <davem@davemloft.net>2014-04-30 13:31:25 -0400
commita22adce5f97c172398082bf9a713ccfba6c2364f (patch)
treea16c97c9fee55c30c5790725962385ff5437a668
parent7fa857ed041537ee6cbc7ee4ab0204a1231cfcb9 (diff)
net: dsa: update DSA drivers to use ds_to_priv
Use the helper function to retrieve the driver private context instead of using (void *)(ds + 1). Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/mv88e6123_61_65.c2
-rw-r--r--drivers/net/dsa/mv88e6131.c4
-rw-r--r--drivers/net/dsa/mv88e6xxx.c12
3 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/dsa/mv88e6123_61_65.c b/drivers/net/dsa/mv88e6123_61_65.c
index 41ee5b6ae917..69c42513dd72 100644
--- a/drivers/net/dsa/mv88e6123_61_65.c
+++ b/drivers/net/dsa/mv88e6123_61_65.c
@@ -289,7 +289,7 @@ static int mv88e6123_61_65_setup_port(struct dsa_switch *ds, int p)
289 289
290static int mv88e6123_61_65_setup(struct dsa_switch *ds) 290static int mv88e6123_61_65_setup(struct dsa_switch *ds)
291{ 291{
292 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 292 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
293 int i; 293 int i;
294 int ret; 294 int ret;
295 295
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index dadfafba64e9..953bc6a49e59 100644
--- a/drivers/net/dsa/mv88e6131.c
+++ b/drivers/net/dsa/mv88e6131.c
@@ -155,7 +155,7 @@ static int mv88e6131_setup_global(struct dsa_switch *ds)
155 155
156static int mv88e6131_setup_port(struct dsa_switch *ds, int p) 156static int mv88e6131_setup_port(struct dsa_switch *ds, int p)
157{ 157{
158 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 158 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
159 int addr = REG_PORT(p); 159 int addr = REG_PORT(p);
160 u16 val; 160 u16 val;
161 161
@@ -274,7 +274,7 @@ static int mv88e6131_setup_port(struct dsa_switch *ds, int p)
274 274
275static int mv88e6131_setup(struct dsa_switch *ds) 275static int mv88e6131_setup(struct dsa_switch *ds)
276{ 276{
277 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 277 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
278 int i; 278 int i;
279 int ret; 279 int ret;
280 280
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 17314ed9456d..9ce2146346b6 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -74,7 +74,7 @@ int __mv88e6xxx_reg_read(struct mii_bus *bus, int sw_addr, int addr, int reg)
74 74
75int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg) 75int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg)
76{ 76{
77 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 77 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
78 int ret; 78 int ret;
79 79
80 mutex_lock(&ps->smi_mutex); 80 mutex_lock(&ps->smi_mutex);
@@ -118,7 +118,7 @@ int __mv88e6xxx_reg_write(struct mii_bus *bus, int sw_addr, int addr,
118 118
119int mv88e6xxx_reg_write(struct dsa_switch *ds, int addr, int reg, u16 val) 119int mv88e6xxx_reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
120{ 120{
121 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 121 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
122 int ret; 122 int ret;
123 123
124 mutex_lock(&ps->smi_mutex); 124 mutex_lock(&ps->smi_mutex);
@@ -256,7 +256,7 @@ static void mv88e6xxx_ppu_reenable_timer(unsigned long _ps)
256 256
257static int mv88e6xxx_ppu_access_get(struct dsa_switch *ds) 257static int mv88e6xxx_ppu_access_get(struct dsa_switch *ds)
258{ 258{
259 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 259 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
260 int ret; 260 int ret;
261 261
262 mutex_lock(&ps->ppu_mutex); 262 mutex_lock(&ps->ppu_mutex);
@@ -283,7 +283,7 @@ static int mv88e6xxx_ppu_access_get(struct dsa_switch *ds)
283 283
284static void mv88e6xxx_ppu_access_put(struct dsa_switch *ds) 284static void mv88e6xxx_ppu_access_put(struct dsa_switch *ds)
285{ 285{
286 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 286 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
287 287
288 /* Schedule a timer to re-enable the PHY polling unit. */ 288 /* Schedule a timer to re-enable the PHY polling unit. */
289 mod_timer(&ps->ppu_timer, jiffies + msecs_to_jiffies(10)); 289 mod_timer(&ps->ppu_timer, jiffies + msecs_to_jiffies(10));
@@ -292,7 +292,7 @@ static void mv88e6xxx_ppu_access_put(struct dsa_switch *ds)
292 292
293void mv88e6xxx_ppu_state_init(struct dsa_switch *ds) 293void mv88e6xxx_ppu_state_init(struct dsa_switch *ds)
294{ 294{
295 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 295 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
296 296
297 mutex_init(&ps->ppu_mutex); 297 mutex_init(&ps->ppu_mutex);
298 INIT_WORK(&ps->ppu_work, mv88e6xxx_ppu_reenable_work); 298 INIT_WORK(&ps->ppu_work, mv88e6xxx_ppu_reenable_work);
@@ -463,7 +463,7 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
463 int nr_stats, struct mv88e6xxx_hw_stat *stats, 463 int nr_stats, struct mv88e6xxx_hw_stat *stats,
464 int port, uint64_t *data) 464 int port, uint64_t *data)
465{ 465{
466 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); 466 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
467 int ret; 467 int ret;
468 int i; 468 int i;
469 469