Commit 04ce40a6 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: uinput - remove uinput_allocate_device()

There is no need for this wrapper; let's use input_allocate_device()
directly, and complete initialization in uinput_create_device().
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent c0661652
...@@ -324,6 +324,10 @@ static int uinput_create_device(struct uinput_device *udev) ...@@ -324,6 +324,10 @@ static int uinput_create_device(struct uinput_device *udev)
dev->flush = uinput_dev_flush; dev->flush = uinput_dev_flush;
} }
dev->event = uinput_dev_event;
input_set_drvdata(udev->dev, udev);
error = input_register_device(udev->dev); error = input_register_device(udev->dev);
if (error) if (error)
goto fail2; goto fail2;
...@@ -406,18 +410,6 @@ static int uinput_validate_absbits(struct input_dev *dev) ...@@ -406,18 +410,6 @@ static int uinput_validate_absbits(struct input_dev *dev)
return 0; return 0;
} }
static int uinput_allocate_device(struct uinput_device *udev)
{
udev->dev = input_allocate_device();
if (!udev->dev)
return -ENOMEM;
udev->dev->event = uinput_dev_event;
input_set_drvdata(udev->dev, udev);
return 0;
}
static int uinput_dev_setup(struct uinput_device *udev, static int uinput_dev_setup(struct uinput_device *udev,
struct uinput_setup __user *arg) struct uinput_setup __user *arg)
{ {
...@@ -493,9 +485,9 @@ static int uinput_setup_device_legacy(struct uinput_device *udev, ...@@ -493,9 +485,9 @@ static int uinput_setup_device_legacy(struct uinput_device *udev,
return -EINVAL; return -EINVAL;
if (!udev->dev) { if (!udev->dev) {
retval = uinput_allocate_device(udev); udev->dev = input_allocate_device();
if (retval) if (!udev->dev)
return retval; return -ENOMEM;
} }
dev = udev->dev; dev = udev->dev;
...@@ -826,9 +818,9 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd, ...@@ -826,9 +818,9 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
return retval; return retval;
if (!udev->dev) { if (!udev->dev) {
retval = uinput_allocate_device(udev); udev->dev = input_allocate_device();
if (retval) if (!udev->dev)
goto out; return -ENOMEM;
} }
switch (cmd) { switch (cmd) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment