Re: [PATCH net-next v5 4/5] net: dsa: mxl862xx: recover switch stuck in MCUboot rescue mode

Andrew Lunn <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
> +static int mxl862xx_sb_pdi_poll_drain(struct mxl862xx_priv *priv,
> +				      unsigned long timeout_ms)
> +{
> +	unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
> +	int ret;
> +
> +	do {
> +		ret = mxl862xx_smdio_read(priv, MXL862XX_SB_PDI_STAT);
> +		if (ret < 0)
> +			return ret;
> +		if ((u16)ret == MXL862XX_SB_PDI_READY)
> +			return MXL862XX_DRAIN_READY;
> +		if ((u16)ret == 0)
> +			return MXL862XX_DRAIN_FEED;
> +		usleep_range(50, 150);
> +	} while (time_before(jiffies, timeout));

Again, iopoll.h should be better.

       Andrew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.