Messages in this thread | | | From | Harini Katakam <> | Date | Thu, 3 May 2018 16:28:51 +0530 | Subject | Re: [RFC PATCH 1/5] net: macb: Check MDIO state before read/write and use timeouts |
| |
Hi Claudiu,
On Thu, May 3, 2018 at 3:38 PM, Claudiu Beznea <Claudiu.Beznea@microchip.com> wrote: > > > On 22.03.2018 15:51, harinikatakamlinux@gmail.com wrote: >> From: Harini Katakam <harinik@xilinx.com> >> <snip> >> + ulong timeout; >> + >> + timeout = jiffies + msecs_to_jiffies(1000); >> + /* wait for end of transfer */ >> + do { >> + if (MACB_BFEXT(IDLE, macb_readl(bp, NSR))) >> + break; >> + >> + cpu_relax(); >> + } while (!time_after_eq(jiffies, timeout)); >> + >> + if (time_after_eq(jiffies, timeout)) { >> + netdev_err(bp->dev, "wait for end of transfer timed out\n"); >> + return -ETIMEDOUT; >> + } > > Wouldn't be cleaner to keep it in this way: > > while (!MACB_BFEXT(IDLE, macb_readl(bp, NSR))) { > if (time_after_eq(jiffies, timeout) { > netdev_err(bp->dev, "wait for end of transfer timed out\n"); > return -ETIMEDOUT; > } > cpu_relax(); > } >
Thanks for the review. Sure, will update in next version.
Regards, Harini
| |