diff options
Diffstat (limited to 'drivers/input/mouse/appletouch.c')
-rw-r--r-- | drivers/input/mouse/appletouch.c | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 0acbc7d50d05..e42f1fa8cdc0 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c | |||
@@ -195,6 +195,7 @@ enum atp_status_bits { | |||
195 | struct atp { | 195 | struct atp { |
196 | char phys[64]; | 196 | char phys[64]; |
197 | struct usb_device *udev; /* usb device */ | 197 | struct usb_device *udev; /* usb device */ |
198 | struct usb_interface *intf; /* usb interface */ | ||
198 | struct urb *urb; /* usb request block */ | 199 | struct urb *urb; /* usb request block */ |
199 | u8 *data; /* transferred data */ | 200 | u8 *data; /* transferred data */ |
200 | struct input_dev *input; /* input dev */ | 201 | struct input_dev *input; /* input dev */ |
@@ -253,8 +254,9 @@ MODULE_PARM_DESC(debug, "Activate debugging output"); | |||
253 | * packets (Report ID 2). This code changes device mode, so it | 254 | * packets (Report ID 2). This code changes device mode, so it |
254 | * sends raw sensor reports (Report ID 5). | 255 | * sends raw sensor reports (Report ID 5). |
255 | */ | 256 | */ |
256 | static int atp_geyser_init(struct usb_device *udev) | 257 | static int atp_geyser_init(struct atp *dev) |
257 | { | 258 | { |
259 | struct usb_device *udev = dev->udev; | ||
258 | char *data; | 260 | char *data; |
259 | int size; | 261 | int size; |
260 | int i; | 262 | int i; |
@@ -262,7 +264,7 @@ static int atp_geyser_init(struct usb_device *udev) | |||
262 | 264 | ||
263 | data = kmalloc(8, GFP_KERNEL); | 265 | data = kmalloc(8, GFP_KERNEL); |
264 | if (!data) { | 266 | if (!data) { |
265 | err("Out of memory"); | 267 | dev_err(&dev->intf->dev, "Out of memory\n"); |
266 | return -ENOMEM; | 268 | return -ENOMEM; |
267 | } | 269 | } |
268 | 270 | ||
@@ -277,7 +279,7 @@ static int atp_geyser_init(struct usb_device *udev) | |||
277 | for (i = 0; i < 8; i++) | 279 | for (i = 0; i < 8; i++) |
278 | dprintk("appletouch[%d]: %d\n", i, data[i]); | 280 | dprintk("appletouch[%d]: %d\n", i, data[i]); |
279 | 281 | ||
280 | err("Failed to read mode from device."); | 282 | dev_err(&dev->intf->dev, "Failed to read mode from device.\n"); |
281 | ret = -EIO; | 283 | ret = -EIO; |
282 | goto out_free; | 284 | goto out_free; |
283 | } | 285 | } |
@@ -296,7 +298,7 @@ static int atp_geyser_init(struct usb_device *udev) | |||
296 | for (i = 0; i < 8; i++) | 298 | for (i = 0; i < 8; i++) |
297 | dprintk("appletouch[%d]: %d\n", i, data[i]); | 299 | dprintk("appletouch[%d]: %d\n", i, data[i]); |
298 | 300 | ||
299 | err("Failed to request geyser raw mode"); | 301 | dev_err(&dev->intf->dev, "Failed to request geyser raw mode\n"); |
300 | ret = -EIO; | 302 | ret = -EIO; |
301 | goto out_free; | 303 | goto out_free; |
302 | } | 304 | } |
@@ -313,16 +315,16 @@ out_free: | |||
313 | static void atp_reinit(struct work_struct *work) | 315 | static void atp_reinit(struct work_struct *work) |
314 | { | 316 | { |
315 | struct atp *dev = container_of(work, struct atp, work); | 317 | struct atp *dev = container_of(work, struct atp, work); |
316 | struct usb_device *udev = dev->udev; | ||
317 | int retval; | 318 | int retval; |
318 | 319 | ||
319 | dprintk("appletouch: putting appletouch to sleep (reinit)\n"); | 320 | dprintk("appletouch: putting appletouch to sleep (reinit)\n"); |
320 | atp_geyser_init(udev); | 321 | atp_geyser_init(dev); |
321 | 322 | ||
322 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); | 323 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); |
323 | if (retval) | 324 | if (retval) |
324 | err("atp_reinit: usb_submit_urb failed with error %d", | 325 | dev_err(&dev->intf->dev, |
325 | retval); | 326 | "atp_reinit: usb_submit_urb failed with error %d\n", |
327 | retval); | ||
326 | } | 328 | } |
327 | 329 | ||
328 | static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, | 330 | 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) | |||
400 | static int atp_status_check(struct urb *urb) | 402 | static int atp_status_check(struct urb *urb) |
401 | { | 403 | { |
402 | struct atp *dev = urb->context; | 404 | struct atp *dev = urb->context; |
405 | struct usb_interface *intf = dev->intf; | ||
403 | 406 | ||
404 | switch (urb->status) { | 407 | switch (urb->status) { |
405 | case 0: | 408 | case 0: |
@@ -407,8 +410,8 @@ static int atp_status_check(struct urb *urb) | |||
407 | break; | 410 | break; |
408 | case -EOVERFLOW: | 411 | case -EOVERFLOW: |
409 | if (!dev->overflow_warned) { | 412 | if (!dev->overflow_warned) { |
410 | printk(KERN_WARNING "appletouch: OVERFLOW with data " | 413 | dev_warn(&intf->dev, |
411 | "length %d, actual length is %d\n", | 414 | "appletouch: OVERFLOW with data length %d, actual length is %d\n", |
412 | dev->info->datalen, dev->urb->actual_length); | 415 | dev->info->datalen, dev->urb->actual_length); |
413 | dev->overflow_warned = true; | 416 | dev->overflow_warned = true; |
414 | } | 417 | } |
@@ -416,13 +419,15 @@ static int atp_status_check(struct urb *urb) | |||
416 | case -ENOENT: | 419 | case -ENOENT: |
417 | case -ESHUTDOWN: | 420 | case -ESHUTDOWN: |
418 | /* This urb is terminated, clean up */ | 421 | /* This urb is terminated, clean up */ |
419 | dbg("atp_complete: urb shutting down with status: %d", | 422 | dev_dbg(&intf->dev, |
420 | urb->status); | 423 | "atp_complete: urb shutting down with status: %d\n", |
424 | urb->status); | ||
421 | return ATP_URB_STATUS_ERROR_FATAL; | 425 | return ATP_URB_STATUS_ERROR_FATAL; |
422 | 426 | ||
423 | default: | 427 | default: |
424 | dbg("atp_complete: nonzero urb status received: %d", | 428 | dev_dbg(&intf->dev, |
425 | urb->status); | 429 | "atp_complete: nonzero urb status received: %d\n", |
430 | urb->status); | ||
426 | return ATP_URB_STATUS_ERROR; | 431 | return ATP_URB_STATUS_ERROR; |
427 | } | 432 | } |
428 | 433 | ||
@@ -445,7 +450,8 @@ static void atp_detect_size(struct atp *dev) | |||
445 | for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { | 450 | for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { |
446 | if (dev->xy_cur[i]) { | 451 | if (dev->xy_cur[i]) { |
447 | 452 | ||
448 | printk(KERN_INFO "appletouch: 17\" model detected.\n"); | 453 | dev_info(&dev->intf->dev, |
454 | "appletouch: 17\" model detected.\n"); | ||
449 | 455 | ||
450 | input_set_abs_params(dev->input, ABS_X, 0, | 456 | input_set_abs_params(dev->input, ABS_X, 0, |
451 | (dev->info->xsensors_17 - 1) * | 457 | (dev->info->xsensors_17 - 1) * |
@@ -588,8 +594,9 @@ static void atp_complete_geyser_1_2(struct urb *urb) | |||
588 | exit: | 594 | exit: |
589 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); | 595 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); |
590 | if (retval) | 596 | if (retval) |
591 | err("atp_complete: usb_submit_urb failed with result %d", | 597 | dev_err(&dev->intf->dev, |
592 | retval); | 598 | "atp_complete: usb_submit_urb failed with result %d\n", |
599 | retval); | ||
593 | } | 600 | } |
594 | 601 | ||
595 | /* Interrupt function for older touchpads: GEYSER3/GEYSER4 */ | 602 | /* Interrupt function for older touchpads: GEYSER3/GEYSER4 */ |
@@ -722,8 +729,9 @@ static void atp_complete_geyser_3_4(struct urb *urb) | |||
722 | exit: | 729 | exit: |
723 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); | 730 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); |
724 | if (retval) | 731 | if (retval) |
725 | err("atp_complete: usb_submit_urb failed with result %d", | 732 | dev_err(&dev->intf->dev, |
726 | retval); | 733 | "atp_complete: usb_submit_urb failed with result %d\n", |
734 | retval); | ||
727 | } | 735 | } |
728 | 736 | ||
729 | static int atp_open(struct input_dev *input) | 737 | static int atp_open(struct input_dev *input) |
@@ -748,14 +756,12 @@ static void atp_close(struct input_dev *input) | |||
748 | 756 | ||
749 | static int atp_handle_geyser(struct atp *dev) | 757 | static int atp_handle_geyser(struct atp *dev) |
750 | { | 758 | { |
751 | struct usb_device *udev = dev->udev; | ||
752 | |||
753 | if (dev->info != &fountain_info) { | 759 | if (dev->info != &fountain_info) { |
754 | /* switch to raw sensor mode */ | 760 | /* switch to raw sensor mode */ |
755 | if (atp_geyser_init(udev)) | 761 | if (atp_geyser_init(dev)) |
756 | return -EIO; | 762 | return -EIO; |
757 | 763 | ||
758 | printk(KERN_INFO "appletouch: Geyser mode initialized.\n"); | 764 | dev_info(&dev->intf->dev, "Geyser mode initialized.\n"); |
759 | } | 765 | } |
760 | 766 | ||
761 | return 0; | 767 | return 0; |
@@ -785,7 +791,7 @@ static int atp_probe(struct usb_interface *iface, | |||
785 | } | 791 | } |
786 | } | 792 | } |
787 | if (!int_in_endpointAddr) { | 793 | if (!int_in_endpointAddr) { |
788 | err("Could not find int-in endpoint"); | 794 | dev_err(&iface->dev, "Could not find int-in endpoint\n"); |
789 | return -EIO; | 795 | return -EIO; |
790 | } | 796 | } |
791 | 797 | ||
@@ -793,11 +799,12 @@ static int atp_probe(struct usb_interface *iface, | |||
793 | dev = kzalloc(sizeof(struct atp), GFP_KERNEL); | 799 | dev = kzalloc(sizeof(struct atp), GFP_KERNEL); |
794 | input_dev = input_allocate_device(); | 800 | input_dev = input_allocate_device(); |
795 | if (!dev || !input_dev) { | 801 | if (!dev || !input_dev) { |
796 | err("Out of memory"); | 802 | dev_err(&iface->dev, "Out of memory\n"); |
797 | goto err_free_devs; | 803 | goto err_free_devs; |
798 | } | 804 | } |
799 | 805 | ||
800 | dev->udev = udev; | 806 | dev->udev = udev; |
807 | dev->intf = iface; | ||
801 | dev->input = input_dev; | 808 | dev->input = input_dev; |
802 | dev->info = info; | 809 | dev->info = info; |
803 | dev->overflow_warned = false; | 810 | dev->overflow_warned = false; |
@@ -886,7 +893,7 @@ static void atp_disconnect(struct usb_interface *iface) | |||
886 | usb_free_urb(dev->urb); | 893 | usb_free_urb(dev->urb); |
887 | kfree(dev); | 894 | kfree(dev); |
888 | } | 895 | } |
889 | printk(KERN_INFO "input: appletouch disconnected\n"); | 896 | dev_info(&iface->dev, "input: appletouch disconnected\n"); |
890 | } | 897 | } |
891 | 898 | ||
892 | static int atp_recover(struct atp *dev) | 899 | static int atp_recover(struct atp *dev) |