Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34abf91f authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman
Browse files

[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: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 17dd3f0f
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -520,7 +520,7 @@ static int hidp_session(void *arg)

	if (session->input) {
		input_unregister_device(session->input);
		kfree(session->input);
		session->input = NULL;
	}

	up_write(&hidp_session_sem);
@@ -536,6 +536,8 @@ static inline void hidp_setup_input(struct hidp_session *session, struct hidp_co

	input->private = session;

	input->name = "Bluetooth HID Boot Protocol Device";

	input->id.bustype = BUS_BLUETOOTH;
	input->id.vendor  = req->vendor;
	input->id.product = req->product;
@@ -586,12 +588,11 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
		return -ENOMEM;
	memset(session, 0, sizeof(struct hidp_session));

	session->input = kmalloc(sizeof(struct input_dev), GFP_KERNEL);
	session->input = input_allocate_device();
	if (!session->input) {
		kfree(session);
		return -ENOMEM;
	}
	memset(session->input, 0, sizeof(struct input_dev));

	down_write(&hidp_session_sem);

@@ -651,8 +652,10 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,

	__hidp_unlink_session(session);

	if (session->input)
	if (session->input) {
		input_unregister_device(session->input);
		session->input = NULL; /* don't try to free it here */
	}

failed:
	up_write(&hidp_session_sem);