Thread (13 messages) flat view 13 messages, 2 authors, 4d ago

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

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-07-30 21:34:36
Also in: linux-doc, lkml

+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help