diff options
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/joystick/iforce/iforce-main.c | 3 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce-packets.c | 16 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce-usb.c | 18 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce.h | 1 | ||||
-rw-r--r-- | drivers/input/joystick/xpad.c | 35 | ||||
-rw-r--r-- | drivers/input/misc/cm109.c | 33 | ||||
-rw-r--r-- | drivers/input/misc/keyspan_remote.c | 23 | ||||
-rw-r--r-- | drivers/input/misc/powermate.c | 13 | ||||
-rw-r--r-- | drivers/input/misc/yealink.c | 31 | ||||
-rw-r--r-- | drivers/input/mouse/appletouch.c | 59 | ||||
-rw-r--r-- | drivers/input/mouse/bcm5974.c | 24 | ||||
-rw-r--r-- | drivers/input/tablet/acecad.c | 15 | ||||
-rw-r--r-- | drivers/input/tablet/aiptek.c | 28 | ||||
-rw-r--r-- | drivers/input/tablet/gtco.c | 110 | ||||
-rw-r--r-- | drivers/input/tablet/kbtab.c | 15 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 11 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 16 | ||||
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 77 |
18 files changed, 324 insertions, 204 deletions
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 405febd94f2..daeeb4c7e3b 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -317,7 +317,8 @@ int iforce_init_device(struct iforce *iforce) break; if (i == 20) { /* 5 seconds */ - err("Timeout waiting for response from device."); + dev_err(&input_dev->dev, + "Timeout waiting for response from device.\n"); error = -ENODEV; goto fail; } diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index a17b5001600..08f98f2eaf8 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -257,7 +257,8 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) status = usb_submit_urb(iforce->ctrl, GFP_ATOMIC); if (status) { - err("usb_submit_urb failed %d", status); + dev_err(&iforce->intf->dev, + "usb_submit_urb failed %d\n", status); return -1; } @@ -265,12 +266,14 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) iforce->ctrl->status != -EINPROGRESS, HZ); if (iforce->ctrl->status) { - dbg("iforce->ctrl->status = %d", iforce->ctrl->status); + dev_dbg(&iforce->intf->dev, + "iforce->ctrl->status = %d\n", + iforce->ctrl->status); usb_unlink_urb(iforce->ctrl); return -1; } #else - dbg("iforce_get_id_packet: iforce->bus = USB!"); + printk(KERN_DEBUG "iforce_get_id_packet: iforce->bus = USB!\n"); #endif } break; @@ -289,12 +292,15 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) return -1; } #else - err("iforce_get_id_packet: iforce->bus = SERIO!"); + dev_err(&iforce->dev->dev, + "iforce_get_id_packet: iforce->bus = SERIO!\n"); #endif break; default: - err("iforce_get_id_packet: iforce->bus = %d", iforce->bus); + dev_err(&iforce->dev->dev, + "iforce_get_id_packet: iforce->bus = %d\n", + iforce->bus); break; } diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 6c96631ae5d..d96aa27dfcd 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -64,7 +64,7 @@ void iforce_usb_xmit(struct iforce *iforce) if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); - dev_warn(&iforce->dev->dev, "usb_submit_urb failed %d\n", n); + dev_warn(&iforce->intf->dev, "usb_submit_urb failed %d\n", n); } /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. @@ -76,6 +76,7 @@ void iforce_usb_xmit(struct iforce *iforce) static void iforce_usb_irq(struct urb *urb) { struct iforce *iforce = urb->context; + struct device *dev = &iforce->intf->dev; int status; switch (urb->status) { @@ -86,11 +87,12 @@ static void iforce_usb_irq(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); return; default: - dbg("%s - urb has status of: %d", __func__, urb->status); + dev_dbg(dev, "%s - urb has status of: %d\n", + __func__, urb->status); goto exit; } @@ -100,8 +102,8 @@ static void iforce_usb_irq(struct urb *urb) exit: status = usb_submit_urb (urb, GFP_ATOMIC); if (status) - err ("%s - usb_submit_urb failed with result %d", - __func__, status); + dev_err(dev, "%s - usb_submit_urb failed with result %d\n", + __func__, status); } static void iforce_usb_out(struct urb *urb) @@ -110,7 +112,8 @@ static void iforce_usb_out(struct urb *urb) if (urb->status) { clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); - dbg("urb->status %d, exiting", urb->status); + dev_dbg(&iforce->intf->dev, "urb->status %d, exiting\n", + urb->status); return; } @@ -155,6 +158,7 @@ static int iforce_usb_probe(struct usb_interface *intf, iforce->bus = IFORCE_USB; iforce->usbdev = dev; + iforce->intf = intf; iforce->cr.bRequestType = USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE; iforce->cr.wIndex = 0; diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index 9f494b75848..b1d7d9b0eb8 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h @@ -115,6 +115,7 @@ struct iforce { #endif #ifdef CONFIG_JOYSTICK_IFORCE_USB struct usb_device *usbdev; /* USB transfer */ + struct usb_interface *intf; struct urb *irq, *out, *ctrl; struct usb_ctrlrequest cr; #endif diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index fd7a0d5bc94..ee16fb67b7a 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -252,6 +252,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; @@ -457,6 +458,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; @@ -469,11 +471,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; } @@ -492,12 +494,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 */ @@ -506,16 +511,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; @@ -529,19 +538,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) @@ -654,7 +665,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; } @@ -844,6 +856,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; diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index ab860511f01..082684e7f39 100644 --- a/drivers/input/misc/cm109.c +++ b/drivers/input/misc/cm109.c @@ -327,7 +327,9 @@ static void cm109_submit_buzz_toggle(struct cm109_dev *dev) error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); if (error) - err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error); + dev_err(&dev->intf->dev, + "%s: usb_submit_urb (urb_ctl) failed %d\n", + __func__, error); } /* @@ -339,7 +341,7 @@ static void cm109_urb_irq_callback(struct urb *urb) const int status = urb->status; int error; - dev_dbg(&urb->dev->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n", + dev_dbg(&dev->intf->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n", dev->irq_data->byte[0], dev->irq_data->byte[1], dev->irq_data->byte[2], @@ -349,7 +351,7 @@ static void cm109_urb_irq_callback(struct urb *urb) if (status) { if (status == -ESHUTDOWN) return; - err("%s: urb status %d", __func__, status); + dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); } /* Special keys */ @@ -396,7 +398,8 @@ static void cm109_urb_irq_callback(struct urb *urb) error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); if (error) - err("%s: usb_submit_urb (urb_ctl) failed %d", + dev_err(&dev->intf->dev, + "%s: usb_submit_urb (urb_ctl) failed %d\n", __func__, error); } @@ -409,14 +412,14 @@ static void cm109_urb_ctl_callback(struct urb *urb) const int status = urb->status; int error; - dev_dbg(&urb->dev->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n", + dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n", dev->ctl_data->byte[0], dev->ctl_data->byte[1], dev->ctl_data->byte[2], dev->ctl_data->byte[3]); if (status) - err("%s: urb status %d", __func__, status); + dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); spin_lock(&dev->ctl_submit_lock); @@ -433,7 +436,8 @@ static void cm109_urb_ctl_callback(struct urb *urb) dev->irq_urb_pending = 1; error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC); if (error) - err("%s: usb_submit_urb (urb_irq) failed %d", + dev_err(&dev->intf->dev, + "%s: usb_submit_urb (urb_irq) failed %d\n", __func__, error); } } @@ -476,7 +480,8 @@ static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on) dev->ctl_data, USB_PKT_LEN, USB_CTRL_SET_TIMEOUT); if (error < 0 && error != -EINTR) - err("%s: usb_control_msg() failed %d", __func__, error); + dev_err(&dev->intf->dev, "%s: usb_control_msg() failed %d\n", + __func__, error); } static void cm109_stop_traffic(struct cm109_dev *dev) @@ -518,8 +523,8 @@ static int cm109_input_open(struct input_dev *idev) error = usb_autopm_get_interface(dev->intf); if (error < 0) { - err("%s - cannot autoresume, result %d", - __func__, error); + dev_err(&idev->dev, "%s - cannot autoresume, result %d\n", + __func__, error); return error; } @@ -537,7 +542,8 @@ static int cm109_input_open(struct input_dev *idev) error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL); if (error) - err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error); + dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", + __func__, error); else dev->open = 1; @@ -573,7 +579,7 @@ static int cm109_input_ev(struct input_dev *idev, unsigned int type, { struct cm109_dev *dev = input_get_drvdata(idev); - dev_dbg(&dev->udev->dev, + dev_dbg(&dev->intf->dev, "input_ev: type=%u code=%u value=%d\n", type, code, value); if (type != EV_SND) @@ -710,7 +716,8 @@ static int cm109_usb_probe(struct usb_interface *intf, pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); if (ret != USB_PKT_LEN) - err("invalid payload size %d, expected %d", ret, USB_PKT_LEN); + dev_err(&intf->dev, "invalid payload size %d, expected %d\n", + ret, USB_PKT_LEN); /* initialise irq urb */ usb_fill_int_urb(dev->urb_irq, udev, pipe, dev->irq_data, diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c index d99151a8bf1..290fa5f97de 100644 --- a/drivers/input/misc/keyspan_remote.c +++ b/drivers/input/misc/keyspan_remote.c @@ -157,7 +157,7 @@ static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed) * though so it's not too big a deal */ if (dev->data.pos >= dev->data.len) { - dev_dbg(&dev->udev->dev, + dev_dbg(&dev->interface->dev, "%s - Error ran out of data. pos: %d, len: %d\n", __func__, dev->data.pos, dev->data.len); return -1; @@ -267,7 +267,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Unknown sequence found in system data.\n", __func__); + dev_err(&remote->interface->dev, + "%s - Unknown sequence found in system data.\n", + __func__); remote->stage = 0; return; } @@ -286,7 +288,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Unknown sequence found in button data.\n", __func__); + dev_err(&remote->interface->dev, + "%s - Unknown sequence found in button data.\n", + __func__); remote->stage = 0; return; } @@ -302,7 +306,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Error in message, invalid toggle.\n", __func__); + dev_err(&remote->interface->dev, + "%s - Error in message, invalid toggle.\n", + __func__); remote->stage = 0; return; } @@ -312,10 +318,11 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 5; remote->data.bits_left -= 5; } else { - err("Bad message received, no stop bit found.\n"); + dev_err(&remote->interface->dev, + "Bad message received, no stop bit found.\n"); } - dev_dbg(&remote->udev->dev, + dev_dbg(&remote->interface->dev, "%s found valid message: system: %d, button: %d, toggle: %d\n", __func__, message.system, message.button, message.toggle); @@ -397,7 +404,9 @@ static void keyspan_irq_recv(struct urb *urb) resubmit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - err ("%s - usb_submit_urb failed with result: %d", __func__, retval); + dev_err(&dev->interface->dev, + "%s - usb_submit_urb failed with result: %d\n", + __func__, retval); } static int keyspan_open(struct input_dev *dev) diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index 538f7049ec6..49c0c3ebd32 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c @@ -65,6 +65,7 @@ struct powermate_device { struct urb *irq, *config; struct usb_ctrlrequest *configcr; struct usb_device *udev; + struct usb_interface *intf; struct input_dev *input; spinlock_t lock; int static_brightness; @@ -85,6 +86,7 @@ static void powermate_config_complete(struct urb *urb); static void powermate_irq(struct urb *urb) { struct powermate_device *pm = urb->context; + struct device *dev = &pm->intf->dev; int retval; switch (urb->status) { @@ -95,10 +97,12 @@ static void powermate_irq(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); return; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -110,8 +114,8 @@ static void powermate_irq(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); } /* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ @@ -330,6 +334,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i goto fail3; pm->udev = udev; + pm->intf = intf; pm->input = input_dev; usb_make_path(udev, pm->phys, sizeof(pm->phys)); diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index f4776e7f8c1..285a5bd6cbc 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c @@ -101,6 +101,7 @@ static const struct lcd_segment_map { struct yealink_dev { struct input_dev *idev; /* input device */ struct usb_device *udev; /* usb device */ + struct usb_interface *intf; /* usb interface */ /* irq input channel */ struct yld_ctl_packet *irq_data; @@ -428,7 +429,8 @@ static void urb_irq_callback(struct urb *urb) int ret, status = urb->status; if (status) - err("%s - urb status %d", __func__, status); + dev_err(&yld->intf->dev, "%s - urb status %d\n", + __func__, status); switch (yld->irq_data->cmd) { case CMD_KEYPRESS: @@ -437,13 +439,15 @@ static void urb_irq_callback(struct urb *urb) break; case CMD_SCANCODE: - dbg("get scancode %x", yld->irq_data->data[0]); + dev_dbg(&yld->intf->dev, "get scancode %x\n", + yld->irq_data->data[0]); report_key(yld, map_p1k_to_key(yld->irq_data->data[0])); break; default: - err("unexpected response %x", yld->irq_data->cmd); + dev_err(&yld->intf->dev, "unexpected response %x\n", + yld->irq_data->cmd); } yealink_do_idle_tasks(yld); @@ -451,7 +455,9 @@ static void urb_irq_callback(struct urb *urb) if (!yld->shutdown) { ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); if (ret && ret != -EPERM) - err("%s - usb_submit_urb failed %d", __func__, ret); + dev_err(&yld->intf->dev, + "%s - usb_submit_urb failed %d\n", + __func__, ret); } } @@ -461,7 +467,8 @@ static void urb_ctl_callback(struct urb *urb) int ret = 0, status = urb->status; if (status) - err("%s - urb status %d", __func__, status); + dev_err(&yld->intf->dev, "%s - urb status %d\n", + __func__, status); switch (yld->ctl_data->cmd) { case CMD_KEYPRESS: @@ -479,7 +486,8 @@ static void urb_ctl_callback(struct urb *urb) } if (ret && ret != -EPERM) - err("%s - usb_submit_urb failed %d", __func__, ret); + dev_err(&yld->intf->dev, "%s - usb_submit_urb failed %d\n", + __func__, ret); } /******************************************************************************* @@ -511,7 +519,7 @@ static int input_open(struct input_dev *dev) struct yealink_dev *yld = input_get_drvdata(dev); int i, ret; - dbg("%s", __func__); + dev_dbg(&yld->intf->dev, "%s\n", __func__); /* force updates to device */ for (i = 0; i<sizeof(yld->master); i++) @@ -526,8 +534,9 @@ static int input_open(struct input_dev *dev) yld->ctl_data->size = 10; yld->ctl_data->sum = 0x100-CMD_INIT-10; if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) { - dbg("%s - usb_submit_urb failed with result %d", - __func__, ret); + dev_dbg(&yld->intf->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, ret); return ret; } return 0; @@ -876,6 +885,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) return -ENOMEM; yld->udev = udev; + yld->intf = intf; yld->idev = input_dev = input_allocate_device(); if (!input_dev) @@ -909,7 +919,8 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); if (ret != USB_PKT_LEN) - err("invalid payload size %d, expected %zd", ret, USB_PKT_LEN); + dev_err(&intf->dev, "invalid payload size %d, expected %zd\n", + ret, USB_PKT_LEN); /* initialise irq urb */ usb_fill_int_urb(yld->urb_irq, udev, pipe, yld->irq_data, diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 0acbc7d50d0..e42f1fa8cdc 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -195,6 +195,7 @@ enum atp_status_bits { struct atp { char phys[64]; struct usb_device *udev; /* usb device */ + struct usb_interface *intf; /* usb interface */ struct urb *urb; /* usb request block */ u8 *data; /* transferred data */ struct input_dev *input; /* input dev */ @@ -253,8 +254,9 @@ MODULE_PARM_DESC(debug, "Activate debugging output"); * packets (Report ID 2). This code changes device mode, so it * sends raw sensor reports (Report ID 5). */ -static int atp_geyser_init(struct usb_device *udev) +static int atp_geyser_init(struct atp *dev) { + struct usb_device *udev = dev->udev; char *data; int size; int i; @@ -262,7 +264,7 @@ static int atp_geyser_init(struct usb_device *udev) data = kmalloc(8, GFP_KERNEL); if (!data) { - err("Out of memory"); + dev_err(&dev->intf->dev, "Out of memory\n"); return -ENOMEM; } @@ -277,7 +279,7 @@ static int atp_geyser_init(struct usb_device *udev) for (i = 0; i < 8; i++) dprintk("appletouch[%d]: %d\n", i, data[i]); - err("Failed to read mode from device."); + dev_err(&dev->intf->dev, "Failed to read mode from device.\n"); ret = -EIO; goto out_free; } @@ -296,7 +298,7 @@ static int atp_geyser_init(struct usb_device *udev) for (i = 0; i < 8; i++) dprintk("appletouch[%d]: %d\n", i, data[i]); - err("Failed to request geyser raw mode"); + dev_err(&dev->intf->dev, "Failed to request geyser raw mode\n"); ret = -EIO; goto out_free; } @@ -313,16 +315,16 @@ out_free: static void atp_reinit(struct work_struct *work) { struct atp *dev = container_of(work, struct atp, work); - struct usb_device *udev = dev->udev; int retval; dprintk("appletouch: putting appletouch to sleep (reinit)\n"); - atp_geyser_init(udev); + atp_geyser_init(dev); retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - err("atp_reinit: usb_submit_urb failed with error %d", - retval); + dev_err(&dev->intf->dev, + "atp_reinit: usb_submit_urb failed with error %d\n", + retval); } static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, @@ -400,6 +402,7 @@ static inline void atp_report_fingers(struct input_dev *input, int fingers) static int atp_status_check(struct urb *urb) { struct atp *dev = urb->context; + struct usb_interface *intf = dev->intf; switch (urb->status) { case 0: @@ -407,8 +410,8 @@ static int atp_status_check(struct urb *urb) break; case -EOVERFLOW: if (!dev->overflow_warned) { - printk(KERN_WARNING "appletouch: OVERFLOW with data " - "length %d, actual length is %d\n", + dev_warn(&intf->dev, + "appletouch: OVERFLOW with data length %d, actual length is %d\n", dev->info->datalen, dev->urb->actual_length); dev->overflow_warned = true; } @@ -416,13 +419,15 @@ static int atp_status_check(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* This urb is terminated, clean up */ - dbg("atp_complete: urb shutting down with status: %d", - urb->status); + dev_dbg(&intf->dev, + "atp_complete: urb shutting down with status: %d\n", + urb->status); return ATP_URB_STATUS_ERROR_FATAL; default: - dbg("atp_complete: nonzero urb status received: %d", - urb->status); + dev_dbg(&intf->dev, + "atp_complete: nonzero urb status received: %d\n", + urb->status); return ATP_URB_STATUS_ERROR; } @@ -445,7 +450,8 @@ static void atp_detect_size(struct atp *dev) for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { if (dev->xy_cur[i]) { - printk(KERN_INFO "appletouch: 17\" model detected.\n"); + dev_info(&dev->intf->dev, + "appletouch: 17\" model detected.\n"); input_set_abs_params(dev->input, ABS_X, 0, (dev->info->xsensors_17 - 1) * @@ -588,8 +594,9 @@ static void atp_complete_geyser_1_2(struct urb *urb) exit: retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - err("atp_complete: usb_submit_urb failed with result %d", - retval); + dev_err(&dev->intf->dev, + "atp_complete: usb_submit_urb failed with result %d\n", + retval); } /* Interrupt function for older touchpads: GEYSER3/GEYSER4 */ @@ -722,8 +729,9 @@ static void atp_complete_geyser_3_4(struct urb *urb) exit: retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - err("atp_complete: usb_submit_urb failed with result %d", - retval); + dev_err(&dev->intf->dev, + "atp_complete: usb_submit_urb failed with result %d\n", + retval); } static int atp_open(struct input_dev *input) @@ -748,14 +756,12 @@ static void atp_close(struct input_dev *input) static int atp_handle_geyser(struct atp *dev) { - struct usb_device *udev = dev->udev; - if (dev->info != &fountain_info) { /* switch to raw sensor mode */ - if (atp_geyser_init(udev)) + if (atp_geyser_init(dev)) return -EIO; - printk(KERN_INFO "appletouch: Geyser mode initialized.\n"); + dev_info(&dev->intf->dev, "Geyser mode initialized.\n"); } return 0; @@ -785,7 +791,7 @@ static int atp_probe(struct usb_interface *iface, } } if (!int_in_endpointAddr) { - err("Could not find int-in endpoint"); + dev_err(&iface->dev, "Could not find int-in endpoint\n"); return -EIO; } @@ -793,11 +799,12 @@ static int atp_probe(struct usb_interface *iface, dev = kzalloc(sizeof(struct atp), GFP_KERNEL); input_dev = input_allocate_device(); if (!dev || !input_dev) { - err("Out of memory"); + dev_err(&iface->dev, "Out of memory\n"); goto err_free_devs; } dev->udev = udev; + dev->intf = iface; dev->input = input_dev; dev->info = info; dev->overflow_warned = false; @@ -886,7 +893,7 @@ static void atp_disconnect(struct usb_interface *iface) usb_free_urb(dev->urb); kfree(dev); } - printk(KERN_INFO "input: appletouch disconnected\n"); + dev_info(&iface->dev, "input: appletouch disconnected\n"); } static int atp_recover(struct atp *dev) diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index f9e2758b9f4..2cf681d98c0 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -584,7 +584,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) int retval = 0, size; if (!data) { - err("bcm5974: out of memory"); + dev_err(&dev->intf->dev, "out of memory\n"); retval = -ENOMEM; goto out; } @@ -597,7 +597,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); if (size != 8) { - err("bcm5974: could not read from device"); + dev_err(&dev->intf->dev, "could not read from device\n"); retval = -EIO; goto out; } @@ -615,7 +615,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); if (size != 8) { - err("bcm5974: could not write to device"); + dev_err(&dev->intf->dev, "could not write to device\n"); retval = -EIO; goto out; } @@ -631,6 +631,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) static void bcm5974_irq_button(struct urb *urb) { struct bcm5974 *dev = urb->context; + struct usb_interface *intf = dev->intf; int error; switch (urb->status) { @@ -640,10 +641,11 @@ static void bcm5974_irq_button(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("bcm5974: button urb shutting down: %d", urb->status); + dev_dbg(&intf->dev, "button urb shutting down: %d\n", + urb->status); return; default: - dbg("bcm5974: button urb status: %d", urb->status); + dev_dbg(&intf->dev, "button urb status: %d\n", urb->status); goto exit; } @@ -654,12 +656,13 @@ static void bcm5974_irq_button(struct urb *urb) exit: error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); if (error) - err("bcm5974: button urb failed: %d", error); + dev_err(&intf->dev, "button urb failed: %d\n", error); } static void bcm5974_irq_trackpad(struct urb *urb) { struct bcm5974 *dev = urb->context; + struct usb_interface *intf = dev->intf; int error; switch (urb->status) { @@ -669,10 +672,11 @@ static void bcm5974_irq_trackpad(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("bcm5974: trackpad urb shutting down: %d", urb->status); + dev_dbg(&intf->dev, "trackpad urb shutting down: %d\n", + urb->status); return; default: - dbg("bcm5974: trackpad urb status: %d", urb->status); + dev_dbg(&intf->dev, "trackpad urb status: %d\n", urb->status); goto exit; } @@ -687,7 +691,7 @@ static void bcm5974_irq_trackpad(struct urb *urb) exit: error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); if (error) - err("bcm5974: trackpad urb failed: %d", error); + dev_err(&intf->dev, "trackpad urb failed: %d\n", error); } /* @@ -833,7 +837,7 @@ static int bcm5974_probe(struct usb_interface *iface, dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL); input_dev = input_allocate_device(); if (!dev || !input_dev) { - err("bcm5974: out of memory"); + dev_err(&iface->dev, "out of memory\n"); goto err_free_devs; } diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index f8b0b1df913..e062ec899ca 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c @@ -51,6 +51,7 @@ struct usb_acecad { char name[128]; char phys[64]; struct usb_device *usbdev; + struct usb_interface *intf; struct input_dev *input; struct urb *irq; @@ -63,6 +64,7 @@ static void usb_acecad_irq(struct urb *urb) struct usb_acecad *acecad = urb->context; unsigned char *data = acecad->data; struct input_dev *dev = acecad->input; + struct usb_interface *intf = acecad->intf; int prox, status; switch (urb->status) { @@ -73,10 +75,12 @@ static void usb_acecad_irq(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(&intf->dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto resubmit; } @@ -105,8 +109,10 @@ static void usb_acecad_irq(struct urb *urb) resubmit: status = usb_submit_urb(urb, GFP_ATOMIC); if (status) - err("can't resubmit intr, %s-%s/input0, status %d", - acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); + dev_err(&intf->dev, + "can't resubmit intr, %s-%s/input0, status %d\n", + acecad->usbdev->bus->bus_name, + acecad->usbdev->devpath, status); } static int usb_acecad_open(struct input_dev *dev) @@ -168,6 +174,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ } acecad->usbdev = dev; + acecad->intf = intf; acecad->input = input_dev; if (dev->manufacturer) diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 205d16aab44..755a39e4c9e 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -309,6 +309,7 @@ struct aiptek_settings { struct aiptek { struct input_dev *inputdev; /* input device struct */ struct usb_device *usbdev; /* usb device struct */ + struct usb_interface *intf; /* usb interface struct */ struct urb *urb; /* urb for incoming reports */ dma_addr_t data_dma; /* our dma stuffage */ struct aiptek_features features; /* tablet's array of features */ @@ -435,6 +436,7 @@ static void aiptek_irq(struct urb *urb) struct aiptek *aiptek = urb->context; unsigned char *data = aiptek->data; struct input_dev *inputdev = aiptek->inputdev; + struct usb_interface *intf = aiptek->intf; int jitterable = 0; int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck; @@ -447,13 +449,13 @@ static void aiptek_irq(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(&intf->dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", - __func__, urb->status); + dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -785,7 +787,7 @@ static void aiptek_irq(struct urb *urb) 1 | AIPTEK_REPORT_TOOL_UNKNOWN); input_sync(inputdev); } else { - dbg("Unknown report %d", data[0]); + dev_dbg(&intf->dev, "Unknown report %d\n", data[0]); } /* Jitter may occur when the user presses a button on the stlyus @@ -811,8 +813,9 @@ static void aiptek_irq(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval != 0) { - err("%s - usb_submit_urb failed with result %d", - __func__, retval); + dev_err(&intf->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, retval); } } @@ -912,8 +915,9 @@ aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data) if ((ret = aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { - dbg("aiptek_program: failed, tried to send: 0x%02x 0x%02x", - command, data); + dev_dbg(&aiptek->intf->dev, + "aiptek_program: failed, tried to send: 0x%02x 0x%02x\n", + command, data); } kfree(buf); return ret < 0 ? ret : 0; @@ -947,8 +951,9 @@ aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data) if ((ret = aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { - dbg("aiptek_query failed: returned 0x%02x 0x%02x 0x%02x", - buf[0], buf[1], buf[2]); + dev_dbg(&aiptek->intf->dev, + "aiptek_query failed: returned 0x%02x 0x%02x 0x%02x\n", + buf[0], buf[1], buf[2]); ret = -EIO; } else { ret = get_unaligned_le16(buf + 1); @@ -1726,6 +1731,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) aiptek->inputdev = inputdev; aiptek->usbdev = usbdev; + aiptek->intf = intf; aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; aiptek->inDelay = 0; aiptek->endDelay = 0; diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 89a297801dc..29e01ab6859 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c @@ -2,8 +2,6 @@ GTCO digitizer USB driver -Use the err() and dbg() macros from usb.h for system logging - TO CHECK: Is pressure done right on report 5? Copyright (C) 2006 GTCO CalComp @@ -108,6 +106,7 @@ struct gtco { struct input_dev *inputdevice; /* input device struct pointer */ struct usb_device *usbdev; /* the usb device for this device */ + struct usb_interface *intf; /* the usb interface for this device */ struct urb *urbinfo; /* urb for incoming reports */ dma_addr_t buf_dma; /* dma addr of the data buffer*/ unsigned char * buffer; /* databuffer for reports */ @@ -202,6 +201,7 @@ struct hid_descriptor static void parse_hid_report_descriptor(struct gtco *device, char * report, int length) { + struct device *ddev = &device->intf->dev; int x, i = 0; /* Tag primitive vars */ @@ -228,7 +228,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, char indentstr[10] = ""; - dbg("======>>>>>>PARSE<<<<<<======"); + dev_dbg(ddev, "======>>>>>>PARSE<<<<<<======\n"); /* Walk this report and pull out the info we need */ while (i < length) { @@ -277,11 +277,11 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, else if (data == 3) strcpy(globtype, "Var|Const"); - dbg("::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits", - globalval[TAG_GLOB_REPORT_ID], inputnum, - globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX], - globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN], - globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]); + dev_dbg(ddev, "::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\n", + globalval[TAG_GLOB_REPORT_ID], inputnum, + globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX], + globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN], + globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]); /* @@ -292,7 +292,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, */ switch (inputnum) { case 0: /* X coord */ - dbg("GER: X Usage: 0x%x", usage); + dev_dbg(ddev, "GER: X Usage: 0x%x\n", usage); if (device->max_X == 0) { device->max_X = globalval[TAG_GLOB_LOG_MAX]; device->min_X = globalval[TAG_GLOB_LOG_MIN]; @@ -300,7 +300,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, break; case 1: /* Y coord */ - dbg("GER: Y Usage: 0x%x", usage); + dev_dbg(ddev, "GER: Y Usage: 0x%x\n", usage); if (device->max_Y == 0) { device->max_Y = globalval[TAG_GLOB_LOG_MAX]; device->min_Y = globalval[TAG_GLOB_LOG_MIN]; @@ -350,10 +350,10 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, maintype = 'S'; if (data == 0) { - dbg("======>>>>>> Physical"); + dev_dbg(ddev, "======>>>>>> Physical\n"); strcpy(globtype, "Physical"); } else - dbg("======>>>>>>"); + dev_dbg(ddev, "======>>>>>>\n"); /* Indent the debug output */ indent++; @@ -368,7 +368,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, break; case TAG_MAIN_COL_END: - dbg("<<<<<<======"); + dev_dbg(ddev, "<<<<<<======\n"); maintype = 'E'; indent--; for (x = 0; x < indent; x++) @@ -384,18 +384,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, switch (size) { case 1: - dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", - indentstr, tag, maintype, size, globtype, data); + dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", + indentstr, tag, maintype, size, globtype, data); break; case 2: - dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", - indentstr, tag, maintype, size, globtype, data16); + dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", + indentstr, tag, maintype, size, globtype, data16); break; case 4: - dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", - indentstr, tag, maintype, size, globtype, data32); + dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", + indentstr, tag, maintype, size, globtype, data32); break; } break; @@ -465,26 +465,26 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, if (tag < TAG_GLOB_MAX) { switch (size) { case 1: - dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", - indentstr, globtype, tag, size, data); + dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", + indentstr, globtype, tag, size, data); globalval[tag] = data; break; case 2: - dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", - indentstr, globtype, tag, size, data16); + dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", + indentstr, globtype, tag, size, data16); globalval[tag] = data16; break; case 4: - dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", - indentstr, globtype, tag, size, data32); + dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", + indentstr, globtype, tag, size, data32); globalval[tag] = data32; break; } } else { - dbg("%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d ", - indentstr, tag, size); + dev_dbg(ddev, "%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\n", + indentstr, tag, size); } break; @@ -511,18 +511,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, switch (size) { case 1: - dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", - indentstr, tag, globtype, size, data); + dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", + indentstr, tag, globtype, size, data); break; case 2: - dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", - indentstr, tag, globtype, size, data16); + dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", + indentstr, tag, globtype, size, data16); break; case 4: - dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", - indentstr, tag, globtype, size, data32); + dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", + indentstr, tag, globtype, size, data32); break; } @@ -714,8 +714,9 @@ static void gtco_urb_callback(struct urb *urbinfo) * the rest as 0 */ val = device->buffer[5] & MASK_BUTTON; - dbg("======>>>>>>REPORT 1: val 0x%X(%d)", - val, val); + dev_dbg(&device->intf->dev, + "======>>>>>>REPORT 1: val 0x%X(%d)\n", + val, val); /* * We don't apply any meaning to the button @@ -808,7 +809,8 @@ static void gtco_urb_callback(struct urb *urbinfo) resubmit: rc = usb_submit_urb(urbinfo, GFP_ATOMIC); if (rc != 0) - err("usb_submit_urb failed rc=0x%x", rc); + dev_err(&device->intf->dev, + "usb_submit_urb failed rc=0x%x\n", rc); } /* @@ -838,7 +840,7 @@ static int gtco_probe(struct usb_interface *usbinterface, gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); input_dev = input_allocate_device(); if (!gtco || !input_dev) { - err("No more memory"); + dev_err(&usbinterface->dev, "No more memory\n"); error = -ENOMEM; goto err_free_devs; } @@ -848,12 +850,13 @@ static int gtco_probe(struct usb_interface *usbinterface, /* Save interface information */ gtco->usbdev = usb_get_dev(interface_to_usbdev(usbinterface)); + gtco->intf = usbinterface; /* Allocate some data for incoming reports */ gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE, GFP_KERNEL, >co->buf_dma); if (!gtco->buffer) { - err("No more memory for us buffers"); + dev_err(&usbinterface->dev, "No more memory for us buffers\n"); error = -ENOMEM; goto err_free_devs; } @@ -861,7 +864,7 @@ static int gtco_probe(struct usb_interface *usbinterface, /* Allocate URB for reports */ gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL); if (!gtco->urbinfo) { - err("Failed to allocate URB"); + dev_err(&usbinterface->dev, "Failed to allocate URB\n"); error = -ENOMEM; goto err_free_buf; } @@ -873,14 +876,14 @@ static int gtco_probe(struct usb_interface *usbinterface, endpoint = &usbinterface->altsetting[0].endpoint[0].desc; /* Some debug */ - dbg("gtco # interfaces: %d", usbinterface->num_altsetting); - dbg("num endpoints: %d", usbinterface->cur_altsetting->desc.bNumEndpoints); - dbg("interface class: %d", usbinterface->cur_altsetting->desc.bInterfaceClass); - dbg("endpoint: attribute:0x%x type:0x%x", endpoint->bmAttributes, endpoint->bDescriptorType); + dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting); + dev_dbg(&usbinterface->dev, "num endpoints: %d\n", usbinterface->cur_altsetting->desc.bNumEndpoints); + dev_dbg(&usbinterface->dev, "interface class: %d\n", usbinterface->cur_altsetting->desc.bInterfaceClass); + dev_dbg(&usbinterface->dev, "endpoint: attribute:0x%x type:0x%x\n", endpoint->bmAttributes, endpoint->bDescriptorType); if (usb_endpoint_xfer_int(endpoint)) - dbg("endpoint: we have interrupt endpoint\n"); + dev_dbg(&usbinterface->dev, "endpoint: we have interrupt endpoint\n"); - dbg("endpoint extra len:%d ", usbinterface->altsetting[0].extralen); + dev_dbg(&usbinterface->dev, "endpoint extra len:%d\n", usbinterface->altsetting[0].extralen); /* * Find the HID descriptor so we can find out the size of the @@ -888,17 +891,19 @@ static int gtco_probe(struct usb_interface *usbinterface, */ if (usb_get_extra_descriptor(usbinterface->cur_altsetting, HID_DEVICE_TYPE, &hid_desc) != 0){ - err("Can't retrieve exta USB descriptor to get hid report descriptor length"); + dev_err(&usbinterface->dev, + "Can't retrieve exta USB descriptor to get hid report descriptor length\n"); error = -EIO; goto err_free_urb; } - dbg("Extra descriptor success: type:%d len:%d", - hid_desc->bDescriptorType, hid_desc->wDescriptorLength); + dev_dbg(&usbinterface->dev, + "Extra descriptor success: type:%d len:%d\n", + hid_desc->bDescriptorType, hid_desc->wDescriptorLength); report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL); if (!report) { - err("No more memory for report"); + dev_err(&usbinterface->dev, "No more memory for report\n"); error = -ENOMEM; goto err_free_urb; } @@ -915,7 +920,7 @@ static int gtco_probe(struct usb_interface *usbinterface, le16_to_cpu(hid_desc->wDescriptorLength), 5000); /* 5 secs */ - dbg("usb_control_msg result: %d", result); + dev_dbg(&usbinterface->dev, "usb_control_msg result: %d\n", result); if (result == le16_to_cpu(hid_desc->wDescriptorLength)) { parse_hid_report_descriptor(gtco, report, result); break; @@ -926,8 +931,9 @@ static int gtco_probe(struct usb_interface *usbinterface, /* If we didn't get the report, fail */ if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { - err("Failed to get HID Report Descriptor of size: %d", - hid_desc->wDescriptorLength); + dev_err(&usbinterface->dev, + "Failed to get HID Report Descriptor of size: %d\n", + hid_desc->wDescriptorLength); error = -EIO; goto err_free_urb; } diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index 85a5b40333a..3fba74b9b60 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c @@ -33,6 +33,7 @@ struct kbtab { dma_addr_t data_dma; struct input_dev *dev; struct usb_device *usbdev; + struct usb_interface *intf; struct urb *irq; char phys[32]; }; @@ -53,10 +54,14 @@ static void kbtab_irq(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(&kbtab->intf->dev, + "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(&kbtab->intf->dev, + "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -80,8 +85,9 @@ static void kbtab_irq(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(&kbtab->intf->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, retval); } static struct usb_device_id kbtab_ids[] = { @@ -131,6 +137,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i goto fail2; kbtab->usbdev = dev; + kbtab->intf = intf; kbtab->dev = input_dev; usb_make_path(dev, kbtab->phys, sizeof(kbtab->phys)); diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 0d269212931..79a0509882d 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -99,6 +99,7 @@ static int wacom_set_report(struct usb_interface *intf, u8 type, u8 id, static void wacom_sys_irq(struct urb *urb) { struct wacom *wacom = urb->context; + struct device *dev = &wacom->intf->dev; int retval; switch (urb->status) { @@ -109,10 +110,12 @@ static void wacom_sys_irq(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); return; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -122,8 +125,8 @@ static void wacom_sys_irq(struct urb *urb) usb_mark_last_busy(wacom->usbdev); 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 wacom_open(struct input_dev *dev) diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index cecd35c8f0b..b327790e9a0 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -76,7 +76,8 @@ static int wacom_pl_irq(struct wacom_wac *wacom) int prox, pressure; if (data[0] != WACOM_REPORT_PENABLED) { - dbg("wacom_pl_irq: received unknown report #%d", data[0]); + dev_dbg(&input->dev, + "wacom_pl_irq: received unknown report #%d\n", data[0]); return 0; } @@ -175,7 +176,7 @@ static int wacom_dtu_irq(struct wacom_wac *wacom) struct input_dev *input = wacom->input; int prox = data[1] & 0x20, pressure; - dbg("wacom_dtu_irq: received report #%d", data[0]); + dev_dbg(&input->dev, "wacom_dtu_irq: received report #%d\n", data[0]); if (prox) { /* Going into proximity select tool */ @@ -211,7 +212,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) int retval = 0; if (data[0] != WACOM_REPORT_PENABLED) { - dbg("wacom_graphire_irq: received unknown report #%d", data[0]); + dev_dbg(&input->dev, + "wacom_graphire_irq: received unknown report #%d\n", + data[0]); goto exit; } @@ -484,7 +487,9 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) { - dbg("wacom_intuos_irq: received unknown report #%d", data[0]); + dev_dbg(&input->dev, + "wacom_intuos_irq: received unknown report #%d\n", + data[0]); return 0; } @@ -830,7 +835,8 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) { char *data = wacom->data; - dbg("wacom_tpc_irq: received report #%d", data[0]); + dev_dbg(&wacom->input->dev, "wacom_tpc_irq: received report #%d\n", + data[0]); switch (len) { case WACOM_PKGLEN_TPC1FG: diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 22cd96f58c9..e32709e0dd6 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -269,8 +269,9 @@ static int e2i_init(struct usbtouch_usb *usbtouch) 0x01, 0x02, 0x0000, 0x0081, NULL, 0, USB_CTRL_SET_TIMEOUT); - dbg("%s - usb_control_msg - E2I_RESET - bytes|err: %d", - __func__, ret); + dev_dbg(&usbtouch->interface->dev, + "%s - usb_control_msg - E2I_RESET - bytes|err: %d\n", + __func__, ret); return ret; } @@ -425,8 +426,9 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) MTOUCHUSB_RESET, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); - dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", - __func__, ret); + dev_dbg(&usbtouch->interface->dev, + "%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d\n", + __func__, ret); if (ret < 0) return ret; msleep(150); @@ -436,8 +438,9 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) MTOUCHUSB_ASYNC_REPORT, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); - dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", - __func__, ret); + dev_dbg(&usbtouch->interface->dev, + "%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d\n", + __func__, ret); if (ret >= 0) break; if (ret != -EPIPE) @@ -737,27 +740,29 @@ static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt) #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) { + struct usb_interface *intf = dev->interface; + switch (pkt[0]) { case 0x3A: /* command response */ - dbg("%s: Command response %d", __func__, pkt[1]); + dev_dbg(&intf->dev, "%s: Command response %d\n", __func__, pkt[1]); break; case 0xC0: /* down */ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); dev->touch = 1; - dbg("%s: down %d,%d", __func__, dev->x, dev->y); + dev_dbg(&intf->dev, "%s: down %d,%d\n", __func__, dev->x, dev->y); return 1; case 0x80: /* up */ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); dev->touch = 0; - dbg("%s: up %d,%d", __func__, dev->x, dev->y); + dev_dbg(&intf->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); return 1; default: - dbg("%s: Unknown return %d", __func__, pkt[0]); + dev_dbg(&intf->dev, "%s: Unknown return %d\n", __func__, pkt[0]); break; } @@ -812,7 +817,8 @@ static int nexio_alloc(struct usbtouch_usb *usbtouch) priv->ack = usb_alloc_urb(0, GFP_KERNEL); if (!priv->ack) { - dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); + dev_dbg(&usbtouch->interface->dev, + "%s - usb_alloc_urb failed: usbtouch->ack\n", __func__); goto err_ack_buf; } @@ -1349,6 +1355,7 @@ out_flush_buf: static void usbtouch_irq(struct urb *urb) { struct usbtouch_usb *usbtouch = urb->context; + struct device *dev = &usbtouch->interface->dev; int retval; switch (urb->status) { @@ -1357,20 +1364,21 @@ static void usbtouch_irq(struct urb *urb) break; case -ETIME: /* this urb is timing out */ - dbg("%s - urb timed out - was the device unplugged?", - __func__); + dev_dbg(dev, + "%s - urb timed out - was the device unplugged?\n", + __func__); return; case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: case -EPIPE: /* 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); return; default: - dbg("%s - nonzero urb status received: %d", - __func__, urb->status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -1380,8 +1388,8 @@ exit: usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); 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 usbtouch_open(struct input_dev *input) @@ -1456,8 +1464,9 @@ static int usbtouch_reset_resume(struct usb_interface *intf) if (usbtouch->type->init) { err = usbtouch->type->init(usbtouch); if (err) { - dbg("%s - type->init() failed, err: %d", - __func__, err); + dev_dbg(&intf->dev, + "%s - type->init() failed, err: %d\n", + __func__, err); return err; } } @@ -1532,7 +1541,8 @@ static int usbtouch_probe(struct usb_interface *intf, usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); if (!usbtouch->irq) { - dbg("%s - usb_alloc_urb failed: usbtouch->irq", __func__); + dev_dbg(&intf->dev, + "%s - usb_alloc_urb failed: usbtouch->irq\n", __func__); goto out_free_buffers; } @@ -1594,7 +1604,9 @@ static int usbtouch_probe(struct usb_interface *intf, if (type->alloc) { err = type->alloc(usbtouch); if (err) { - dbg("%s - type->alloc() failed, err: %d", __func__, err); + dev_dbg(&intf->dev, + "%s - type->alloc() failed, err: %d\n", + __func__, err); goto out_free_urb; } } @@ -1603,14 +1615,18 @@ static int usbtouch_probe(struct usb_interface *intf, if (type->init) { err = type->init(usbtouch); if (err) { - dbg("%s - type->init() failed, err: %d", __func__, err); + dev_dbg(&intf->dev, + "%s - type->init() failed, err: %d\n", + __func__, err); goto out_do_exit; } } err = input_register_device(usbtouch->input); if (err) { - dbg("%s - input_register_device failed, err: %d", __func__, err); + dev_dbg(&intf->dev, + "%s - input_register_device failed, err: %d\n", + __func__, err); goto out_do_exit; } @@ -1622,8 +1638,9 @@ static int usbtouch_probe(struct usb_interface *intf, err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); if (err) { usb_autopm_put_interface(intf); - err("%s - usb_submit_urb failed with result: %d", - __func__, err); + dev_err(&intf->dev, + "%s - usb_submit_urb failed with result: %d\n", + __func__, err); goto out_unregister_input; } } @@ -1650,12 +1667,12 @@ static void usbtouch_disconnect(struct usb_interface *intf) { struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); - dbg("%s - called", __func__); - if (!usbtouch) return; - dbg("%s - usbtouch is initialized, cleaning up", __func__); + dev_dbg(&intf->dev, + "%s - usbtouch is initialized, cleaning up\n", __func__); + usb_set_intfdata(intf, NULL); /* this will stop IO via close */ input_unregister_device(usbtouch->input); |