Re: [PATCH 2/4] net: dsa: vsc73xx: Split vsc73xx driver
From: Andrew Lunn
Date: Mon Jul 01 2019 - 12:03:18 EST
> @@ -495,12 +380,12 @@ static int vsc73xx_update_bits(struct vsc73xx *vsc, u8 block, u8 subblock,
> int ret;
>
> /* Same read-modify-write algorithm as e.g. regmap */
> - ret = vsc73xx_read(vsc, block, subblock, reg, &orig);
> + ret = vsc->ops->read(vsc, block, subblock, reg, &orig);
> if (ret)
> return ret;
> tmp = orig & ~mask;
> tmp |= val & mask;
> - return vsc73xx_write(vsc, block, subblock, reg, tmp);
> + return vsc->ops->write(vsc, block, subblock, reg, tmp);
This patch would be a lot less invasive and smaller if you hid the
difference between SPI and platform inside vsc73xx_write() and
vsc73xx_read().
> -static int vsc73xx_probe(struct spi_device *spi)
> +int vsc73xx_probe(struct vsc73xx *vsc)
> {
> - struct device *dev = &spi->dev;
struct device *dev = vsc->dev;
and then a lot of the changes you make here go away.
In general, think about how to make the changes small. It saves your
time from actually making changes, and reviewer time since the patch
it smaller.
Andrew