aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-15 03:01:40 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:54 -0400
commit34abf91f4036c01669e298e649b7ba85cadf82eb (patch)
treefa17affbf6f71c9759110ceac41f9897b61b6d1c
parent17dd3f0f7aa729a042af5d3318ff9b3e7781b45b (diff)
[PATCH] Input: convert net/bluetooth to dynamic input_dev allocation
Input: convert net/bluetooth 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>
-rw-r--r--net/bluetooth/hidp/core.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index de8af5f42394..860444a7fc0f 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -520,7 +520,7 @@ static int hidp_session(void *arg)
520 520
521 if (session->input) { 521 if (session->input) {
522 input_unregister_device(session->input); 522 input_unregister_device(session->input);
523 kfree(session->input); 523 session->input = NULL;
524 } 524 }
525 525
526 up_write(&hidp_session_sem); 526 up_write(&hidp_session_sem);
@@ -536,6 +536,8 @@ static inline void hidp_setup_input(struct hidp_session *session, struct hidp_co
536 536
537 input->private = session; 537 input->private = session;
538 538
539 input->name = "Bluetooth HID Boot Protocol Device";
540
539 input->id.bustype = BUS_BLUETOOTH; 541 input->id.bustype = BUS_BLUETOOTH;
540 input->id.vendor = req->vendor; 542 input->id.vendor = req->vendor;
541 input->id.product = req->product; 543 input->id.product = req->product;
@@ -582,16 +584,15 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
582 return -ENOTUNIQ; 584 return -ENOTUNIQ;
583 585
584 session = kmalloc(sizeof(struct hidp_session), GFP_KERNEL); 586 session = kmalloc(sizeof(struct hidp_session), GFP_KERNEL);
585 if (!session) 587 if (!session)
586 return -ENOMEM; 588 return -ENOMEM;
587 memset(session, 0, sizeof(struct hidp_session)); 589 memset(session, 0, sizeof(struct hidp_session));
588 590
589 session->input = kmalloc(sizeof(struct input_dev), GFP_KERNEL); 591 session->input = input_allocate_device();
590 if (!session->input) { 592 if (!session->input) {
591 kfree(session); 593 kfree(session);
592 return -ENOMEM; 594 return -ENOMEM;
593 } 595 }
594 memset(session->input, 0, sizeof(struct input_dev));
595 596
596 down_write(&hidp_session_sem); 597 down_write(&hidp_session_sem);
597 598
@@ -651,8 +652,10 @@ unlink:
651 652
652 __hidp_unlink_session(session); 653 __hidp_unlink_session(session);
653 654
654 if (session->input) 655 if (session->input) {
655 input_unregister_device(session->input); 656 input_unregister_device(session->input);
657 session->input = NULL; /* don't try to free it here */
658 }
656 659
657failed: 660failed:
658 up_write(&hidp_session_sem); 661 up_write(&hidp_session_sem);