diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-15 03:01:52 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 12:52:53 -0400 |
commit | 17dd3f0f7aa729a042af5d3318ff9b3e7781b45b (patch) | |
tree | 261580f0229e6365f044cd26925dfb2735e0754d /drivers/input/joystick/iforce | |
parent | 0259567ad60df13a55583b84d2cddb5526705907 (diff) |
[PATCH] drivers/input/joystick: convert to dynamic input_dev allocation
Input: convert drivers/input/joystick to dynamic input_dev allocation
This is required for input_dev sysfs integration
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input/joystick/iforce')
-rw-r--r-- | drivers/input/joystick/iforce/iforce-main.c | 106 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce-packets.c | 5 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce-serio.c | 10 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce-usb.c | 22 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce.h | 2 |
5 files changed, 70 insertions, 75 deletions
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index e31b7b93fde2..64b9c31c47fc 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
@@ -144,7 +144,7 @@ static int iforce_upload_effect(struct input_dev *dev, struct ff_effect *effect) | |||
144 | int is_update; | 144 | int is_update; |
145 | 145 | ||
146 | /* Check this effect type is supported by this device */ | 146 | /* Check this effect type is supported by this device */ |
147 | if (!test_bit(effect->type, iforce->dev.ffbit)) | 147 | if (!test_bit(effect->type, iforce->dev->ffbit)) |
148 | return -EINVAL; | 148 | return -EINVAL; |
149 | 149 | ||
150 | /* | 150 | /* |
@@ -152,30 +152,31 @@ static int iforce_upload_effect(struct input_dev *dev, struct ff_effect *effect) | |||
152 | */ | 152 | */ |
153 | if (effect->id == -1) { | 153 | if (effect->id == -1) { |
154 | 154 | ||
155 | for (id=0; id < FF_EFFECTS_MAX; ++id) | 155 | for (id = 0; id < FF_EFFECTS_MAX; ++id) |
156 | if (!test_and_set_bit(FF_CORE_IS_USED, iforce->core_effects[id].flags)) break; | 156 | if (!test_and_set_bit(FF_CORE_IS_USED, iforce->core_effects[id].flags)) |
157 | break; | ||
157 | 158 | ||
158 | if ( id == FF_EFFECTS_MAX || id >= iforce->dev.ff_effects_max) | 159 | if (id == FF_EFFECTS_MAX || id >= iforce->dev->ff_effects_max) |
159 | return -ENOMEM; | 160 | return -ENOMEM; |
160 | 161 | ||
161 | effect->id = id; | 162 | effect->id = id; |
162 | iforce->core_effects[id].owner = current->pid; | 163 | iforce->core_effects[id].owner = current->pid; |
163 | iforce->core_effects[id].flags[0] = (1<<FF_CORE_IS_USED); /* Only IS_USED bit must be set */ | 164 | iforce->core_effects[id].flags[0] = (1 << FF_CORE_IS_USED); /* Only IS_USED bit must be set */ |
164 | 165 | ||
165 | is_update = FALSE; | 166 | is_update = FALSE; |
166 | } | 167 | } |
167 | else { | 168 | else { |
168 | /* We want to update an effect */ | 169 | /* We want to update an effect */ |
169 | if (!CHECK_OWNERSHIP(effect->id, iforce)) return -EACCES; | 170 | if (!CHECK_OWNERSHIP(effect->id, iforce)) |
171 | return -EACCES; | ||
170 | 172 | ||
171 | /* Parameter type cannot be updated */ | 173 | /* Parameter type cannot be updated */ |
172 | if (effect->type != iforce->core_effects[effect->id].effect.type) | 174 | if (effect->type != iforce->core_effects[effect->id].effect.type) |
173 | return -EINVAL; | 175 | return -EINVAL; |
174 | 176 | ||
175 | /* Check the effect is not already being updated */ | 177 | /* Check the effect is not already being updated */ |
176 | if (test_bit(FF_CORE_UPDATE, iforce->core_effects[effect->id].flags)) { | 178 | if (test_bit(FF_CORE_UPDATE, iforce->core_effects[effect->id].flags)) |
177 | return -EAGAIN; | 179 | return -EAGAIN; |
178 | } | ||
179 | 180 | ||
180 | is_update = TRUE; | 181 | is_update = TRUE; |
181 | } | 182 | } |
@@ -339,15 +340,19 @@ void iforce_delete_device(struct iforce *iforce) | |||
339 | 340 | ||
340 | int iforce_init_device(struct iforce *iforce) | 341 | int iforce_init_device(struct iforce *iforce) |
341 | { | 342 | { |
343 | struct input_dev *input_dev; | ||
342 | unsigned char c[] = "CEOV"; | 344 | unsigned char c[] = "CEOV"; |
343 | int i; | 345 | int i; |
344 | 346 | ||
347 | input_dev = input_allocate_device(); | ||
348 | if (input_dev) | ||
349 | return -ENOMEM; | ||
350 | |||
345 | init_waitqueue_head(&iforce->wait); | 351 | init_waitqueue_head(&iforce->wait); |
346 | spin_lock_init(&iforce->xmit_lock); | 352 | spin_lock_init(&iforce->xmit_lock); |
347 | init_MUTEX(&iforce->mem_mutex); | 353 | init_MUTEX(&iforce->mem_mutex); |
348 | iforce->xmit.buf = iforce->xmit_data; | 354 | iforce->xmit.buf = iforce->xmit_data; |
349 | 355 | iforce->dev = input_dev; | |
350 | iforce->dev.ff_effects_max = 10; | ||
351 | 356 | ||
352 | /* | 357 | /* |
353 | * Input device fields. | 358 | * Input device fields. |
@@ -356,26 +361,27 @@ int iforce_init_device(struct iforce *iforce) | |||
356 | switch (iforce->bus) { | 361 | switch (iforce->bus) { |
357 | #ifdef CONFIG_JOYSTICK_IFORCE_USB | 362 | #ifdef CONFIG_JOYSTICK_IFORCE_USB |
358 | case IFORCE_USB: | 363 | case IFORCE_USB: |
359 | iforce->dev.id.bustype = BUS_USB; | 364 | input_dev->id.bustype = BUS_USB; |
360 | iforce->dev.dev = &iforce->usbdev->dev; | 365 | input_dev->cdev.dev = &iforce->usbdev->dev; |
361 | break; | 366 | break; |
362 | #endif | 367 | #endif |
363 | #ifdef CONFIG_JOYSTICK_IFORCE_232 | 368 | #ifdef CONFIG_JOYSTICK_IFORCE_232 |
364 | case IFORCE_232: | 369 | case IFORCE_232: |
365 | iforce->dev.id.bustype = BUS_RS232; | 370 | input_dev->id.bustype = BUS_RS232; |
366 | iforce->dev.dev = &iforce->serio->dev; | 371 | input_dev->cdev.dev = &iforce->serio->dev; |
367 | break; | 372 | break; |
368 | #endif | 373 | #endif |
369 | } | 374 | } |
370 | 375 | ||
371 | iforce->dev.private = iforce; | 376 | input_dev->private = iforce; |
372 | iforce->dev.name = "Unknown I-Force device"; | 377 | input_dev->name = "Unknown I-Force device"; |
373 | iforce->dev.open = iforce_open; | 378 | input_dev->open = iforce_open; |
374 | iforce->dev.close = iforce_release; | 379 | input_dev->close = iforce_release; |
375 | iforce->dev.flush = iforce_flush; | 380 | input_dev->flush = iforce_flush; |
376 | iforce->dev.event = iforce_input_event; | 381 | input_dev->event = iforce_input_event; |
377 | iforce->dev.upload_effect = iforce_upload_effect; | 382 | input_dev->upload_effect = iforce_upload_effect; |
378 | iforce->dev.erase_effect = iforce_erase_effect; | 383 | input_dev->erase_effect = iforce_erase_effect; |
384 | input_dev->ff_effects_max = 10; | ||
379 | 385 | ||
380 | /* | 386 | /* |
381 | * On-device memory allocation. | 387 | * On-device memory allocation. |
@@ -399,7 +405,8 @@ int iforce_init_device(struct iforce *iforce) | |||
399 | 405 | ||
400 | if (i == 20) { /* 5 seconds */ | 406 | if (i == 20) { /* 5 seconds */ |
401 | printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n"); | 407 | printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n"); |
402 | return -1; | 408 | input_free_device(input_dev); |
409 | return -ENODEV; | ||
403 | } | 410 | } |
404 | 411 | ||
405 | /* | 412 | /* |
@@ -407,12 +414,12 @@ int iforce_init_device(struct iforce *iforce) | |||
407 | */ | 414 | */ |
408 | 415 | ||
409 | if (!iforce_get_id_packet(iforce, "M")) | 416 | if (!iforce_get_id_packet(iforce, "M")) |
410 | iforce->dev.id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; | 417 | input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; |
411 | else | 418 | else |
412 | printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); | 419 | printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); |
413 | 420 | ||
414 | if (!iforce_get_id_packet(iforce, "P")) | 421 | if (!iforce_get_id_packet(iforce, "P")) |
415 | iforce->dev.id.product = (iforce->edata[2] << 8) | iforce->edata[1]; | 422 | input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; |
416 | else | 423 | else |
417 | printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); | 424 | printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); |
418 | 425 | ||
@@ -422,15 +429,15 @@ int iforce_init_device(struct iforce *iforce) | |||
422 | printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n"); | 429 | printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n"); |
423 | 430 | ||
424 | if (!iforce_get_id_packet(iforce, "N")) | 431 | if (!iforce_get_id_packet(iforce, "N")) |
425 | iforce->dev.ff_effects_max = iforce->edata[1]; | 432 | iforce->dev->ff_effects_max = iforce->edata[1]; |
426 | else | 433 | else |
427 | printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n"); | 434 | printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n"); |
428 | 435 | ||
429 | /* Check if the device can store more effects than the driver can really handle */ | 436 | /* Check if the device can store more effects than the driver can really handle */ |
430 | if (iforce->dev.ff_effects_max > FF_EFFECTS_MAX) { | 437 | if (iforce->dev->ff_effects_max > FF_EFFECTS_MAX) { |
431 | printk(KERN_WARNING "input??: Device can handle %d effects, but N_EFFECTS_MAX is set to %d in iforce.h\n", | 438 | printk(KERN_WARNING "input??: Device can handle %d effects, but N_EFFECTS_MAX is set to %d in iforce.h\n", |
432 | iforce->dev.ff_effects_max, FF_EFFECTS_MAX); | 439 | iforce->dev->ff_effects_max, FF_EFFECTS_MAX); |
433 | iforce->dev.ff_effects_max = FF_EFFECTS_MAX; | 440 | iforce->dev->ff_effects_max = FF_EFFECTS_MAX; |
434 | } | 441 | } |
435 | 442 | ||
436 | /* | 443 | /* |
@@ -453,29 +460,28 @@ int iforce_init_device(struct iforce *iforce) | |||
453 | */ | 460 | */ |
454 | 461 | ||
455 | for (i = 0; iforce_device[i].idvendor; i++) | 462 | for (i = 0; iforce_device[i].idvendor; i++) |
456 | if (iforce_device[i].idvendor == iforce->dev.id.vendor && | 463 | if (iforce_device[i].idvendor == input_dev->id.vendor && |
457 | iforce_device[i].idproduct == iforce->dev.id.product) | 464 | iforce_device[i].idproduct == input_dev->id.product) |
458 | break; | 465 | break; |
459 | 466 | ||
460 | iforce->type = iforce_device + i; | 467 | iforce->type = iforce_device + i; |
461 | iforce->dev.name = iforce->type->name; | 468 | input_dev->name = iforce->type->name; |
462 | 469 | ||
463 | /* | 470 | /* |
464 | * Set input device bitfields and ranges. | 471 | * Set input device bitfields and ranges. |
465 | */ | 472 | */ |
466 | 473 | ||
467 | iforce->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_FF) | BIT(EV_FF_STATUS); | 474 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_FF) | BIT(EV_FF_STATUS); |
468 | 475 | ||
469 | for (i = 0; iforce->type->btn[i] >= 0; i++) { | 476 | for (i = 0; iforce->type->btn[i] >= 0; i++) { |
470 | signed short t = iforce->type->btn[i]; | 477 | signed short t = iforce->type->btn[i]; |
471 | set_bit(t, iforce->dev.keybit); | 478 | set_bit(t, input_dev->keybit); |
472 | } | 479 | } |
473 | set_bit(BTN_DEAD, iforce->dev.keybit); | 480 | set_bit(BTN_DEAD, input_dev->keybit); |
474 | 481 | ||
475 | for (i = 0; iforce->type->abs[i] >= 0; i++) { | 482 | for (i = 0; iforce->type->abs[i] >= 0; i++) { |
476 | 483 | ||
477 | signed short t = iforce->type->abs[i]; | 484 | signed short t = iforce->type->abs[i]; |
478 | set_bit(t, iforce->dev.absbit); | ||
479 | 485 | ||
480 | switch (t) { | 486 | switch (t) { |
481 | 487 | ||
@@ -483,52 +489,42 @@ int iforce_init_device(struct iforce *iforce) | |||
483 | case ABS_Y: | 489 | case ABS_Y: |
484 | case ABS_WHEEL: | 490 | case ABS_WHEEL: |
485 | 491 | ||
486 | iforce->dev.absmax[t] = 1920; | 492 | input_set_abs_params(input_dev, t, -1920, 1920, 16, 128); |
487 | iforce->dev.absmin[t] = -1920; | 493 | set_bit(t, input_dev->ffbit); |
488 | iforce->dev.absflat[t] = 128; | ||
489 | iforce->dev.absfuzz[t] = 16; | ||
490 | |||
491 | set_bit(t, iforce->dev.ffbit); | ||
492 | break; | 494 | break; |
493 | 495 | ||
494 | case ABS_THROTTLE: | 496 | case ABS_THROTTLE: |
495 | case ABS_GAS: | 497 | case ABS_GAS: |
496 | case ABS_BRAKE: | 498 | case ABS_BRAKE: |
497 | 499 | ||
498 | iforce->dev.absmax[t] = 255; | 500 | input_set_abs_params(input_dev, t, 0, 255, 0, 0); |
499 | iforce->dev.absmin[t] = 0; | ||
500 | break; | 501 | break; |
501 | 502 | ||
502 | case ABS_RUDDER: | 503 | case ABS_RUDDER: |
503 | 504 | ||
504 | iforce->dev.absmax[t] = 127; | 505 | input_set_abs_params(input_dev, t, -128, 127, 0, 0); |
505 | iforce->dev.absmin[t] = -128; | ||
506 | break; | 506 | break; |
507 | 507 | ||
508 | case ABS_HAT0X: | 508 | case ABS_HAT0X: |
509 | case ABS_HAT0Y: | 509 | case ABS_HAT0Y: |
510 | case ABS_HAT1X: | 510 | case ABS_HAT1X: |
511 | case ABS_HAT1Y: | 511 | case ABS_HAT1Y: |
512 | iforce->dev.absmax[t] = 1; | 512 | |
513 | iforce->dev.absmin[t] = -1; | 513 | input_set_abs_params(input_dev, t, -1, 1, 0, 0); |
514 | break; | 514 | break; |
515 | } | 515 | } |
516 | } | 516 | } |
517 | 517 | ||
518 | for (i = 0; iforce->type->ff[i] >= 0; i++) | 518 | for (i = 0; iforce->type->ff[i] >= 0; i++) |
519 | set_bit(iforce->type->ff[i], iforce->dev.ffbit); | 519 | set_bit(iforce->type->ff[i], input_dev->ffbit); |
520 | 520 | ||
521 | /* | 521 | /* |
522 | * Register input device. | 522 | * Register input device. |
523 | */ | 523 | */ |
524 | 524 | ||
525 | input_register_device(&iforce->dev); | 525 | input_register_device(iforce->dev); |
526 | |||
527 | printk(KERN_DEBUG "iforce->dev.open = %p\n", iforce->dev.open); | ||
528 | 526 | ||
529 | printk(KERN_INFO "input: %s [%d effects, %ld bytes memory]\n", | 527 | printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open); |
530 | iforce->dev.name, iforce->dev.ff_effects_max, | ||
531 | iforce->device_memory.end); | ||
532 | 528 | ||
533 | return 0; | 529 | return 0; |
534 | } | 530 | } |
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index e5a31e55d3e2..4a2629243e19 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c | |||
@@ -139,7 +139,8 @@ printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, value); | |||
139 | static int mark_core_as_ready(struct iforce *iforce, unsigned short addr) | 139 | static int mark_core_as_ready(struct iforce *iforce, unsigned short addr) |
140 | { | 140 | { |
141 | int i; | 141 | int i; |
142 | for (i=0; i<iforce->dev.ff_effects_max; ++i) { | 142 | |
143 | for (i = 0; i < iforce->dev->ff_effects_max; ++i) { | ||
143 | if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags) && | 144 | if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags) && |
144 | (iforce->core_effects[i].mod1_chunk.start == addr || | 145 | (iforce->core_effects[i].mod1_chunk.start == addr || |
145 | iforce->core_effects[i].mod2_chunk.start == addr)) { | 146 | iforce->core_effects[i].mod2_chunk.start == addr)) { |
@@ -153,7 +154,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr) | |||
153 | 154 | ||
154 | void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data, struct pt_regs *regs) | 155 | void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data, struct pt_regs *regs) |
155 | { | 156 | { |
156 | struct input_dev *dev = &iforce->dev; | 157 | struct input_dev *dev = iforce->dev; |
157 | int i; | 158 | int i; |
158 | static int being_used = 0; | 159 | static int being_used = 0; |
159 | 160 | ||
diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c index 11f51905cba7..64a78c515484 100644 --- a/drivers/input/joystick/iforce/iforce-serio.c +++ b/drivers/input/joystick/iforce/iforce-serio.c | |||
@@ -131,11 +131,10 @@ static int iforce_serio_connect(struct serio *serio, struct serio_driver *drv) | |||
131 | struct iforce *iforce; | 131 | struct iforce *iforce; |
132 | int err; | 132 | int err; |
133 | 133 | ||
134 | if (!(iforce = kmalloc(sizeof(struct iforce), GFP_KERNEL))) | 134 | iforce = kzalloc(sizeof(struct iforce), GFP_KERNEL); |
135 | if (!iforce) | ||
135 | return -ENOMEM; | 136 | return -ENOMEM; |
136 | 137 | ||
137 | memset(iforce, 0, sizeof(struct iforce)); | ||
138 | |||
139 | iforce->bus = IFORCE_232; | 138 | iforce->bus = IFORCE_232; |
140 | iforce->serio = serio; | 139 | iforce->serio = serio; |
141 | 140 | ||
@@ -148,7 +147,8 @@ static int iforce_serio_connect(struct serio *serio, struct serio_driver *drv) | |||
148 | return err; | 147 | return err; |
149 | } | 148 | } |
150 | 149 | ||
151 | if (iforce_init_device(iforce)) { | 150 | err = iforce_init_device(iforce); |
151 | if (err) { | ||
152 | serio_close(serio); | 152 | serio_close(serio); |
153 | serio_set_drvdata(serio, NULL); | 153 | serio_set_drvdata(serio, NULL); |
154 | kfree(iforce); | 154 | kfree(iforce); |
@@ -162,7 +162,7 @@ static void iforce_serio_disconnect(struct serio *serio) | |||
162 | { | 162 | { |
163 | struct iforce *iforce = serio_get_drvdata(serio); | 163 | struct iforce *iforce = serio_get_drvdata(serio); |
164 | 164 | ||
165 | input_unregister_device(&iforce->dev); | 165 | input_unregister_device(iforce->dev); |
166 | serio_close(serio); | 166 | serio_close(serio); |
167 | serio_set_drvdata(serio, NULL); | 167 | serio_set_drvdata(serio, NULL); |
168 | kfree(iforce); | 168 | kfree(iforce); |
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 58600f91eff5..64b4a3080985 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c | |||
@@ -135,28 +135,24 @@ static int iforce_usb_probe(struct usb_interface *intf, | |||
135 | struct usb_host_interface *interface; | 135 | struct usb_host_interface *interface; |
136 | struct usb_endpoint_descriptor *epirq, *epout; | 136 | struct usb_endpoint_descriptor *epirq, *epout; |
137 | struct iforce *iforce; | 137 | struct iforce *iforce; |
138 | int err = -ENOMEM; | ||
138 | 139 | ||
139 | interface = intf->cur_altsetting; | 140 | interface = intf->cur_altsetting; |
140 | 141 | ||
141 | epirq = &interface->endpoint[0].desc; | 142 | epirq = &interface->endpoint[0].desc; |
142 | epout = &interface->endpoint[1].desc; | 143 | epout = &interface->endpoint[1].desc; |
143 | 144 | ||
144 | if (!(iforce = kmalloc(sizeof(struct iforce) + 32, GFP_KERNEL))) | 145 | if (!(iforce = kzalloc(sizeof(struct iforce) + 32, GFP_KERNEL))) |
145 | goto fail; | 146 | goto fail; |
146 | 147 | ||
147 | memset(iforce, 0, sizeof(struct iforce)); | 148 | if (!(iforce->irq = usb_alloc_urb(0, GFP_KERNEL))) |
148 | |||
149 | if (!(iforce->irq = usb_alloc_urb(0, GFP_KERNEL))) { | ||
150 | goto fail; | 149 | goto fail; |
151 | } | ||
152 | 150 | ||
153 | if (!(iforce->out = usb_alloc_urb(0, GFP_KERNEL))) { | 151 | if (!(iforce->out = usb_alloc_urb(0, GFP_KERNEL))) |
154 | goto fail; | 152 | goto fail; |
155 | } | ||
156 | 153 | ||
157 | if (!(iforce->ctrl = usb_alloc_urb(0, GFP_KERNEL))) { | 154 | if (!(iforce->ctrl = usb_alloc_urb(0, GFP_KERNEL))) |
158 | goto fail; | 155 | goto fail; |
159 | } | ||
160 | 156 | ||
161 | iforce->bus = IFORCE_USB; | 157 | iforce->bus = IFORCE_USB; |
162 | iforce->usbdev = dev; | 158 | iforce->usbdev = dev; |
@@ -174,7 +170,9 @@ static int iforce_usb_probe(struct usb_interface *intf, | |||
174 | usb_fill_control_urb(iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0), | 170 | usb_fill_control_urb(iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0), |
175 | (void*) &iforce->cr, iforce->edata, 16, iforce_usb_ctrl, iforce); | 171 | (void*) &iforce->cr, iforce->edata, 16, iforce_usb_ctrl, iforce); |
176 | 172 | ||
177 | if (iforce_init_device(iforce)) goto fail; | 173 | err = iforce_init_device(iforce); |
174 | if (err) | ||
175 | goto fail; | ||
178 | 176 | ||
179 | usb_set_intfdata(intf, iforce); | 177 | usb_set_intfdata(intf, iforce); |
180 | return 0; | 178 | return 0; |
@@ -187,7 +185,7 @@ fail: | |||
187 | kfree(iforce); | 185 | kfree(iforce); |
188 | } | 186 | } |
189 | 187 | ||
190 | return -ENODEV; | 188 | return err; |
191 | } | 189 | } |
192 | 190 | ||
193 | /* Called by iforce_delete() */ | 191 | /* Called by iforce_delete() */ |
@@ -211,7 +209,7 @@ static void iforce_usb_disconnect(struct usb_interface *intf) | |||
211 | usb_set_intfdata(intf, NULL); | 209 | usb_set_intfdata(intf, NULL); |
212 | if (iforce) { | 210 | if (iforce) { |
213 | iforce->usbdev = NULL; | 211 | iforce->usbdev = NULL; |
214 | input_unregister_device(&iforce->dev); | 212 | input_unregister_device(iforce->dev); |
215 | 213 | ||
216 | if (!open) { | 214 | if (!open) { |
217 | iforce_delete_device(iforce); | 215 | iforce_delete_device(iforce); |
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index bce247bc300b..146f406b8f8a 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h | |||
@@ -117,7 +117,7 @@ struct iforce_device { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct iforce { | 119 | struct iforce { |
120 | struct input_dev dev; /* Input device interface */ | 120 | struct input_dev *dev; /* Input device interface */ |
121 | struct iforce_device *type; | 121 | struct iforce_device *type; |
122 | int bus; | 122 | int bus; |
123 | 123 | ||