Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3010051ybi; Mon, 17 Jun 2019 14:36:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzq/+ZbjUEwpSbQ45nK5Fbcgekk+R6yU+XuFlNBHO3iYEcXQI6cuk2e+zLyTz1Qq8ldYiNf X-Received: by 2002:a17:902:28c9:: with SMTP id f67mr111243877plb.19.1560807406304; Mon, 17 Jun 2019 14:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560807406; cv=none; d=google.com; s=arc-20160816; b=t7JXKmjn6i5YcdTufciT1nofI0IOElS8xb0DbF2xDm8btgPZd92TbncW5EbWMVwyNR 5vLS/5Vf/1LQeHFIViPI7pgH6QDQ3C4mhBMgx5xsVyyElkK83JEdMJvkmN+ZgEVAW13W x6oxnmM3qv7b4GeYX6xntGvcEgMbdCbl6QtXxzbnQDbfWCfnaDA3ke9XHbPyBDPdhbiY HNdK7iXZKhG2FzcqdPOkooyg8p5WQPrpwBY5OwFSLUVzHfpVBSnQEprCzpRWali7UiU3 tFa68b9ZTufYIt4Vi9Fg2w/8R8oTmPbPuYcsgjNhjL7QuAXS9sFeeZeAxcSHdg/9dgb5 3urQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=njjqXquElXrtmCIMJiasKFCZQThsC30uzv1i2outbvs=; b=e83na4HJzaBt0fwCQgQgLGGKXI6OTWEgUGFA9hh3fhpFM6Qy6IQpd+NOAllPpByMK7 97JOqH5xrfC7jVm2aUpVB4fabARZavZfXvn8r+xKAPQ8unAz0g2zAxCcPVgS6+8AD5v+ x6cbKW46A0TQ2OtfHyy3u3wXCchlegjC0aAabdOlCcWFO3aueRLIKtB702rOEHJD8Pyx RWJPkd8aVTKXwwLga6gk7zIuDev5/mV2lgH6BV4QlwqL+eSRicTYGDvOXzKHwHXFSgQH 6vrIE+3cEYxGKR7AqTjg9o47be1gichXUDxEDG48p80K8L/Hh1gbXYGabtGXDim3gfgl kBGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SlqM8s0X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si294091pjs.7.2019.06.17.14.36.30; Mon, 17 Jun 2019 14:36:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SlqM8s0X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729360AbfFQVV2 (ORCPT + 99 others); Mon, 17 Jun 2019 17:21:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:45962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729346AbfFQVV0 (ORCPT ); Mon, 17 Jun 2019 17:21:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 78EDE21670; Mon, 17 Jun 2019 21:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806485; bh=htbrBP4pYaPcphySl1i1AzxHM0t2q3InZbASBN6OIX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SlqM8s0XPHXCSv20LxuCMWtCDtkzYuZrVvIz4HutrNUBI5vc8NVNsPC+H7cvAgA38 J+f1eyJX7FIAO/etZ9JCfgRjGD9F6V72JJzZ9k4NpnXLxxtxKV2JQOhSpkuuwSOoWp 6V9t3uihSJ/9PkmWN1LU+aCVJHk2r/ujp4F/efLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Keith Busch , Chaitanya Kulkarni , Sasha Levin Subject: [PATCH 5.1 068/115] nvme: merge nvme_ns_ioctl into nvme_ioctl Date: Mon, 17 Jun 2019 23:09:28 +0200 Message-Id: <20190617210803.591007455@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210759.929316339@linuxfoundation.org> References: <20190617210759.929316339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 90ec611adcf20b96d0c2b7166497d53e4301a57f ] Merge the two functions to make future changes a little easier. Signed-off-by: Christoph Hellwig Reviewed-by: Keith Busch Reviewed-by: Chaitanya Kulkarni Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index decc0b3a3854..8b77e6a05f4b 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1383,32 +1383,11 @@ static void nvme_put_ns_from_disk(struct nvme_ns_head *head, int idx) srcu_read_unlock(&head->srcu, idx); } -static int nvme_ns_ioctl(struct nvme_ns *ns, unsigned cmd, unsigned long arg) -{ - switch (cmd) { - case NVME_IOCTL_ID: - force_successful_syscall_return(); - return ns->head->ns_id; - case NVME_IOCTL_ADMIN_CMD: - return nvme_user_cmd(ns->ctrl, NULL, (void __user *)arg); - case NVME_IOCTL_IO_CMD: - return nvme_user_cmd(ns->ctrl, ns, (void __user *)arg); - case NVME_IOCTL_SUBMIT_IO: - return nvme_submit_io(ns, (void __user *)arg); - default: - if (ns->ndev) - return nvme_nvm_ioctl(ns, cmd, arg); - if (is_sed_ioctl(cmd)) - return sed_ioctl(ns->ctrl->opal_dev, cmd, - (void __user *) arg); - return -ENOTTY; - } -} - static int nvme_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { struct nvme_ns_head *head = NULL; + void __user *argp = (void __user *)arg; struct nvme_ns *ns; int srcu_idx, ret; @@ -1416,7 +1395,29 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, if (unlikely(!ns)) return -EWOULDBLOCK; - ret = nvme_ns_ioctl(ns, cmd, arg); + switch (cmd) { + case NVME_IOCTL_ID: + force_successful_syscall_return(); + ret = ns->head->ns_id; + break; + case NVME_IOCTL_ADMIN_CMD: + ret = nvme_user_cmd(ns->ctrl, NULL, argp); + break; + case NVME_IOCTL_IO_CMD: + ret = nvme_user_cmd(ns->ctrl, ns, argp); + break; + case NVME_IOCTL_SUBMIT_IO: + ret = nvme_submit_io(ns, argp); + break; + default: + if (ns->ndev) + ret = nvme_nvm_ioctl(ns, cmd, arg); + else if (is_sed_ioctl(cmd)) + ret = sed_ioctl(ns->ctrl->opal_dev, cmd, argp); + else + ret = -ENOTTY; + } + nvme_put_ns_from_disk(head, srcu_idx); return ret; } -- 2.20.1