mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 22:54:05 +08:00
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>
This commit is contained in:
parent
7fa857ed04
commit
a22adce5f9
@ -289,7 +289,7 @@ static int mv88e6123_61_65_setup_port(struct dsa_switch *ds, int p)
|
||||
|
||||
static int mv88e6123_61_65_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
|
@ -155,7 +155,7 @@ static int mv88e6131_setup_global(struct dsa_switch *ds)
|
||||
|
||||
static int mv88e6131_setup_port(struct dsa_switch *ds, int p)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
int addr = REG_PORT(p);
|
||||
u16 val;
|
||||
|
||||
@ -274,7 +274,7 @@ static int mv88e6131_setup_port(struct dsa_switch *ds, int p)
|
||||
|
||||
static int mv88e6131_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
|
@ -74,7 +74,7 @@ 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)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&ps->smi_mutex);
|
||||
@ -118,7 +118,7 @@ int __mv88e6xxx_reg_write(struct mii_bus *bus, int sw_addr, int addr,
|
||||
|
||||
int mv88e6xxx_reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&ps->smi_mutex);
|
||||
@ -256,7 +256,7 @@ static void mv88e6xxx_ppu_reenable_timer(unsigned long _ps)
|
||||
|
||||
static int mv88e6xxx_ppu_access_get(struct dsa_switch *ds)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&ps->ppu_mutex);
|
||||
@ -283,7 +283,7 @@ static int mv88e6xxx_ppu_access_get(struct dsa_switch *ds)
|
||||
|
||||
static void mv88e6xxx_ppu_access_put(struct dsa_switch *ds)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
|
||||
/* Schedule a timer to re-enable the PHY polling unit. */
|
||||
mod_timer(&ps->ppu_timer, jiffies + msecs_to_jiffies(10));
|
||||
@ -292,7 +292,7 @@ static void mv88e6xxx_ppu_access_put(struct dsa_switch *ds)
|
||||
|
||||
void mv88e6xxx_ppu_state_init(struct dsa_switch *ds)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
|
||||
mutex_init(&ps->ppu_mutex);
|
||||
INIT_WORK(&ps->ppu_work, mv88e6xxx_ppu_reenable_work);
|
||||
@ -463,7 +463,7 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
|
||||
int nr_stats, struct mv88e6xxx_hw_stat *stats,
|
||||
int port, uint64_t *data)
|
||||
{
|
||||
struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
|
||||
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user