Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp717971pxb; Tue, 2 Feb 2021 16:34:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwd3OjYlFp0ljiZGL8cFVhIKIwzisI93kg99zJaDb3CTkkFIl6bsfo42wAs4U216/9wEmAS X-Received: by 2002:a17:906:84d7:: with SMTP id f23mr591516ejy.87.1612312448666; Tue, 02 Feb 2021 16:34:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612312448; cv=none; d=google.com; s=arc-20160816; b=zuCMFboicqbzKoyI4pLs1C1FAxHS4m/uEoOy1MDFYBEaqYLUkk/bbkE16YT9oe3WBy 86IUW/1REI35kylOpiRQ0zCJ6ZItytw9MLolGcPZIJcqPsNe11oap4TVNUhbGZGicS3c 2jkyN/x239M0CmM95giI+dYSyrPfKYAyPqOsVnCa30SXnUqQSNqOoxzd+pwxgj8xtBv6 hoW131TL578EVuqplD4jfSgEli5spHAQJjYZ18IORvm+32HDouL22XQCtRsCYJF/V1A0 AygQVP9TgRMLhP3P3zfHiYDiNa/0V5qd/2cy+WEqtwW3VUyUSqS2ISgZVhNyNmsnc6Hy IcGg== 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=VyJH7voCGDtQQt4w1TbeXtHjXIusss7wUzDWNNwmpGk=; b=T0r1z8+EDKmuvlCCaYpSZ6eK0ST2SeyQ72B+Iqz7R0HRsuGLVIJCfzO615V6s0aCOi DcR9SNJWZBOOo/Vre2zaQ+IQUqW5dixqFKgQ2mxgT1WBuJx4pqIVw4M09S1ob9Am5vTs 1T4mgAu1DtHUvYaIZoYPDVLG5VqT+4VDINkUl+FOAullBe0noseoNx0V0V5jGOBVp46G zWvIs6XrEUzRPX9OF4tlNpQsBlqhcR1c3Vo/kt0rJAoh5OphAEhsODeAgKmE4kqLfoGu s3IsfjkqJpPQVcG8tJ2ctucQmaZJK6/esYmr6u8WKcZ5FqsfWGlCDZ9ohcJXDVWyac8a 1/kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=IOskqQIC; 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 s1si269071ejq.292.2021.02.02.16.33.21; Tue, 02 Feb 2021 16:34:08 -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=IOskqQIC; 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 S238169AbhBBSIB (ORCPT + 99 others); Tue, 2 Feb 2021 13:08:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237698AbhBBSFd (ORCPT ); Tue, 2 Feb 2021 13:05:33 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CF04C0613D6; Tue, 2 Feb 2021 10:04:53 -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=VyJH7voCGDtQQt4w1TbeXtHjXIusss7wUzDWNNwmpGk=; b=IOskqQICKJhmHUYSyZ0bIKcxSC YD51DXLjngLcDn194FfQCXJv9zvz5Jxh4are/lj4k24Adh+aXRs/U+3tV373RLw3lyzqN4rFS5I3a prGYth3McC/q8/tJbuE/nKVCBde40lMicMbqrztzsBqgb/xoONwYRLFcn0+j5LomiLLV++NPWtRRo dThWOChcYBPEEyy6nLAKIaVyzDDuTQu9qQRXYJc3dEY1uPo7IeCZrTIxtY6DignbximVToZEx6gEX 04yp/33EIyC9HfZI7lT0h2jKgmq6kV4Y7b8rdFdpsW7R2ayBfvIUfsfS/tcSQskmt2jIJvxsFztDl Ee5uLZMg==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l702b-00FZAZ-K5; Tue, 02 Feb 2021 18:04:42 +0000 Date: Tue, 2 Feb 2021 18:04:41 +0000 From: Christoph Hellwig To: Ben Widawsky Cc: 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 , Christoph Hellwig , 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: <20210202180441.GC3708021@infradead.org> References: <20210130002438.1872527-1-ben.widawsky@intel.com> <20210130002438.1872527-3-ben.widawsky@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210130002438.1872527-3-ben.widawsky@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 Any reason not to merge a bunch of patches? Both this one and the previous one are rather useless on their own, making review harder than necessary. > + * cxl_mem_create() - Create a new &struct cxl_mem. > + * @pdev: The pci device associated with the new &struct cxl_mem. > + * @reg_lo: Lower 32b of the register locator > + * @reg_hi: Upper 32b of the register locator. > + * > + * Return: The new &struct cxl_mem on success, NULL on failure. > + * > + * Map the BAR for a CXL memory device. This BAR has the memory device's > + * registers for the device as specified in CXL specification. > + */ A lot of text with almost no value over just reading the function. What's that fetish with kerneldoc comments for trivial static functions? > + reg_type = > + (reg_lo >> CXL_REGLOC_RBI_SHIFT) & CXL_REGLOC_RBI_MASK; OTOH this screams for a helper that would make the code a lot more self documenting. > + 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?