Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736690

Re: [PATCH v2 27/31] usb/gadget/snps_udc_core: Remove struct timer_list.data use

From Michal Nazarewicz <mina86@mina86.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 27/31] usb/gadget/snps_udc_core: Remove struct timer_list.data use
Date 2017-09-21 16:10 +0200
Message-ID <usakW-21y-13@gated-at.bofh.it> (permalink)
References <urWBj-1gx-3@gated-at.bofh.it> <urWUF-1nO-1@gated-at.bofh.it>
Organization http://mina86.com/

Show all headers | View raw


On Wed, Sep 20 2017, Kees Cook wrote:
> If the probe fails, udc_remove() will not be called, so there is no
> reason to make del_timer_sync() calls conditional. As a result, use of
> the .data field can be dropped, in support of making removing this field
> entirely from struct timer_list.
>
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Raviteja Garimella <raviteja.garimella@broadcom.com>
> Cc: Michal Nazarewicz <mina86@mina86.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/usb/gadget/udc/snps_udc_core.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c
> index 5460e5ba1c3c..e05bdc16e1e3 100644
> --- a/drivers/usb/gadget/udc/snps_udc_core.c
> +++ b/drivers/usb/gadget/udc/snps_udc_core.c
> @@ -3067,14 +3067,12 @@ void udc_remove(struct udc *dev)
>  	stop_timer++;
>  	if (timer_pending(&udc_timer))
>  		wait_for_completion(&on_exit);
> -	if (udc_timer.data)
> -		del_timer_sync(&udc_timer);
> +	del_timer_sync(&udc_timer);
>  	/* remove pollstall timer */
>  	stop_pollstall_timer++;
>  	if (timer_pending(&udc_pollstall_timer))
>  		wait_for_completion(&on_pollstall_exit);
> -	if (udc_pollstall_timer.data)
> -		del_timer_sync(&udc_pollstall_timer);
> +	del_timer_sync(&udc_pollstall_timer);
>  	udc = NULL;
>  }
>  EXPORT_SYMBOL_GPL(udc_remove);
> @@ -3164,10 +3162,6 @@ int udc_probe(struct udc *dev)
>  	u32		reg;
>  	int		retval;
>  
> -	/* mark timer as not initialized */
> -	udc_timer.data = 0;
> -	udc_pollstall_timer.data = 0;
> -
>  	/* device struct setup */
>  	dev->gadget.ops = &udc_ops;
>  
> @@ -3207,8 +3201,8 @@ int udc_probe(struct udc *dev)
>  		goto finished;
>  
>  	/* timer init */
> -	setup_timer(&udc_timer, udc_timer_function, 1);
> -	setup_timer(&udc_pollstall_timer, udc_pollstall_timer_function, 1);
> +	setup_timer(&udc_timer, udc_timer_function, 0);
> +	setup_timer(&udc_pollstall_timer, udc_pollstall_timer_function, 0);
>  
>  	/* set SD */
>  	reg = readl(&dev->regs->ctl);

-- 
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/31] struct timer_list callback argument conversion, step 1 Kees Cook <keescook@chromium.org> - 2017-09-21 01:40 +0200
  [PATCH v2 27/31] usb/gadget/snps_udc_core: Remove struct timer_list.data use Kees Cook <keescook@chromium.org> - 2017-09-21 01:50 +0200
    Re: [PATCH v2 27/31] usb/gadget/snps_udc_core: Remove struct timer_list.data use Michal Nazarewicz <mina86@mina86.com> - 2017-09-21 16:10 +0200
  [PATCH v2 20/31] net/core: Collapse redundant sk_timer callback data assignments Kees Cook <keescook@chromium.org> - 2017-09-21 01:50 +0200
  [PATCH v2 24/31] mips/sgi-ip22: Use separate static data field with with static timer Kees Cook <keescook@chromium.org> - 2017-09-21 01:50 +0200
  [PATCH v2 18/31] scsi/aic7xxx: Clean up timer usage Kees Cook <keescook@chromium.org> - 2017-09-21 01:50 +0200
    Re: [PATCH v2 18/31] scsi/aic7xxx: Clean up timer usage Hannes Reinecke <hare@suse.com> - 2017-09-21 09:40 +0200

csiph-web