Thread (27 messages) flat view 27 messages, 3 authors, 2022-09-22

Re: [PATCH net-next v2 01/16] net: txgbe: Store PCI info

From: Andrew Lunn <andrew@lunn.ch>
Date: 2022-09-01 00:00:12

quoted
quoted
+	/* if there's flash existing */
+	if (!(rd32(hw, TXGBE_SPI_STATUS) &
+	      TXGBE_SPI_STATUS_FLASH_BYPASS)) {
+		/* wait hw load flash done */
+		for (i = 0; i < TXGBE_MAX_FLASH_LOAD_POLL_TIME; i++) {
+			reg = rd32(hw, TXGBE_SPI_ILDR_STATUS);
+			if (!(reg & check_bit)) {
+				/* done */
+				break;
+			}
+			msleep(200);
+		}
This is what iopoll.h is for. Any sort of loop waiting for something to
happen
quoted
should use one of the helpers in there.
The description of functions in iopoll.h states that maximum sleep time
should be less than 20ms, is it okay to call it here for 200ms.
Should be fine.

You could always reduce the sleep and just poll 10 times more. What
you are doing, reading one register, is cheap.

    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