Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp720665pxb; Tue, 2 Feb 2021 16:39:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXrUm0JYj/bXl/zxf5PL8O0G0xtYoMIMsCk5UcqO9Z9C9exjkhzgS/KLnmmJF5GWANEqh3 X-Received: by 2002:a17:906:4451:: with SMTP id i17mr560694ejp.436.1612312763174; Tue, 02 Feb 2021 16:39:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612312763; cv=none; d=google.com; s=arc-20160816; b=hU02/fjNdznD3VQjLwv2PAxijc4uuPGuDlo7LdhC4zFHtUkttxtVL+AqyqBhL75rLE UqTC/KXBEOyS0JNErG5IyazqQ6Gw4GQAUkU2mg3cxLw9/I6dv4puXTLbqR/9Ur50cBZH RbS6n/PQBG7TRPGYPe6jDbGqiK6Qekbsxs9hn4yhZL/lyaDNlR6NOh0jZZQj6JsvscEW xfU95pc1RoJTFHf1iVae5+coMPE4l6l1VRCX4kJDDQwD4xko7JAK20SnJZW3tqMBX8K+ WLkPfRTvqQu6pwnKrc1AHxTnwuVPFkW3aVyTIqxS6PwVkU7VvGTzcpBkMIP/H+n1xOvS ewHg== 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:ironport-sdr :ironport-sdr; bh=bM8VYNB76lbNyG0mMyTu7fTMGzLQOEqQgRz7heGfxAw=; b=OTWlxAxR7kzl/JCfDxlsjw5NQHOArnn8cx1qy0ohI4Dw0y1lVMSXjS8LcZagJ44VvW yYb3B6QYhkYJ5cyfdFkCjRWEgUrjq86aHTyDj8yKMrUPY8OVTCw42KINmCWjYJpTyl9c V+vAqe4Q1ao6JLn23utHUQK3ZYjEo0gOUoI408ZRWO7xXKA3os8/QwBrrmvQ52uzU5+4 kU+2Hd7g++G12nRLKq+/EP5cuebPiezOSxTzstdqmugKehwN8yCnIujXjFjp9GohoJ/P MAHk1xr5g2L+U7GhKsVasiSlD6/EdrcQWAxfy9KTQo3UXJ8qiQ+KLrcTc7DU0ZFSFY8f Z56A== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si292899ejy.32.2021.02.02.16.38.58; Tue, 02 Feb 2021 16:39:23 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238778AbhBBSfN (ORCPT + 99 others); Tue, 2 Feb 2021 13:35:13 -0500 Received: from mga07.intel.com ([134.134.136.100]:28947 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238679AbhBBScn (ORCPT ); Tue, 2 Feb 2021 13:32:43 -0500 IronPort-SDR: RA6xi+MQ8ULlDIniSoiye50tp/BuI5+NL0wbtnNh6ad72lCrNzXk/aIsfyyD95osLVQQ2J8L7d r/3r7TpDQjxA== X-IronPort-AV: E=McAfee;i="6000,8403,9883"; a="244987727" X-IronPort-AV: E=Sophos;i="5.79,396,1602572400"; d="scan'208";a="244987727" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 10:32:00 -0800 IronPort-SDR: Lb8WyJ3EBTlCkfAzdn8o0ZDcIwM2VGbNL4/5mCrYT0bo92LlqD2tsPvRKRk2ya41RqW1n2nOyQ Giaz8SfgDgSA== X-IronPort-AV: E=Sophos;i="5.79,396,1602572400"; d="scan'208";a="582135589" Received: from joship1x-mobl1.amr.corp.intel.com (HELO intel.com) ([10.252.131.202]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 10:31:53 -0800 Date: Tue, 2 Feb 2021 10:31:51 -0800 From: Ben Widawsky To: Christoph Hellwig 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 , 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: <20210202183151.7kwruvip7nshqsc4@intel.com> References: <20210130002438.1872527-1-ben.widawsky@intel.com> <20210130002438.1872527-3-ben.widawsky@intel.com> <20210202180441.GC3708021@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210202180441.GC3708021@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21-02-02 18:04:41, Christoph Hellwig wrote: > 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. > As this is an initial driver, there's obviously no functional/regression testing value in separating the patches. This was the way we brought up the driver and how we verified functionality incrementally. I see value in both capturing that in the history, as well as making review a bit easier (which apparently failed for you). > > + * 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. > I agree, I'll change this. > > + 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.