Re: [RFC PATCH net-next 04/20] net: dsa: mv88e6xxx: factorize temperature access

From: Andrew Lunn
Date: Thu May 05 2016 - 19:40:40 EST


> int mv88e6xxx_get_temp(struct dsa_switch *ds, int *temp)
> {
> struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
> + int err;
> +
> + if (!mv88e6xxx_has(ps, MV88E6XXX_FLAG_TEMP))
> + return -EOPNOTSUPP;
> +
> + mutex_lock(&ps->smi_mutex);
>
> if (mv88e6xxx_6320_family(ps) || mv88e6xxx_6352_family(ps))
> - return mv88e63xx_get_temp(ds, temp);
> + err = _mv88e63xx_get_temp(ps, temp);
> + else
> + err = _mv88e61xx_get_temp(ps, temp);

It seems like this should be done with a flag, rather than the family.

However, don't spend too much time on this. I plan to rip it all out
and put it in the correct place, in the Marvell PHY driver. The
temperature sensor is in the PHY, and other Marvell PHYs also have
this temperature sensor.

Andrew