From patchwork Wed Jun 5 19:48:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 10977711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3599615E6 for ; Wed, 5 Jun 2019 19:49:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29ECE28757 for ; Wed, 5 Jun 2019 19:49:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 280DB28892; Wed, 5 Jun 2019 19:49:30 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 6291B288ED for ; Wed, 5 Jun 2019 19:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726535AbfFETt3 (ORCPT ); Wed, 5 Jun 2019 15:49:29 -0400 Received: from mga01.intel.com ([192.55.52.88]:2918 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726501AbfFETt3 (ORCPT ); Wed, 5 Jun 2019 15:49:29 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2019 12:49:28 -0700 X-ExtLoop1: 1 Received: from sjchrist-coffee.jf.intel.com ([10.54.74.36]) by orsmga008.jf.intel.com with ESMTP; 05 Jun 2019 12:49:27 -0700 From: Sean Christopherson To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org, Dave Hansen , Cedric Xing , Andy Lutomirski , Jethro Beekman , "Dr . Greg Wettstein" Subject: [PATCH 2/7] x86/sgx: Remove unnecessary @cmd parameter from ioctl helpers Date: Wed, 5 Jun 2019 12:48:40 -0700 Message-Id: <20190605194845.926-3-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190605194845.926-1-sean.j.christopherson@intel.com> References: <20190605194845.926-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Sender: linux-sgx-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Each ioctl command is directly and uniquely associated with a handler, i.e. the command is implied by the function itself. Signed-off-by: Sean Christopherson --- arch/x86/kernel/cpu/sgx/driver/ioctl.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/arch/x86/kernel/cpu/sgx/driver/ioctl.c b/arch/x86/kernel/cpu/sgx/driver/ioctl.c index cc057d487499..a0742d18aa36 100644 --- a/arch/x86/kernel/cpu/sgx/driver/ioctl.c +++ b/arch/x86/kernel/cpu/sgx/driver/ioctl.c @@ -383,7 +383,6 @@ static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs) /** * sgx_ioc_enclave_create - handler for %SGX_IOC_ENCLAVE_CREATE * @filep: open file to /dev/sgx - * @cmd: the command value * @arg: pointer to an &sgx_enclave_create instance * * Allocate kernel data structures for a new enclave and execute ECREATE after @@ -397,8 +396,7 @@ static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs) * 0 on success, * -errno otherwise */ -static long sgx_ioc_enclave_create(struct file *filep, unsigned int cmd, - unsigned long arg) +static long sgx_ioc_enclave_create(struct file *filep, unsigned long arg) { struct sgx_enclave_create *createp = (struct sgx_enclave_create *)arg; struct sgx_encl *encl = filep->private_data; @@ -579,7 +577,6 @@ static int sgx_encl_add_page(struct sgx_encl *encl, unsigned long addr, * sgx_ioc_enclave_add_page - handler for %SGX_IOC_ENCLAVE_ADD_PAGE * * @filep: open file to /dev/sgx - * @cmd: the command value * @arg: pointer to an &sgx_enclave_add_page instance * * Add a page to an uninitialized enclave (EADD), and optionally extend the @@ -593,8 +590,7 @@ static int sgx_encl_add_page(struct sgx_encl *encl, unsigned long addr, * 0 on success, * -errno otherwise */ -static long sgx_ioc_enclave_add_page(struct file *filep, unsigned int cmd, - unsigned long arg) +static long sgx_ioc_enclave_add_page(struct file *filep, unsigned long arg) { struct sgx_enclave_add_page *addp = (void *)arg; struct sgx_encl *encl = filep->private_data; @@ -721,7 +717,6 @@ static int sgx_encl_init(struct sgx_encl *encl, struct sgx_sigstruct *sigstruct, * sgx_ioc_enclave_init - handler for %SGX_IOC_ENCLAVE_INIT * * @filep: open file to /dev/sgx - * @cmd: the command value * @arg: pointer to an &sgx_enclave_init instance * * Flush any outstanding enqueued EADD operations and perform EINIT. The @@ -733,8 +728,7 @@ static int sgx_encl_init(struct sgx_encl *encl, struct sgx_sigstruct *sigstruct, * SGX error code on EINIT failure, * -errno otherwise */ -static long sgx_ioc_enclave_init(struct file *filep, unsigned int cmd, - unsigned long arg) +static long sgx_ioc_enclave_init(struct file *filep, unsigned long arg) { struct sgx_enclave_init *initp = (struct sgx_enclave_init *)arg; struct sgx_encl *encl = filep->private_data; @@ -770,7 +764,6 @@ static long sgx_ioc_enclave_init(struct file *filep, unsigned int cmd, /** * sgx_ioc_enclave_set_attribute - handler for %SGX_IOC_ENCLAVE_SET_ATTRIBUTE * @filep: open file to /dev/sgx - * @cmd: the command value * @arg: pointer to a struct sgx_enclave_set_attribute instance * * Mark the enclave as being allowed to access a restricted attribute bit. @@ -786,8 +779,7 @@ static long sgx_ioc_enclave_init(struct file *filep, unsigned int cmd, * * Return: 0 on success, -errno otherwise */ -static long sgx_ioc_enclave_set_attribute(struct file *filep, unsigned int cmd, - unsigned long arg) +static long sgx_ioc_enclave_set_attribute(struct file *filep, unsigned long arg) { struct sgx_enclave_set_attribute *params = (void *)arg; struct sgx_encl *encl = filep->private_data; @@ -810,8 +802,7 @@ static long sgx_ioc_enclave_set_attribute(struct file *filep, unsigned int cmd, return ret; } -typedef long (*sgx_ioc_t)(struct file *filep, unsigned int cmd, - unsigned long arg); +typedef long (*sgx_ioc_t)(struct file *filep, unsigned long arg); long sgx_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { @@ -839,5 +830,5 @@ long sgx_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) if (copy_from_user(data, (void __user *)arg, _IOC_SIZE(cmd))) return -EFAULT; - return handler(filep, cmd, (unsigned long)((void *)data)); + return handler(filep, (unsigned long)((void *)data)); }