Re: [RFC PATCH net-next v5 07/25] net: dsa: qca8k: handle error with qca8k_rmw operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -static u32
> -qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 val)
> +static int
> +qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 write_val)
>  {
>  	struct mii_bus *bus = priv->bus;
>  	u16 r1, r2, page;
> -	u32 ret;
> +	u32 val;
> +	int ret;
>  
>  	qca8k_split_addr(reg, &r1, &r2, &page);
>  
> @@ -205,10 +206,15 @@ qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 val)
>  	if (ret < 0)
>  		goto exit;
>  
> -	ret = qca8k_mii_read32(bus, 0x10 | r2, r1);
> -	ret &= ~mask;
> -	ret |= val;
> -	qca8k_mii_write32(bus, 0x10 | r2, r1, ret);
> +	val = qca8k_mii_read32(bus, 0x10 | r2, r1);
> +	if (val < 0) {
> +		ret = val;
> +		goto exit;
> +	}
> +
> +	val &= ~mask;
> +	val |= write_val;
> +	qca8k_mii_write32(bus, 0x10 | r2, r1, val);

Does qca8k_mii_write32() not return an code?

Seems like yet another function you could modify. But i suggest you
wait, get this patchset merged first.

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

    Andrew



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux