Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / drivers / usb / core / hub.c
index 0ce393e..2651c2e 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/usbdevice_fs.h>
 #include <linux/kthread.h>
 #include <linux/mutex.h>
+#include <linux/freezer.h>
 
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
@@ -68,7 +69,7 @@ struct usb_hub {
 
        unsigned                has_indicators:1;
        u8                      indicator[USB_MAXCHILDREN];
-       struct work_struct      leds;
+       struct delayed_work     leds;
 };
 
 
@@ -218,9 +219,10 @@ static void set_port_led(
 
 #define        LED_CYCLE_PERIOD        ((2*HZ)/3)
 
-static void led_work (void *__hub)
+static void led_work (struct work_struct *work)
 {
-       struct usb_hub          *hub = __hub;
+       struct usb_hub          *hub =
+               container_of(work, struct usb_hub, leds.work);
        struct usb_device       *hdev = hub->hdev;
        unsigned                i;
        unsigned                changed = 0;
@@ -405,9 +407,10 @@ hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
  * talking to TTs must queue control transfers (not just bulk and iso), so
  * both can talk to the same hub concurrently.
  */
-static void hub_tt_kevent (void *arg)
+static void hub_tt_kevent (struct work_struct *work)
 {
-       struct usb_hub          *hub = arg;
+       struct usb_hub          *hub =
+               container_of(work, struct usb_hub, tt.kevent);
        unsigned long           flags;
 
        spin_lock_irqsave (&hub->tt.lock, flags);
@@ -458,7 +461,7 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe)
         * since each TT has "at least two" buffers that can need it (and
         * there can be many TTs per hub).  even if they're uncommon.
         */
-       if ((clear = kmalloc (sizeof *clear, SLAB_ATOMIC)) == NULL) {
+       if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) {
                dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n");
                /* FIXME recover somehow ... RESET_TT? */
                return;
@@ -694,7 +697,7 @@ static int hub_configure(struct usb_hub *hub,
 
        spin_lock_init (&hub->tt.lock);
        INIT_LIST_HEAD (&hub->tt.clear_list);
-       INIT_WORK (&hub->tt.kevent, hub_tt_kevent, hub);
+       INIT_WORK (&hub->tt.kevent, hub_tt_kevent);
        switch (hdev->descriptor.bDeviceProtocol) {
                case 0:
                        break;
@@ -938,7 +941,7 @@ descriptor_error:
        INIT_LIST_HEAD(&hub->event_list);
        hub->intfdev = &intf->dev;
        hub->hdev = hdev;
-       INIT_WORK(&hub->leds, led_work, hub);
+       INIT_DELAYED_WORK(&hub->leds, led_work);
 
        usb_set_intfdata (intf, hub);
        intf->needs_remote_wakeup = 1;
@@ -2369,7 +2372,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
        struct usb_qualifier_descriptor *qual;
        int                             status;
 
-       qual = kmalloc (sizeof *qual, SLAB_KERNEL);
+       qual = kmalloc (sizeof *qual, GFP_KERNEL);
        if (qual == NULL)
                return;
 
@@ -2381,7 +2384,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
                /* hub LEDs are probably harder to miss than syslog */
                if (hub->has_indicators) {
                        hub->indicator[port1-1] = INDICATOR_GREEN_BLINK;
-                       schedule_work (&hub->leds);
+                       schedule_delayed_work (&hub->leds, 0);
                }
        }
        kfree(qual);
@@ -2555,7 +2558,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                                if (hub->has_indicators) {
                                        hub->indicator[port1-1] =
                                                INDICATOR_AMBER_BLINK;
-                                       schedule_work (&hub->leds);
+                                       schedule_delayed_work (&hub->leds, 0);
                                }
                                status = -ENOTCONN;     /* Don't retry */
                                goto loop_disable;
@@ -2920,7 +2923,7 @@ static int config_descriptors_changed(struct usb_device *udev)
                if (len < le16_to_cpu(udev->config[index].desc.wTotalLength))
                        len = le16_to_cpu(udev->config[index].desc.wTotalLength);
        }
-       buf = kmalloc (len, SLAB_KERNEL);
+       buf = kmalloc (len, GFP_KERNEL);
        if (buf == NULL) {
                dev_err(&udev->dev, "no mem to re-read configs after reset\n");
                /* assume the worst */