From e27ad0fe9cca5e6c98c3af6d7021690b6960adf8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:46 -0700 Subject: USB: usbtouchscreen.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov CC: Henrik Rydberg CC: Rusty Russell CC: Viresh Kumar CC: Armando Visconti Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 22cd96f58c99..955441cb030d 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -1380,8 +1380,9 @@ 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(&usbtouch->interface->dev, + "%s - usb_submit_urb failed with result: %d\n", + __func__, retval); } static int usbtouch_open(struct input_dev *input) @@ -1622,8 +1623,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; } } -- cgit v1.2.3 From f864b60ad0078b74c765f00f0600588b85c0a239 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:57:11 -0400 Subject: USB: input: usbtouchscreen.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: Henrik Rydberg CC: Rusty Russell CC: Viresh Kumar CC: Armando Visconti Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 955441cb030d..4127cf7bb25a 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -1380,7 +1380,7 @@ exit: usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&usbtouch->interface->dev, + dev_err(&usbtouch->input->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, retval); } @@ -1623,7 +1623,7 @@ static int usbtouch_probe(struct usb_interface *intf, err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); if (err) { usb_autopm_put_interface(intf); - dev_err(&intf->dev, + dev_err(&input_dev->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, err); goto out_unregister_input; -- cgit v1.2.3 From b741ab9da614b08da51cffa961435bc81314f3c4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:23 -0700 Subject: USB: usbtouchscreen.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov CC: Henrik Rydberg CC: Rusty Russell CC: Viresh Kumar CC: Armando Visconti Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 68 ++++++++++++++++++------------ 1 file changed, 42 insertions(+), 26 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 4127cf7bb25a..100eded96b0e 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->input->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->input->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->input->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 input_dev *input = dev->input; + switch (pkt[0]) { case 0x3A: /* command response */ - dbg("%s: Command response %d", __func__, pkt[1]); + dev_dbg(&input->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(&input->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(&input->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); return 1; default: - dbg("%s: Unknown return %d", __func__, pkt[0]); + dev_dbg(&input->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->input->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->input->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; } @@ -1457,8 +1465,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(&input->dev, + "%s - type->init() failed, err: %d\n", + __func__, err); return err; } } @@ -1533,7 +1542,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; } @@ -1595,7 +1605,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; } } @@ -1604,14 +1616,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; } @@ -1652,12 +1668,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(&usbtouch->input->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); -- cgit v1.2.3 From 0a5ebc88c74d8029e80a72e57cbebc0b3b4e5d98 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:16 -0700 Subject: USB: input: usbtouchscreen.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov CC: Henrik Rydberg CC: Rusty Russell CC: Viresh Kumar CC: Armando Visconti Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 100eded96b0e..e32709e0dd65 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -269,7 +269,7 @@ static int e2i_init(struct usbtouch_usb *usbtouch) 0x01, 0x02, 0x0000, 0x0081, NULL, 0, USB_CTRL_SET_TIMEOUT); - dev_dbg(&usbtouch->input->dev, + dev_dbg(&usbtouch->interface->dev, "%s - usb_control_msg - E2I_RESET - bytes|err: %d\n", __func__, ret); return ret; @@ -426,7 +426,7 @@ 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); - dev_dbg(&usbtouch->input->dev, + dev_dbg(&usbtouch->interface->dev, "%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d\n", __func__, ret); if (ret < 0) @@ -438,7 +438,7 @@ 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); - dev_dbg(&usbtouch->input->dev, + dev_dbg(&usbtouch->interface->dev, "%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d\n", __func__, ret); if (ret >= 0) @@ -740,29 +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 input_dev *input = dev->input; + struct usb_interface *intf = dev->interface; switch (pkt[0]) { case 0x3A: /* command response */ - dev_dbg(&input->dev, "%s: Command response %d\n", __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; - dev_dbg(&input->dev, "%s: down %d,%d\n", __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; - dev_dbg(&input->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); + dev_dbg(&intf->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); return 1; default: - dev_dbg(&input->dev, "%s: Unknown return %d\n", __func__, pkt[0]); + dev_dbg(&intf->dev, "%s: Unknown return %d\n", __func__, pkt[0]); break; } @@ -817,7 +817,7 @@ static int nexio_alloc(struct usbtouch_usb *usbtouch) priv->ack = usb_alloc_urb(0, GFP_KERNEL); if (!priv->ack) { - dev_dbg(&usbtouch->input->dev, + dev_dbg(&usbtouch->interface->dev, "%s - usb_alloc_urb failed: usbtouch->ack\n", __func__); goto err_ack_buf; } @@ -1355,7 +1355,7 @@ out_flush_buf: static void usbtouch_irq(struct urb *urb) { struct usbtouch_usb *usbtouch = urb->context; - struct device *dev = &usbtouch->input->dev; + struct device *dev = &usbtouch->interface->dev; int retval; switch (urb->status) { @@ -1388,8 +1388,7 @@ exit: usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&usbtouch->input->dev, - "%s - usb_submit_urb failed with result: %d\n", + dev_err(dev, "%s - usb_submit_urb failed with result: %d\n", __func__, retval); } @@ -1465,7 +1464,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf) if (usbtouch->type->init) { err = usbtouch->type->init(usbtouch); if (err) { - dev_dbg(&input->dev, + dev_dbg(&intf->dev, "%s - type->init() failed, err: %d\n", __func__, err); return err; @@ -1639,7 +1638,7 @@ static int usbtouch_probe(struct usb_interface *intf, err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); if (err) { usb_autopm_put_interface(intf); - dev_err(&input_dev->dev, + dev_err(&intf->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, err); goto out_unregister_input; @@ -1671,7 +1670,7 @@ static void usbtouch_disconnect(struct usb_interface *intf) if (!usbtouch) return; - dev_dbg(&usbtouch->input->dev, + dev_dbg(&intf->dev, "%s - usbtouch is initialized, cleaning up\n", __func__); usb_set_intfdata(intf, NULL); -- cgit v1.2.3