lkml.org 
[lkml]   [2018]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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

\
 
 \ /
  Last update: 2018-05-03 12:59    [W:0.229 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site