Re: [PATCH] usb: musb: fix compilation warning on unused function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 07, 2016 at 10:58:44PM -0500, Jérémy Lefaure wrote:
> The function musb_run_resume_work is called only when CONFIG_PM is
> enabled. So this function should not be defined when CONFIG_PM is
> disabled. Otherwise the compiler issues a warning:
> 
> drivers/usb/musb/musb_core.c:2057:12: error: ‘musb_run_resume_work’ defined but
> not used [-Werror=unused-function]
>  static int musb_run_resume_work(struct musb *musb)
>             ^~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Jérémy Lefaure <jeremy.lefaure@xxxxxxxxxxxx>

Applied. Thanks.

Regards,
-Bin.

> ---
> 
> I think that adding a preprocessor condition is a better way to fix this than
> moving the function into the scope of the existing condition to preserve the
> git history.
> 
>  drivers/usb/musb/musb_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 9e22646..fca288bb 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -2050,6 +2050,7 @@ struct musb_pending_work {
>  	struct list_head node;
>  };
>  
> +#ifdef CONFIG_PM
>  /*
>   * Called from musb_runtime_resume(), musb_resume(), and
>   * musb_queue_resume_work(). Callers must take musb->lock.
> @@ -2077,6 +2078,7 @@ static int musb_run_resume_work(struct musb *musb)
>  
>  	return error;
>  }
> +#endif
>  
>  /*
>   * Called to run work if device is active or else queue the work to happen
> -- 
> 2.10.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux