diff options
| author | Oliver Neukum <oneukum@suse.com> | 2016-03-31 14:01:07 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-03-31 16:13:41 -0400 |
| commit | ed752e5ddedb68c9d69484baa1a712cf966e1f22 (patch) | |
| tree | 904b350fada36e9fd3d395bcca9f7125b5efdcd2 /drivers/input/tablet | |
| parent | c630901860c3b8ecc22097269fd4605cf584126c (diff) | |
Input: gtco - stop saving struct usb_device
The device can now easily be derived from the interface.
Stop leaving a private copy.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/tablet')
| -rw-r--r-- | drivers/input/tablet/gtco.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 3a7f3a4a4396..362ae3b5e188 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
| @@ -104,7 +104,6 @@ MODULE_DEVICE_TABLE (usb, gtco_usbid_table); | |||
| 104 | struct gtco { | 104 | struct gtco { |
| 105 | 105 | ||
| 106 | struct input_dev *inputdevice; /* input device struct pointer */ | 106 | struct input_dev *inputdevice; /* input device struct pointer */ |
| 107 | struct usb_device *usbdev; /* the usb device for this device */ | ||
| 108 | struct usb_interface *intf; /* the usb interface for this device */ | 107 | struct usb_interface *intf; /* the usb interface for this device */ |
| 109 | struct urb *urbinfo; /* urb for incoming reports */ | 108 | struct urb *urbinfo; /* urb for incoming reports */ |
| 110 | dma_addr_t buf_dma; /* dma addr of the data buffer*/ | 109 | dma_addr_t buf_dma; /* dma addr of the data buffer*/ |
| @@ -540,7 +539,7 @@ static int gtco_input_open(struct input_dev *inputdev) | |||
| 540 | { | 539 | { |
| 541 | struct gtco *device = input_get_drvdata(inputdev); | 540 | struct gtco *device = input_get_drvdata(inputdev); |
| 542 | 541 | ||
| 543 | device->urbinfo->dev = device->usbdev; | 542 | device->urbinfo->dev = interface_to_usbdev(device->intf); |
| 544 | if (usb_submit_urb(device->urbinfo, GFP_KERNEL)) | 543 | if (usb_submit_urb(device->urbinfo, GFP_KERNEL)) |
| 545 | return -EIO; | 544 | return -EIO; |
| 546 | 545 | ||
| @@ -824,6 +823,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 824 | int result = 0, retry; | 823 | int result = 0, retry; |
| 825 | int error; | 824 | int error; |
| 826 | struct usb_endpoint_descriptor *endpoint; | 825 | struct usb_endpoint_descriptor *endpoint; |
| 826 | struct usb_device *udev = interface_to_usbdev(usbinterface); | ||
| 827 | 827 | ||
| 828 | /* Allocate memory for device structure */ | 828 | /* Allocate memory for device structure */ |
| 829 | gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); | 829 | gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); |
| @@ -838,11 +838,10 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 838 | gtco->inputdevice = input_dev; | 838 | gtco->inputdevice = input_dev; |
| 839 | 839 | ||
| 840 | /* Save interface information */ | 840 | /* Save interface information */ |
| 841 | gtco->usbdev = interface_to_usbdev(usbinterface); | ||
| 842 | gtco->intf = usbinterface; | 841 | gtco->intf = usbinterface; |
| 843 | 842 | ||
| 844 | /* Allocate some data for incoming reports */ | 843 | /* Allocate some data for incoming reports */ |
| 845 | gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE, | 844 | gtco->buffer = usb_alloc_coherent(udev, REPORT_MAX_SIZE, |
| 846 | GFP_KERNEL, >co->buf_dma); | 845 | GFP_KERNEL, >co->buf_dma); |
| 847 | if (!gtco->buffer) { | 846 | if (!gtco->buffer) { |
| 848 | dev_err(&usbinterface->dev, "No more memory for us buffers\n"); | 847 | dev_err(&usbinterface->dev, "No more memory for us buffers\n"); |
| @@ -899,8 +898,8 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 899 | 898 | ||
| 900 | /* Couple of tries to get reply */ | 899 | /* Couple of tries to get reply */ |
| 901 | for (retry = 0; retry < 3; retry++) { | 900 | for (retry = 0; retry < 3; retry++) { |
| 902 | result = usb_control_msg(gtco->usbdev, | 901 | result = usb_control_msg(udev, |
| 903 | usb_rcvctrlpipe(gtco->usbdev, 0), | 902 | usb_rcvctrlpipe(udev, 0), |
| 904 | USB_REQ_GET_DESCRIPTOR, | 903 | USB_REQ_GET_DESCRIPTOR, |
| 905 | USB_RECIP_INTERFACE | USB_DIR_IN, | 904 | USB_RECIP_INTERFACE | USB_DIR_IN, |
| 906 | REPORT_DEVICE_TYPE << 8, | 905 | REPORT_DEVICE_TYPE << 8, |
| @@ -928,7 +927,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 928 | } | 927 | } |
| 929 | 928 | ||
| 930 | /* Create a device file node */ | 929 | /* Create a device file node */ |
| 931 | usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath)); | 930 | usb_make_path(udev, gtco->usbpath, sizeof(gtco->usbpath)); |
| 932 | strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); | 931 | strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); |
| 933 | 932 | ||
| 934 | /* Set Input device functions */ | 933 | /* Set Input device functions */ |
| @@ -945,15 +944,15 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 945 | gtco_setup_caps(input_dev); | 944 | gtco_setup_caps(input_dev); |
| 946 | 945 | ||
| 947 | /* Set input device required ID information */ | 946 | /* Set input device required ID information */ |
| 948 | usb_to_input_id(gtco->usbdev, &input_dev->id); | 947 | usb_to_input_id(udev, &input_dev->id); |
| 949 | input_dev->dev.parent = &usbinterface->dev; | 948 | input_dev->dev.parent = &usbinterface->dev; |
| 950 | 949 | ||
| 951 | /* Setup the URB, it will be posted later on open of input device */ | 950 | /* Setup the URB, it will be posted later on open of input device */ |
| 952 | endpoint = &usbinterface->altsetting[0].endpoint[0].desc; | 951 | endpoint = &usbinterface->altsetting[0].endpoint[0].desc; |
| 953 | 952 | ||
| 954 | usb_fill_int_urb(gtco->urbinfo, | 953 | usb_fill_int_urb(gtco->urbinfo, |
| 955 | gtco->usbdev, | 954 | udev, |
| 956 | usb_rcvintpipe(gtco->usbdev, | 955 | usb_rcvintpipe(udev, |
| 957 | endpoint->bEndpointAddress), | 956 | endpoint->bEndpointAddress), |
| 958 | gtco->buffer, | 957 | gtco->buffer, |
| 959 | REPORT_MAX_SIZE, | 958 | REPORT_MAX_SIZE, |
| @@ -977,7 +976,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 977 | err_free_urb: | 976 | err_free_urb: |
| 978 | usb_free_urb(gtco->urbinfo); | 977 | usb_free_urb(gtco->urbinfo); |
| 979 | err_free_buf: | 978 | err_free_buf: |
| 980 | usb_free_coherent(gtco->usbdev, REPORT_MAX_SIZE, | 979 | usb_free_coherent(udev, REPORT_MAX_SIZE, |
| 981 | gtco->buffer, gtco->buf_dma); | 980 | gtco->buffer, gtco->buf_dma); |
| 982 | err_free_devs: | 981 | err_free_devs: |
| 983 | input_free_device(input_dev); | 982 | input_free_device(input_dev); |
| @@ -994,13 +993,14 @@ static void gtco_disconnect(struct usb_interface *interface) | |||
| 994 | { | 993 | { |
| 995 | /* Grab private device ptr */ | 994 | /* Grab private device ptr */ |
| 996 | struct gtco *gtco = usb_get_intfdata(interface); | 995 | struct gtco *gtco = usb_get_intfdata(interface); |
| 996 | struct usb_device *udev = interface_to_usbdev(interface); | ||
| 997 | 997 | ||
| 998 | /* Now reverse all the registration stuff */ | 998 | /* Now reverse all the registration stuff */ |
| 999 | if (gtco) { | 999 | if (gtco) { |
| 1000 | input_unregister_device(gtco->inputdevice); | 1000 | input_unregister_device(gtco->inputdevice); |
| 1001 | usb_kill_urb(gtco->urbinfo); | 1001 | usb_kill_urb(gtco->urbinfo); |
| 1002 | usb_free_urb(gtco->urbinfo); | 1002 | usb_free_urb(gtco->urbinfo); |
| 1003 | usb_free_coherent(gtco->usbdev, REPORT_MAX_SIZE, | 1003 | usb_free_coherent(udev, REPORT_MAX_SIZE, |
| 1004 | gtco->buffer, gtco->buf_dma); | 1004 | gtco->buffer, gtco->buf_dma); |
| 1005 | kfree(gtco); | 1005 | kfree(gtco); |
| 1006 | } | 1006 | } |
