diff options
Diffstat (limited to 'drivers/input/joystick/iforce/iforce-main.c')
-rw-r--r-- | drivers/input/joystick/iforce/iforce-main.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index f6c688cae334..b1edd778639c 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
@@ -210,7 +210,7 @@ static int iforce_open(struct input_dev *dev) | |||
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | 212 | ||
213 | static void iforce_release(struct input_dev *dev) | 213 | static void iforce_close(struct input_dev *dev) |
214 | { | 214 | { |
215 | struct iforce *iforce = input_get_drvdata(dev); | 215 | struct iforce *iforce = input_get_drvdata(dev); |
216 | int i; | 216 | int i; |
@@ -228,30 +228,17 @@ static void iforce_release(struct input_dev *dev) | |||
228 | 228 | ||
229 | /* Disable force feedback playback */ | 229 | /* Disable force feedback playback */ |
230 | iforce_send_packet(iforce, FF_CMD_ENABLE, "\001"); | 230 | iforce_send_packet(iforce, FF_CMD_ENABLE, "\001"); |
231 | /* Wait for the command to complete */ | ||
232 | wait_event_interruptible(iforce->wait, | ||
233 | !test_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)); | ||
231 | } | 234 | } |
232 | 235 | ||
233 | switch (iforce->bus) { | 236 | switch (iforce->bus) { |
234 | #ifdef CONFIG_JOYSTICK_IFORCE_USB | 237 | #ifdef CONFIG_JOYSTICK_IFORCE_USB |
235 | case IFORCE_USB: | ||
236 | usb_kill_urb(iforce->irq); | ||
237 | |||
238 | /* The device was unplugged before the file | ||
239 | * was released */ | ||
240 | if (iforce->usbdev == NULL) { | ||
241 | iforce_delete_device(iforce); | ||
242 | kfree(iforce); | ||
243 | } | ||
244 | break; | ||
245 | #endif | ||
246 | } | ||
247 | } | ||
248 | |||
249 | void iforce_delete_device(struct iforce *iforce) | ||
250 | { | ||
251 | switch (iforce->bus) { | ||
252 | #ifdef CONFIG_JOYSTICK_IFORCE_USB | ||
253 | case IFORCE_USB: | 238 | case IFORCE_USB: |
254 | iforce_usb_delete(iforce); | 239 | usb_kill_urb(iforce->irq); |
240 | usb_kill_urb(iforce->out); | ||
241 | usb_kill_urb(iforce->ctrl); | ||
255 | break; | 242 | break; |
256 | #endif | 243 | #endif |
257 | #ifdef CONFIG_JOYSTICK_IFORCE_232 | 244 | #ifdef CONFIG_JOYSTICK_IFORCE_232 |
@@ -303,7 +290,7 @@ int iforce_init_device(struct iforce *iforce) | |||
303 | 290 | ||
304 | input_dev->name = "Unknown I-Force device"; | 291 | input_dev->name = "Unknown I-Force device"; |
305 | input_dev->open = iforce_open; | 292 | input_dev->open = iforce_open; |
306 | input_dev->close = iforce_release; | 293 | input_dev->close = iforce_close; |
307 | 294 | ||
308 | /* | 295 | /* |
309 | * On-device memory allocation. | 296 | * On-device memory allocation. |