Subject: Re: [net 2/2] igb: Fix for issue where values could be too high for udelay function.

From: Sergei Shtylyov <[email-masked]>
Date: Sun, 15 Dec 2013 22:52:37 +0300

Hello.

On 12/14/2013 02:26 PM, Jeff Kirsher wrote:

> From: Carolyn Wyborny <[email-masked]>

> This patch changes the igb_phy_has_link function to check the value of the
> parameter before deciding to use udelay or mdelay in order to be sure that
> the value is not too high for udelay function.

> CC: stable kernel <[email-masked]> # 3.9+
> Signed-off-by: Sunil K Pandey <[email-masked]>
> Signed-off-by: Kevin B Smith <[email-masked]>
> Signed-off-by: Carolyn Wyborny <[email-masked]>
> Tested-by: Aaron Brown <[email-masked]>
> Signed-off-by: Jeff Kirsher <[email-masked]>
> ---
>   drivers/net/ethernet/intel/igb/e1000_phy.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)

> diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
> index c4c4fe3..ad2b74d 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_phy.c
> +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
> @@ -1728,7 +1728,10 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations,
>   			 * ownership of the resources, wait and try again to
>   			 * see if they have relinquished the resources yet.
>   			 */
> -			udelay(usec_interval);
> +			if (usec_interval >= 1000)
> +				mdelay(usec_interval/1000);

    There should be spaces around / at least for consistency with the previous 
line. Also, are you sure it shouldn't be mdelay(DIV_ROUND_UP(usec_interval, 
1000))?

WBR, Sergei