From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E647CC433E0 for ; Fri, 5 Mar 2021 13:23:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE67564FD4 for ; Fri, 5 Mar 2021 13:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbhCENWv (ORCPT ); Fri, 5 Mar 2021 08:22:51 -0500 Received: from verein.lst.de ([213.95.11.211]:46681 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbhCENWX (ORCPT ); Fri, 5 Mar 2021 08:22:23 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id E699D68B05; Fri, 5 Mar 2021 14:22:20 +0100 (CET) Date: Fri, 5 Mar 2021 14:22:20 +0100 From: "hch@lst.de" To: Kanchan Joshi Cc: Chaitanya Kulkarni , Kanchan Joshi , "axboe@kernel.dk" , "hch@lst.de" , "kbusch@kernel.org" , "io-uring@vger.kernel.org" , "linux-nvme@lists.infradead.org" , "anuj20.g@samsung.com" , "javier.gonz@samsung.com" Subject: Re: [RFC 3/3] nvme: wire up support for async passthrough Message-ID: <20210305132220.GA10000@lst.de> References: <20210302160734.99610-1-joshi.k@samsung.com> <20210302160734.99610-4-joshi.k@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Thu, Mar 04, 2021 at 04:25:41PM +0530, Kanchan Joshi wrote: > On Thu, Mar 4, 2021 at 12:22 AM Chaitanya Kulkarni > wrote: > > > > On 3/2/21 23:22, Kanchan Joshi wrote: > > > + switch (bcmd->ioctl_cmd) { > > > + case NVME_IOCTL_IO_CMD: > > > + ret = nvme_user_cmd(ns->ctrl, ns, argp, ioucmd); > > > + break; > > > + default: > > > + ret = -ENOTTY; > > > + } > > Switch for one case ? why not use if else ? > > Indeed, I should have used that. I had started off with more than one, > and retracted later. I have to say I really do like the switch for ioctl handlers, as they are designed as a multiplexer, and nothing screams multiplexer more than a switch statement.