Re: [PATCH]: mutex: Fix !CONFIG_MUTEX_SPIN_ON_OWNER compile warning

From: Frederic Weisbecker
Date: Thu May 27 2010 - 15:16:37 EST


On Thu, May 27, 2010 at 03:07:40PM -0400, Prarit Bhargava wrote:
> Fixes linux-next !CONFIG_MUTEX_SPIN_ON_OWNER compile warning:
>
> kernel/mutex.c: In function â__mutex_lock_commonâ:
> kernel/mutex.c:148: error: unused variable âtimeoutâ
>
> timeout is only used if CONFIG_MUTEX_SPIN_ON_OWNER is on.
>
> Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
>
> diff --git a/kernel/mutex.c b/kernel/mutex.c
> index 7d4626b..c262942 100644
> --- a/kernel/mutex.c
> +++ b/kernel/mutex.c
> @@ -145,7 +145,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
> struct task_struct *task = current;
> struct mutex_waiter waiter;
> unsigned long flags;
> +#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
> unsigned long timeout;
> +#endif



Andrew had a patch that fixed it with a "__used" tag.
Either way that doesn't look much proper.

It would be much nicer to put the mutex spinning in a separate
function, that would be a stub with !CONFIG_MUTEX_SPIN_ON_OWNER.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/