Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[sfrench/cifs-2.6.git] / drivers / input / joystick / xpad.c
index 42f7b257feb034df6b760042332d54703e992a17..83811e45d6339b013cc4f9cc16b90c5c66ba8af8 100644 (file)
@@ -256,6 +256,7 @@ MODULE_DEVICE_TABLE (usb, xpad_table);
 struct usb_xpad {
        struct input_dev *dev;          /* input device interface */
        struct usb_device *udev;        /* usb device */
+       struct usb_interface *intf;     /* usb interface */
 
        int pad_present;
 
@@ -461,6 +462,7 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha
 static void xpad_irq_in(struct urb *urb)
 {
        struct usb_xpad *xpad = urb->context;
+       struct device *dev = &xpad->intf->dev;
        int retval, status;
 
        status = urb->status;
@@ -473,11 +475,11 @@ static void xpad_irq_in(struct urb *urb)
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
+               dev_dbg(dev, "%s - urb shutting down with status: %d\n",
                        __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d",
+               dev_dbg(dev, "%s - nonzero urb status received: %d\n",
                        __func__, status);
                goto exit;
        }
@@ -496,12 +498,15 @@ static void xpad_irq_in(struct urb *urb)
 exit:
        retval = usb_submit_urb(urb, GFP_ATOMIC);
        if (retval)
-               err ("%s - usb_submit_urb failed with result %d",
-                    __func__, retval);
+               dev_err(dev, "%s - usb_submit_urb failed with result %d\n",
+                       __func__, retval);
 }
 
 static void xpad_bulk_out(struct urb *urb)
 {
+       struct usb_xpad *xpad = urb->context;
+       struct device *dev = &xpad->intf->dev;
+
        switch (urb->status) {
        case 0:
                /* success */
@@ -510,16 +515,20 @@ static void xpad_bulk_out(struct urb *urb)
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __func__, urb->status);
+               dev_dbg(dev, "%s - urb shutting down with status: %d\n",
+                       __func__, urb->status);
                break;
        default:
-               dbg("%s - nonzero urb status received: %d", __func__, urb->status);
+               dev_dbg(dev, "%s - nonzero urb status received: %d\n",
+                       __func__, urb->status);
        }
 }
 
 #if defined(CONFIG_JOYSTICK_XPAD_FF) || defined(CONFIG_JOYSTICK_XPAD_LEDS)
 static void xpad_irq_out(struct urb *urb)
 {
+       struct usb_xpad *xpad = urb->context;
+       struct device *dev = &xpad->intf->dev;
        int retval, status;
 
        status = urb->status;
@@ -533,19 +542,21 @@ static void xpad_irq_out(struct urb *urb)
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __func__, status);
+               dev_dbg(dev, "%s - urb shutting down with status: %d\n",
+                       __func__, status);
                return;
 
        default:
-               dbg("%s - nonzero urb status received: %d", __func__, status);
+               dev_dbg(dev, "%s - nonzero urb status received: %d\n",
+                       __func__, status);
                goto exit;
        }
 
 exit:
        retval = usb_submit_urb(urb, GFP_ATOMIC);
        if (retval)
-               err("%s - usb_submit_urb failed with result %d",
-                   __func__, retval);
+               dev_err(dev, "%s - usb_submit_urb failed with result %d\n",
+                       __func__, retval);
 }
 
 static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
@@ -658,7 +669,8 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
                        return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
 
                default:
-                       dbg("%s - rumble command sent to unsupported xpad type: %d",
+                       dev_dbg(&xpad->dev->dev,
+                               "%s - rumble command sent to unsupported xpad type: %d\n",
                                __func__, xpad->xtype);
                        return -1;
                }
@@ -848,6 +860,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
        }
 
        xpad->udev = udev;
+       xpad->intf = intf;
        xpad->mapping = xpad_device[i].mapping;
        xpad->xtype = xpad_device[i].xtype;