Commit 69a4aa89 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: correct return codes when msleep gets interrupted

msleep_interruptible() returns time left to wait, not error
code.  Return ERESTARTSYS when interrupted.

While at it correct a comment and make the polling a bit
more aggressive.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a831ffb5
...@@ -209,9 +209,8 @@ nfp_nsp_wait_reg(struct nfp_cpp *cpp, u64 *reg, ...@@ -209,9 +209,8 @@ nfp_nsp_wait_reg(struct nfp_cpp *cpp, u64 *reg,
if ((*reg & mask) == val) if ((*reg & mask) == val)
return 0; return 0;
err = msleep_interruptible(100); if (msleep_interruptible(25))
if (err) return -ERESTARTSYS;
return err;
if (time_after(start_time, wait_until)) if (time_after(start_time, wait_until))
return -ETIMEDOUT; return -ETIMEDOUT;
...@@ -228,7 +227,7 @@ nfp_nsp_wait_reg(struct nfp_cpp *cpp, u64 *reg, ...@@ -228,7 +227,7 @@ nfp_nsp_wait_reg(struct nfp_cpp *cpp, u64 *reg,
* *
* Return: 0 for success with no result * Return: 0 for success with no result
* *
* 1..255 for NSP completion with a result code * positive value for NSP completion with a result code
* *
* -EAGAIN if the NSP is not yet present * -EAGAIN if the NSP is not yet present
* -ENODEV if the NSP is not a supported model * -ENODEV if the NSP is not a supported model
...@@ -380,9 +379,10 @@ int nfp_nsp_wait(struct nfp_nsp *state) ...@@ -380,9 +379,10 @@ int nfp_nsp_wait(struct nfp_nsp *state)
if (err != -EAGAIN) if (err != -EAGAIN)
break; break;
err = msleep_interruptible(100); if (msleep_interruptible(25)) {
if (err) err = -ERESTARTSYS;
break; break;
}
if (time_after(start_time, wait_until)) { if (time_after(start_time, wait_until)) {
err = -ETIMEDOUT; err = -ETIMEDOUT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment