Commit c0661652 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: uinput - fix coding style in uinput_ioctl_handler()

"case"s in switch statement were indented extra level, let's fix that.
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 8e009118
...@@ -832,156 +832,155 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd, ...@@ -832,156 +832,155 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
} }
switch (cmd) { switch (cmd) {
case UI_GET_VERSION: case UI_GET_VERSION:
if (put_user(UINPUT_VERSION, if (put_user(UINPUT_VERSION, (unsigned int __user *)p))
(unsigned int __user *)p)) retval = -EFAULT;
retval = -EFAULT; goto out;
goto out;
case UI_DEV_CREATE: case UI_DEV_CREATE:
retval = uinput_create_device(udev); retval = uinput_create_device(udev);
goto out; goto out;
case UI_DEV_DESTROY: case UI_DEV_DESTROY:
uinput_destroy_device(udev); uinput_destroy_device(udev);
goto out; goto out;
case UI_DEV_SETUP: case UI_DEV_SETUP:
retval = uinput_dev_setup(udev, p); retval = uinput_dev_setup(udev, p);
goto out; goto out;
/* UI_ABS_SETUP is handled in the variable size ioctls */ /* UI_ABS_SETUP is handled in the variable size ioctls */
case UI_SET_EVBIT: case UI_SET_EVBIT:
retval = uinput_set_bit(arg, evbit, EV_MAX); retval = uinput_set_bit(arg, evbit, EV_MAX);
goto out; goto out;
case UI_SET_KEYBIT: case UI_SET_KEYBIT:
retval = uinput_set_bit(arg, keybit, KEY_MAX); retval = uinput_set_bit(arg, keybit, KEY_MAX);
goto out; goto out;
case UI_SET_RELBIT: case UI_SET_RELBIT:
retval = uinput_set_bit(arg, relbit, REL_MAX); retval = uinput_set_bit(arg, relbit, REL_MAX);
goto out; goto out;
case UI_SET_ABSBIT: case UI_SET_ABSBIT:
retval = uinput_set_bit(arg, absbit, ABS_MAX); retval = uinput_set_bit(arg, absbit, ABS_MAX);
goto out; goto out;
case UI_SET_MSCBIT: case UI_SET_MSCBIT:
retval = uinput_set_bit(arg, mscbit, MSC_MAX); retval = uinput_set_bit(arg, mscbit, MSC_MAX);
goto out; goto out;
case UI_SET_LEDBIT: case UI_SET_LEDBIT:
retval = uinput_set_bit(arg, ledbit, LED_MAX); retval = uinput_set_bit(arg, ledbit, LED_MAX);
goto out; goto out;
case UI_SET_SNDBIT:
retval = uinput_set_bit(arg, sndbit, SND_MAX);
goto out;
case UI_SET_FFBIT:
retval = uinput_set_bit(arg, ffbit, FF_MAX);
goto out;
case UI_SET_SWBIT:
retval = uinput_set_bit(arg, swbit, SW_MAX);
goto out;
case UI_SET_PROPBIT:
retval = uinput_set_bit(arg, propbit, INPUT_PROP_MAX);
goto out;
case UI_SET_SNDBIT: case UI_SET_PHYS:
retval = uinput_set_bit(arg, sndbit, SND_MAX); if (udev->state == UIST_CREATED) {
retval = -EINVAL;
goto out; goto out;
}
case UI_SET_FFBIT: phys = strndup_user(p, 1024);
retval = uinput_set_bit(arg, ffbit, FF_MAX); if (IS_ERR(phys)) {
retval = PTR_ERR(phys);
goto out; goto out;
}
kfree(udev->dev->phys);
udev->dev->phys = phys;
goto out;
case UI_SET_SWBIT: case UI_BEGIN_FF_UPLOAD:
retval = uinput_set_bit(arg, swbit, SW_MAX); retval = uinput_ff_upload_from_user(p, &ff_up);
if (retval)
goto out; goto out;
case UI_SET_PROPBIT: req = uinput_request_find(udev, ff_up.request_id);
retval = uinput_set_bit(arg, propbit, INPUT_PROP_MAX); if (!req || req->code != UI_FF_UPLOAD ||
!req->u.upload.effect) {
retval = -EINVAL;
goto out; goto out;
}
case UI_SET_PHYS: ff_up.retval = 0;
if (udev->state == UIST_CREATED) { ff_up.effect = *req->u.upload.effect;
retval = -EINVAL; if (req->u.upload.old)
goto out; ff_up.old = *req->u.upload.old;
} else
memset(&ff_up.old, 0, sizeof(struct ff_effect));
phys = strndup_user(p, 1024); retval = uinput_ff_upload_to_user(p, &ff_up);
if (IS_ERR(phys)) { goto out;
retval = PTR_ERR(phys);
goto out;
}
kfree(udev->dev->phys); case UI_BEGIN_FF_ERASE:
udev->dev->phys = phys; if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) {
retval = -EFAULT;
goto out; goto out;
}
case UI_BEGIN_FF_UPLOAD: req = uinput_request_find(udev, ff_erase.request_id);
retval = uinput_ff_upload_from_user(p, &ff_up); if (!req || req->code != UI_FF_ERASE) {
if (retval) retval = -EINVAL;
goto out;
req = uinput_request_find(udev, ff_up.request_id);
if (!req || req->code != UI_FF_UPLOAD ||
!req->u.upload.effect) {
retval = -EINVAL;
goto out;
}
ff_up.retval = 0;
ff_up.effect = *req->u.upload.effect;
if (req->u.upload.old)
ff_up.old = *req->u.upload.old;
else
memset(&ff_up.old, 0, sizeof(struct ff_effect));
retval = uinput_ff_upload_to_user(p, &ff_up);
goto out; goto out;
}
case UI_BEGIN_FF_ERASE: ff_erase.retval = 0;
if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) { ff_erase.effect_id = req->u.effect_id;
retval = -EFAULT; if (copy_to_user(p, &ff_erase, sizeof(ff_erase))) {
goto out; retval = -EFAULT;
}
req = uinput_request_find(udev, ff_erase.request_id);
if (!req || req->code != UI_FF_ERASE) {
retval = -EINVAL;
goto out;
}
ff_erase.retval = 0;
ff_erase.effect_id = req->u.effect_id;
if (copy_to_user(p, &ff_erase, sizeof(ff_erase))) {
retval = -EFAULT;
goto out;
}
goto out; goto out;
}
case UI_END_FF_UPLOAD: goto out;
retval = uinput_ff_upload_from_user(p, &ff_up);
if (retval)
goto out;
req = uinput_request_find(udev, ff_up.request_id); case UI_END_FF_UPLOAD:
if (!req || req->code != UI_FF_UPLOAD || retval = uinput_ff_upload_from_user(p, &ff_up);
!req->u.upload.effect) { if (retval)
retval = -EINVAL; goto out;
goto out;
}
req->retval = ff_up.retval; req = uinput_request_find(udev, ff_up.request_id);
complete(&req->done); if (!req || req->code != UI_FF_UPLOAD ||
!req->u.upload.effect) {
retval = -EINVAL;
goto out; goto out;
}
case UI_END_FF_ERASE: req->retval = ff_up.retval;
if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) { complete(&req->done);
retval = -EFAULT; goto out;
goto out;
}
req = uinput_request_find(udev, ff_erase.request_id); case UI_END_FF_ERASE:
if (!req || req->code != UI_FF_ERASE) { if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) {
retval = -EINVAL; retval = -EFAULT;
goto out; goto out;
} }
req->retval = ff_erase.retval; req = uinput_request_find(udev, ff_erase.request_id);
complete(&req->done); if (!req || req->code != UI_FF_ERASE) {
retval = -EINVAL;
goto out; goto out;
}
req->retval = ff_erase.retval;
complete(&req->done);
goto out;
} }
size = _IOC_SIZE(cmd); size = _IOC_SIZE(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