From patchwork Thu Sep 7 00:21:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9941505 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C6CFE602CC for ; Thu, 7 Sep 2017 00:22:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCD66212BE for ; Thu, 7 Sep 2017 00:22:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1B6623B34; Thu, 7 Sep 2017 00:22:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34C27212BE for ; Thu, 7 Sep 2017 00:22:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752753AbdIGAWB (ORCPT ); Wed, 6 Sep 2017 20:22:01 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35885 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408AbdIGAVT (ORCPT ); Wed, 6 Sep 2017 20:21:19 -0400 Received: by mail-pg0-f65.google.com with SMTP id d8so4197285pgt.3; Wed, 06 Sep 2017 17:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pDCGu2l5tlIYxeGql3hFgxqwbdnEyp2oL6wf7Bh69v8=; b=dMjeBDUrMzMbFHgS1N7JMxIVoZBDtnShYUE7aY3/TX8kkyqMf70VbjBuU58vB3Lv3T 2gvQ9aKouhQjzTEz4pL93btrT/r6oCKRTdocC7O9sdcNdSm4quEkcKyRCC3RWi3dRTGN 6sLfWaheyqtIDcr/CLk7JbYgiBWsSQhY4bjNCAd+XGySN6llKyGmHmv9i741jvbiw/tf FrtGlI9U0RPCPQlYrGchlx3aMlh5JH8arrbdWlR3tZuO/QjekGT49lNbq5uW97qjRKbx 4CjIzxu2jfJF2jz8nLRzSilXdIcDWBBbg+pdnCGRdIDBSI+KCxfci0wBPlgOnPgN/MBO KDog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pDCGu2l5tlIYxeGql3hFgxqwbdnEyp2oL6wf7Bh69v8=; b=ClHraEQ8nNs7R9xFu11XUPQIyfJ4cBfFBFSefpQJeWD5x9zRgyDjzCqKUG9ewB9Hno o2CINjjJyJ7xeqtKBwFyKtCBMki5tovAryCxEnE5tinEK5JpUGo4B+EO943ZcVf0VMjQ FgNOGetH/Wn+86MGFlgBeLnoa8kwjtSKOYxU9m5M6gJZT699l4R2BexP6q5vl17etTLQ U0h0UqxF5nr3YX38+6qLtT8b+F75M/FGcjEabvUolenTBMYYF1ADq2FPCAgfz1V+Vi3e FVIFWfcfyHQNiVtArByWr7hZhevY8BZINsDv+iPJkFPHw/GJdfEkljSZyIUsyGO2nY3o MlKw== X-Gm-Message-State: AHPjjUgJ77oOWFpo1Ter2qrhTedVWsv8Gw7f6tb/KgqPXQsNvVrIDEP4 SOgaclR9pmyIo/8q3W8= X-Google-Smtp-Source: ADKCNb4IJtwEYflo5DZgFwLW/xLR73oj7zgfxgd1PJ+DhrRmGpA2wzaG3cubmqdoyvWYhmN1rHc0Tg== X-Received: by 10.84.231.135 with SMTP id g7mr971379plk.355.1504743678082; Wed, 06 Sep 2017 17:21:18 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([100.98.112.21]) by smtp.gmail.com with ESMTPSA id d25sm1282515pfb.1.2017.09.06.17.21.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Sep 2017 17:21:17 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Rodrigo Rivas Costa , =?UTF-8?q?Cl=C3=A9ment=20VUCHENER?= , Elias Vanderstuyft , linux-kernel@vger.kernel.org Subject: [PATCH 4/6] Input: uinput - fix coding style in uinput_ioctl_handler() Date: Wed, 6 Sep 2017 17:21:10 -0700 Message-Id: <20170907002112.14097-4-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.14.1.581.gf28d330327-goog In-Reply-To: <20170907002112.14097-1-dmitry.torokhov@gmail.com> References: <20170907002112.14097-1-dmitry.torokhov@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "case"s in switch statement were indented extra level, let's fix that. Signed-off-by: Dmitry Torokhov --- drivers/input/misc/uinput.c | 231 ++++++++++++++++++++++---------------------- 1 file changed, 115 insertions(+), 116 deletions(-) diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index c30704fa1a06..09549eddfcd4 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -832,156 +832,155 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd, } switch (cmd) { - case UI_GET_VERSION: - if (put_user(UINPUT_VERSION, - (unsigned int __user *)p)) - retval = -EFAULT; - goto out; + case UI_GET_VERSION: + if (put_user(UINPUT_VERSION, (unsigned int __user *)p)) + retval = -EFAULT; + goto out; - case UI_DEV_CREATE: - retval = uinput_create_device(udev); - goto out; + case UI_DEV_CREATE: + retval = uinput_create_device(udev); + goto out; - case UI_DEV_DESTROY: - uinput_destroy_device(udev); - goto out; + case UI_DEV_DESTROY: + uinput_destroy_device(udev); + goto out; - case UI_DEV_SETUP: - retval = uinput_dev_setup(udev, p); - goto out; + case UI_DEV_SETUP: + retval = uinput_dev_setup(udev, p); + 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: - retval = uinput_set_bit(arg, evbit, EV_MAX); - goto out; + case UI_SET_EVBIT: + retval = uinput_set_bit(arg, evbit, EV_MAX); + goto out; - case UI_SET_KEYBIT: - retval = uinput_set_bit(arg, keybit, KEY_MAX); - goto out; + case UI_SET_KEYBIT: + retval = uinput_set_bit(arg, keybit, KEY_MAX); + goto out; - case UI_SET_RELBIT: - retval = uinput_set_bit(arg, relbit, REL_MAX); - goto out; + case UI_SET_RELBIT: + retval = uinput_set_bit(arg, relbit, REL_MAX); + goto out; - case UI_SET_ABSBIT: - retval = uinput_set_bit(arg, absbit, ABS_MAX); - goto out; + case UI_SET_ABSBIT: + retval = uinput_set_bit(arg, absbit, ABS_MAX); + goto out; - case UI_SET_MSCBIT: - retval = uinput_set_bit(arg, mscbit, MSC_MAX); - goto out; + case UI_SET_MSCBIT: + retval = uinput_set_bit(arg, mscbit, MSC_MAX); + goto out; - case UI_SET_LEDBIT: - retval = uinput_set_bit(arg, ledbit, LED_MAX); - goto out; + case UI_SET_LEDBIT: + retval = uinput_set_bit(arg, ledbit, LED_MAX); + 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: - retval = uinput_set_bit(arg, sndbit, SND_MAX); + case UI_SET_PHYS: + if (udev->state == UIST_CREATED) { + retval = -EINVAL; goto out; + } - case UI_SET_FFBIT: - retval = uinput_set_bit(arg, ffbit, FF_MAX); + phys = strndup_user(p, 1024); + if (IS_ERR(phys)) { + retval = PTR_ERR(phys); goto out; + } + + kfree(udev->dev->phys); + udev->dev->phys = phys; + goto out; - case UI_SET_SWBIT: - retval = uinput_set_bit(arg, swbit, SW_MAX); + case UI_BEGIN_FF_UPLOAD: + retval = uinput_ff_upload_from_user(p, &ff_up); + if (retval) goto out; - case UI_SET_PROPBIT: - retval = uinput_set_bit(arg, propbit, INPUT_PROP_MAX); + req = uinput_request_find(udev, ff_up.request_id); + if (!req || req->code != UI_FF_UPLOAD || + !req->u.upload.effect) { + retval = -EINVAL; goto out; + } - case UI_SET_PHYS: - if (udev->state == UIST_CREATED) { - 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)); - phys = strndup_user(p, 1024); - if (IS_ERR(phys)) { - retval = PTR_ERR(phys); - goto out; - } + retval = uinput_ff_upload_to_user(p, &ff_up); + goto out; - kfree(udev->dev->phys); - udev->dev->phys = phys; + case UI_BEGIN_FF_ERASE: + if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) { + retval = -EFAULT; goto out; + } - case UI_BEGIN_FF_UPLOAD: - retval = uinput_ff_upload_from_user(p, &ff_up); - if (retval) - 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); + req = uinput_request_find(udev, ff_erase.request_id); + if (!req || req->code != UI_FF_ERASE) { + retval = -EINVAL; goto out; + } - case UI_BEGIN_FF_ERASE: - if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) { - retval = -EFAULT; - goto out; - } - - 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; - } - + 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; + } - case UI_END_FF_UPLOAD: - retval = uinput_ff_upload_from_user(p, &ff_up); - if (retval) - goto out; + 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; - } + case UI_END_FF_UPLOAD: + retval = uinput_ff_upload_from_user(p, &ff_up); + if (retval) + goto out; - req->retval = ff_up.retval; - complete(&req->done); + req = uinput_request_find(udev, ff_up.request_id); + if (!req || req->code != UI_FF_UPLOAD || + !req->u.upload.effect) { + retval = -EINVAL; goto out; + } - case UI_END_FF_ERASE: - if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) { - retval = -EFAULT; - goto out; - } + req->retval = ff_up.retval; + complete(&req->done); + goto out; - req = uinput_request_find(udev, ff_erase.request_id); - if (!req || req->code != UI_FF_ERASE) { - retval = -EINVAL; - goto out; - } + case UI_END_FF_ERASE: + if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) { + retval = -EFAULT; + goto out; + } - req->retval = ff_erase.retval; - complete(&req->done); + req = uinput_request_find(udev, ff_erase.request_id); + if (!req || req->code != UI_FF_ERASE) { + retval = -EINVAL; goto out; + } + + req->retval = ff_erase.retval; + complete(&req->done); + goto out; } size = _IOC_SIZE(cmd);