Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp455601pxb; Wed, 3 Feb 2021 09:15:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxc6zbf1fmG0UtmC3I7/VEVLLAhJ1tMDE763FCUaBLMqvOtAc4Jt22fHIiXH+4Kv0X1AoVz X-Received: by 2002:a50:fd0b:: with SMTP id i11mr4088972eds.387.1612372538072; Wed, 03 Feb 2021 09:15:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612372538; cv=none; d=google.com; s=arc-20160816; b=BPz2IsgGBnOJc2k9aNhLt6Grr/F+QepEuMh8Kg7wNWvZTDnnHIbhl7TTB/DMsa5Jab iLmtlP0/rJUJsP4z1ebJACYK2c3PAykssbYGBmOVEgWyRpii/6y/N4OLn4aO0b+YyPJl 4BO2eZPnOETD4v3a8wgxSFMhcXK4803l3QZHjnkQ/OicAwAhQjPRtUM0yoUtuvUBKlpM ukJ4J88ot/oGmc0nSn8sT+gB5Qsf7HY8U0cayIrTV27uaV1Tdf0YV7zbmn9zy9xebPpA fWtlXBeUu+br+gUKUwYBIdEpDv0Um9vHOEG8xr6jZMBo+6sOWxRTadDtmKiOuSegmSje 8kOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TOHrz9rJRmT1MZjmRcdSp7+GuY9P+OtZtUJvbJgCulo=; b=QhG/URzm2/8B2YTrbCm4fj8JtIo+bGHuuk6MmCDLdGpfYteNrHtLhl3coPF7PNZ3oC tCbsMpo/d5xgnSjzkw/x7zO/C3ZXWIkmprASpNxYYqJSA7t/BaQJgGNHjwKj//SWttE4 2bwGcv3cqD8qOdKsxvLYDh3t9/RZWAjiy5jgY1MOvua9Sox8SE0Wpq5me9nLuVrZuKHC 2BMWMiVUKypkpqAxNoCTYKZqcgxcmOPeO6eL2fJA3OA/Mo9KIIH/JotoKEGWakRV+4lb crJnPZuECXEoEz7zdUW0VX9W8hALHs/6SXOMc6AJPhGIFq+75E7YxAIv8ZD0OU5eL3rZ uGvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QlTPVhm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hd36si1869188ejc.283.2021.02.03.09.15.10; Wed, 03 Feb 2021 09:15:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QlTPVhm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231767AbhBCRNT (ORCPT + 99 others); Wed, 3 Feb 2021 12:13:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbhBCRNM (ORCPT ); Wed, 3 Feb 2021 12:13:12 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EAD6C061573; Wed, 3 Feb 2021 09:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=TOHrz9rJRmT1MZjmRcdSp7+GuY9P+OtZtUJvbJgCulo=; b=QlTPVhm61sGQuTcf3P0iNWT8ED Bi2gkvv6DDeJQwV2HZj+zq53XZjee6QmF+jgW/E4anVOGeBwLE0OhGlE/INHWoFljCKhZx4kLuKFi vBpPlOiPaIYrUSdcPkchYs5y8EocLYDkgBQi5zK2utgiNqo1gFusaNMlddnGX4lCKct1oIiIfQN0x 4FZFsAcm9c0hrwdS+WY55lmm+xjte1BQs5jszrftBaCW8zuTfPkpbQPL1wxnyHoTRZuCOgTwdKSQC PmSjukh2Zy50HgX10fdq7MOFixROv7xKlGJkbVoqgE9rz6+csO3TxasqOuAu242s0FMgsIu5s/vvZ pnxR5IZg==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l7LhT-00HEZu-Qm; Wed, 03 Feb 2021 17:12:20 +0000 Date: Wed, 3 Feb 2021 17:12:19 +0000 From: Christoph Hellwig To: Ben Widawsky Cc: Christoph Hellwig , linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-pci@vger.kernel.org, Bjorn Helgaas , Chris Browy , Dan Williams , Ira Weiny , Jon Masters , Jonathan Cameron , Rafael Wysocki , Randy Dunlap , Vishal Verma , daniel.lll@alibaba-inc.com, "John Groves (jgroves)" , "Kelley, Sean V" Subject: Re: [PATCH 02/14] cxl/mem: Map memory device registers Message-ID: <20210203171219.GA4104698@infradead.org> References: <20210130002438.1872527-1-ben.widawsky@intel.com> <20210130002438.1872527-3-ben.widawsky@intel.com> <20210202180441.GC3708021@infradead.org> <20210202183151.7kwruvip7nshqsc4@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210202183151.7kwruvip7nshqsc4@intel.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 02, 2021 at 10:31:51AM -0800, Ben Widawsky wrote: > > > + if (reg_type == CXL_REGLOC_RBI_MEMDEV) { > > > + rc = 0; > > > + cxlm = cxl_mem_create(pdev, reg_lo, reg_hi); > > > + if (!cxlm) > > > + rc = -ENODEV; > > > + break; > > > > And given that we're going to grow more types eventually, why not start > > out with a switch here? Also why return the structure when nothing > > uses it? > > We've (Intel) already started working on the libnvdimm integration which does > change this around a bit. In order to go with what's best tested though, I've > chosen to use this as is for merge. Many different people not just in Intel > have tested these codepaths. The resulting code moves the check on register > type out of this function entirely. > > If you'd like me to make it a switch, I can, but it's going to be extracted > later anyway. This was just a suggestion. No hard feelings, it's just that the code looks a little odd to me.