2015-02-09 19:13:25

by Nicholas Mc Guire

[permalink] [raw]
Subject: [PATCH] misc: mic: fixup return type of wait_for_completion_timeout

return type of wait_for_completion_timeout is unsigned long not int. The
rc variable is renamed timeout to reflect its use and the type adjusted to
unsigned long.

Signed-off-by: Nicholas Mc Guire <[email protected]>
---

Patch was only compile tested with x86_64_defconfig + CONFIG_INTEL_MIC_BUS=m
CONFIG_INTEL_MIC_HOST=m

Patch is against 3.19.0-rc7 (localversion-next is -next-20150209)

drivers/misc/mic/host/mic_boot.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/mic/host/mic_boot.c b/drivers/misc/mic/host/mic_boot.c
index ff2b0fb..d9fa609 100644
--- a/drivers/misc/mic/host/mic_boot.c
+++ b/drivers/misc/mic/host/mic_boot.c
@@ -309,7 +309,7 @@ void mic_complete_resume(struct mic_device *mdev)
*/
void mic_prepare_suspend(struct mic_device *mdev)
{
- int rc;
+ unsigned long timeout;

#define MIC_SUSPEND_TIMEOUT (60 * HZ)

@@ -331,10 +331,10 @@ void mic_prepare_suspend(struct mic_device *mdev)
*/
mic_set_state(mdev, MIC_SUSPENDING);
mutex_unlock(&mdev->mic_mutex);
- rc = wait_for_completion_timeout(&mdev->reset_wait,
- MIC_SUSPEND_TIMEOUT);
+ timeout = wait_for_completion_timeout(&mdev->reset_wait,
+ MIC_SUSPEND_TIMEOUT);
/* Force reset the card if the shutdown completion timed out */
- if (!rc) {
+ if (!timeout) {
mutex_lock(&mdev->mic_mutex);
mic_set_state(mdev, MIC_SUSPENDED);
mutex_unlock(&mdev->mic_mutex);
@@ -348,10 +348,10 @@ void mic_prepare_suspend(struct mic_device *mdev)
*/
mic_set_state(mdev, MIC_SUSPENDED);
mutex_unlock(&mdev->mic_mutex);
- rc = wait_for_completion_timeout(&mdev->reset_wait,
- MIC_SUSPEND_TIMEOUT);
+ timeout = wait_for_completion_timeout(&mdev->reset_wait,
+ MIC_SUSPEND_TIMEOUT);
/* Force reset the card if the shutdown completion timed out */
- if (!rc)
+ if (!timeout)
mic_stop(mdev, true);
break;
default:
--
1.7.10.4


2015-02-09 22:00:44

by Dutt, Sudeep

[permalink] [raw]
Subject: Re: [PATCH] misc: mic: fixup return type of wait_for_completion_timeout

On Mon, 2015-02-09 at 14:09 -0500, Nicholas Mc Guire wrote:
> return type of wait_for_completion_timeout is unsigned long not int. The
> rc variable is renamed timeout to reflect its use and the type adjusted to
> unsigned long.
>

Acked-by: Sudeep Dutt <[email protected]>

Thanks for the patch!

> Signed-off-by: Nicholas Mc Guire <[email protected]>
> ---
>
> Patch was only compile tested with x86_64_defconfig + CONFIG_INTEL_MIC_BUS=m
> CONFIG_INTEL_MIC_HOST=m
>
> Patch is against 3.19.0-rc7 (localversion-next is -next-20150209)
>
> drivers/misc/mic/host/mic_boot.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/misc/mic/host/mic_boot.c b/drivers/misc/mic/host/mic_boot.c
> index ff2b0fb..d9fa609 100644
> --- a/drivers/misc/mic/host/mic_boot.c
> +++ b/drivers/misc/mic/host/mic_boot.c
> @@ -309,7 +309,7 @@ void mic_complete_resume(struct mic_device *mdev)
> */
> void mic_prepare_suspend(struct mic_device *mdev)
> {
> - int rc;
> + unsigned long timeout;
>
> #define MIC_SUSPEND_TIMEOUT (60 * HZ)
>
> @@ -331,10 +331,10 @@ void mic_prepare_suspend(struct mic_device *mdev)
> */
> mic_set_state(mdev, MIC_SUSPENDING);
> mutex_unlock(&mdev->mic_mutex);
> - rc = wait_for_completion_timeout(&mdev->reset_wait,
> - MIC_SUSPEND_TIMEOUT);
> + timeout = wait_for_completion_timeout(&mdev->reset_wait,
> + MIC_SUSPEND_TIMEOUT);
> /* Force reset the card if the shutdown completion timed out */
> - if (!rc) {
> + if (!timeout) {
> mutex_lock(&mdev->mic_mutex);
> mic_set_state(mdev, MIC_SUSPENDED);
> mutex_unlock(&mdev->mic_mutex);
> @@ -348,10 +348,10 @@ void mic_prepare_suspend(struct mic_device *mdev)
> */
> mic_set_state(mdev, MIC_SUSPENDED);
> mutex_unlock(&mdev->mic_mutex);
> - rc = wait_for_completion_timeout(&mdev->reset_wait,
> - MIC_SUSPEND_TIMEOUT);
> + timeout = wait_for_completion_timeout(&mdev->reset_wait,
> + MIC_SUSPEND_TIMEOUT);
> /* Force reset the card if the shutdown completion timed out */
> - if (!rc)
> + if (!timeout)
> mic_stop(mdev, true);
> break;
> default: