]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
usb: gadget: zero: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Tue, 24 Oct 2017 10:08:03 +0000 (03:08 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Nov 2017 15:57:23 +0000 (16:57 +0100)
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. Adds a static tracking variable to
match the timer global.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/legacy/zero.c

index d02e2ce73ea5fd58a14ed798595a3a8181f79c98..3acc589dae981f194f6f867b59ce139c4a04beaa 100644 (file)
@@ -154,10 +154,11 @@ static struct usb_gadget_strings *dev_strings[] = {
 /*-------------------------------------------------------------------------*/
 
 static struct timer_list       autoresume_timer;
+static struct usb_composite_dev *autoresume_cdev;
 
-static void zero_autoresume(unsigned long _c)
+static void zero_autoresume(struct timer_list *unused)
 {
-       struct usb_composite_dev        *cdev = (void *)_c;
+       struct usb_composite_dev        *cdev = autoresume_cdev;
        struct usb_gadget               *g = cdev->gadget;
 
        /* unconfigured devices can't issue wakeups */
@@ -282,7 +283,8 @@ static int zero_bind(struct usb_composite_dev *cdev)
        device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
        device_desc.iSerialNumber = strings_dev[USB_GADGET_SERIAL_IDX].id;
 
-       setup_timer(&autoresume_timer, zero_autoresume, (unsigned long) cdev);
+       autoresume_cdev = cdev;
+       timer_setup(&autoresume_timer, zero_autoresume, 0);
 
        func_inst_ss = usb_get_function_instance("SourceSink");
        if (IS_ERR(func_inst_ss))