diff options
Diffstat (limited to 'drivers/usb/input/wacom_sys.c')
-rw-r--r-- | drivers/usb/input/wacom_sys.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/usb/input/wacom_sys.c b/drivers/usb/input/wacom_sys.c index 12b42746ded8..1fe48208c2f4 100644 --- a/drivers/usb/input/wacom_sys.c +++ b/drivers/usb/input/wacom_sys.c | |||
@@ -122,7 +122,7 @@ void wacom_input_sync(void *wcombo) | |||
122 | 122 | ||
123 | static int wacom_open(struct input_dev *dev) | 123 | static int wacom_open(struct input_dev *dev) |
124 | { | 124 | { |
125 | struct wacom *wacom = dev->private; | 125 | struct wacom *wacom = input_get_drvdata(dev); |
126 | 126 | ||
127 | wacom->irq->dev = wacom->usbdev; | 127 | wacom->irq->dev = wacom->usbdev; |
128 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) | 128 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) |
@@ -133,7 +133,7 @@ static int wacom_open(struct input_dev *dev) | |||
133 | 133 | ||
134 | static void wacom_close(struct input_dev *dev) | 134 | static void wacom_close(struct input_dev *dev) |
135 | { | 135 | { |
136 | struct wacom *wacom = dev->private; | 136 | struct wacom *wacom = input_get_drvdata(dev); |
137 | 137 | ||
138 | usb_kill_urb(wacom->irq); | 138 | usb_kill_urb(wacom->irq); |
139 | } | 139 | } |
@@ -201,6 +201,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
201 | struct wacom *wacom; | 201 | struct wacom *wacom; |
202 | struct wacom_wac *wacom_wac; | 202 | struct wacom_wac *wacom_wac; |
203 | struct input_dev *input_dev; | 203 | struct input_dev *input_dev; |
204 | int error = -ENOMEM; | ||
204 | char rep_data[2], limit = 0; | 205 | char rep_data[2], limit = 0; |
205 | 206 | ||
206 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 207 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
@@ -229,8 +230,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
229 | wacom->wacom_wac = wacom_wac; | 230 | wacom->wacom_wac = wacom_wac; |
230 | usb_to_input_id(dev, &input_dev->id); | 231 | usb_to_input_id(dev, &input_dev->id); |
231 | 232 | ||
232 | input_dev->cdev.dev = &intf->dev; | 233 | input_dev->dev.parent = &intf->dev; |
233 | input_dev->private = wacom; | 234 | |
235 | input_set_drvdata(input_dev, wacom); | ||
236 | |||
234 | input_dev->open = wacom_open; | 237 | input_dev->open = wacom_open; |
235 | input_dev->close = wacom_close; | 238 | input_dev->close = wacom_close; |
236 | 239 | ||
@@ -252,7 +255,9 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
252 | wacom->irq->transfer_dma = wacom->data_dma; | 255 | wacom->irq->transfer_dma = wacom->data_dma; |
253 | wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 256 | wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
254 | 257 | ||
255 | input_register_device(wacom->dev); | 258 | error = input_register_device(wacom->dev); |
259 | if (error) | ||
260 | goto fail3; | ||
256 | 261 | ||
257 | /* Ask the tablet to report tablet data. Repeat until it succeeds */ | 262 | /* Ask the tablet to report tablet data. Repeat until it succeeds */ |
258 | do { | 263 | do { |
@@ -265,11 +270,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
265 | usb_set_intfdata(intf, wacom); | 270 | usb_set_intfdata(intf, wacom); |
266 | return 0; | 271 | return 0; |
267 | 272 | ||
268 | fail2: usb_buffer_free(dev, 10, wacom_wac->data, wacom->data_dma); | 273 | fail3: usb_free_urb(wacom->irq); |
269 | fail1: input_free_device(input_dev); | 274 | fail2: usb_buffer_free(dev, 10, wacom_wac->data, wacom->data_dma); |
275 | fail1: input_free_device(input_dev); | ||
270 | kfree(wacom); | 276 | kfree(wacom); |
271 | kfree(wacom_wac); | 277 | kfree(wacom_wac); |
272 | return -ENOMEM; | 278 | return error; |
273 | } | 279 | } |
274 | 280 | ||
275 | static void wacom_disconnect(struct usb_interface *intf) | 281 | static void wacom_disconnect(struct usb_interface *intf) |