diff options
Diffstat (limited to 'drivers/usb/input/aiptek.c')
-rw-r--r-- | drivers/usb/input/aiptek.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index f857935e615c..cc0a498763d8 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
@@ -798,7 +798,7 @@ MODULE_DEVICE_TABLE(usb, aiptek_ids); | |||
798 | */ | 798 | */ |
799 | static int aiptek_open(struct input_dev *inputdev) | 799 | static int aiptek_open(struct input_dev *inputdev) |
800 | { | 800 | { |
801 | struct aiptek *aiptek = inputdev->private; | 801 | struct aiptek *aiptek = input_get_drvdata(inputdev); |
802 | 802 | ||
803 | aiptek->urb->dev = aiptek->usbdev; | 803 | aiptek->urb->dev = aiptek->usbdev; |
804 | if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) | 804 | if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) |
@@ -812,7 +812,7 @@ static int aiptek_open(struct input_dev *inputdev) | |||
812 | */ | 812 | */ |
813 | static void aiptek_close(struct input_dev *inputdev) | 813 | static void aiptek_close(struct input_dev *inputdev) |
814 | { | 814 | { |
815 | struct aiptek *aiptek = inputdev->private; | 815 | struct aiptek *aiptek = input_get_drvdata(inputdev); |
816 | 816 | ||
817 | usb_kill_urb(aiptek->urb); | 817 | usb_kill_urb(aiptek->urb); |
818 | } | 818 | } |
@@ -1972,6 +1972,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1972 | AIPTEK_PROGRAMMABLE_DELAY_200, | 1972 | AIPTEK_PROGRAMMABLE_DELAY_200, |
1973 | AIPTEK_PROGRAMMABLE_DELAY_300 | 1973 | AIPTEK_PROGRAMMABLE_DELAY_300 |
1974 | }; | 1974 | }; |
1975 | int err = -ENOMEM; | ||
1975 | 1976 | ||
1976 | /* programmableDelay is where the command-line specified | 1977 | /* programmableDelay is where the command-line specified |
1977 | * delay is kept. We make it the first element of speeds[], | 1978 | * delay is kept. We make it the first element of speeds[], |
@@ -2043,8 +2044,10 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2043 | inputdev->name = "Aiptek"; | 2044 | inputdev->name = "Aiptek"; |
2044 | inputdev->phys = aiptek->features.usbPath; | 2045 | inputdev->phys = aiptek->features.usbPath; |
2045 | usb_to_input_id(usbdev, &inputdev->id); | 2046 | usb_to_input_id(usbdev, &inputdev->id); |
2046 | inputdev->cdev.dev = &intf->dev; | 2047 | inputdev->dev.parent = &intf->dev; |
2047 | inputdev->private = aiptek; | 2048 | |
2049 | input_set_drvdata(inputdev, aiptek); | ||
2050 | |||
2048 | inputdev->open = aiptek_open; | 2051 | inputdev->open = aiptek_open; |
2049 | inputdev->close = aiptek_close; | 2052 | inputdev->close = aiptek_close; |
2050 | 2053 | ||
@@ -2133,7 +2136,9 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2133 | 2136 | ||
2134 | /* Register the tablet as an Input Device | 2137 | /* Register the tablet as an Input Device |
2135 | */ | 2138 | */ |
2136 | input_register_device(aiptek->inputdev); | 2139 | err = input_register_device(aiptek->inputdev); |
2140 | if (err) | ||
2141 | goto fail2; | ||
2137 | 2142 | ||
2138 | /* We now will look for the evdev device which is mapped to | 2143 | /* We now will look for the evdev device which is mapped to |
2139 | * the tablet. The partial name is kept in the link list of | 2144 | * the tablet. The partial name is kept in the link list of |
@@ -2165,23 +2170,13 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2165 | 2170 | ||
2166 | return 0; | 2171 | return 0; |
2167 | 2172 | ||
2168 | fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, | 2173 | fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, |
2169 | aiptek->data_dma); | 2174 | aiptek->data_dma); |
2170 | fail1: input_free_device(inputdev); | 2175 | fail1: input_free_device(inputdev); |
2171 | kfree(aiptek); | 2176 | kfree(aiptek); |
2172 | return -ENOMEM; | 2177 | return err; |
2173 | } | 2178 | } |
2174 | 2179 | ||
2175 | /* Forward declaration */ | ||
2176 | static void aiptek_disconnect(struct usb_interface *intf); | ||
2177 | |||
2178 | static struct usb_driver aiptek_driver = { | ||
2179 | .name = "aiptek", | ||
2180 | .probe = aiptek_probe, | ||
2181 | .disconnect = aiptek_disconnect, | ||
2182 | .id_table = aiptek_ids, | ||
2183 | }; | ||
2184 | |||
2185 | /*********************************************************************** | 2180 | /*********************************************************************** |
2186 | * Deal with tablet disconnecting from the system. | 2181 | * Deal with tablet disconnecting from the system. |
2187 | */ | 2182 | */ |
@@ -2206,6 +2201,13 @@ static void aiptek_disconnect(struct usb_interface *intf) | |||
2206 | } | 2201 | } |
2207 | } | 2202 | } |
2208 | 2203 | ||
2204 | static struct usb_driver aiptek_driver = { | ||
2205 | .name = "aiptek", | ||
2206 | .probe = aiptek_probe, | ||
2207 | .disconnect = aiptek_disconnect, | ||
2208 | .id_table = aiptek_ids, | ||
2209 | }; | ||
2210 | |||
2209 | static int __init aiptek_init(void) | 2211 | static int __init aiptek_init(void) |
2210 | { | 2212 | { |
2211 | int result = usb_register(&aiptek_driver); | 2213 | int result = usb_register(&aiptek_driver); |