Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1489726pxb; Wed, 10 Feb 2021 09:27:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdKgIy9YcaitKw2corz2wVacJFdAA8KdziAz/bi+IglCXSUBVTdzD8GiFf16hbSkvcZRtu X-Received: by 2002:a17:906:da0b:: with SMTP id fi11mr4041398ejb.392.1612978039311; Wed, 10 Feb 2021 09:27:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612978039; cv=none; d=google.com; s=arc-20160816; b=ETbelxAkma+ThDTVwYVbGYoNGTVOq8VFlD/apdEtRb5FnAZfHbMkqxCm+wUkK+HAD4 cRIOEYCSXkniT2lBCnM7j5UdOHboUNK42nXTYnfpOiAlk+Cc6gE1FDWid1KfxTfn3YlT EL9TYQLqNHJgCP+4vvPNY/vH9k7sbZV6tHj3V59B7+BRKRxnD4+dF1rwv6No7XgCqO2l 3gmwetfkIm6q0cxd743mP2vwMsos91nsaJFKmH9oatNxsdEBroiSzXnWRO+xRHbLUgWa p5LeVPm+9/De65bUMnWfOXAAt7J60v2tHZTSP71Ai7RMamaGbeGb4Ji7DeafasOpYRpx laUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=MsLI/ZkxOnzWmYTzgsvSmeyGk8WFfNeUx+zFaTG0rj0=; b=G3OHTbz4tAceloWwXntYMky4mWwxoy/GVajRUOqVkOaNRyeh2Yry0CojAETzlaKKGT e4y7b25+r+o4YyhOxntyiLHfESrnFFL4LnI6SI5lwLTsSdfGugcAUSTHbCGnsm/G2Veb 8wYSdHcW3iNhl0g56rXUIYmwGZw8IGrm2JegR5b24a7rWwFdK69Uu/2lCAA+YgaP++Ol fpiI/IfIVo+Uv37kLJh7y7Tmmb3NIDuzOJ+ctKdq2fgirZJdHWK/x9FcvjjVvxKyQGjj zW73YbRkB2fH/iLAVSiW4rzd9VR8VvZvK4xQXbxD8Tb5XAy89w0fTnVwTlBsG4WMXOyw xM3A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si1669577ejr.303.2021.02.10.09.26.55; Wed, 10 Feb 2021 09:27:19 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232085AbhBJRY6 (ORCPT + 99 others); Wed, 10 Feb 2021 12:24:58 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:2536 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbhBJRYw (ORCPT ); Wed, 10 Feb 2021 12:24:52 -0500 Received: from fraeml708-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4DbRK86P3Bz67mKc; Thu, 11 Feb 2021 01:17:32 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml708-chm.china.huawei.com (10.206.15.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 10 Feb 2021 18:24:08 +0100 Received: from localhost (10.47.67.2) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 10 Feb 2021 17:24:07 +0000 Date: Wed, 10 Feb 2021 17:23:07 +0000 From: Jonathan Cameron To: Ben Widawsky CC: , , , , , Bjorn Helgaas , "Chris Browy" , Christoph Hellwig , "Dan Williams" , David Hildenbrand , David Rientjes , Ira Weiny , "Jon Masters" , Rafael Wysocki , Randy Dunlap , Vishal Verma , "John Groves (jgroves)" , "Kelley, Sean V" , Jonathan Corbet , Dave Jiang Subject: Re: [PATCH v2 1/8] cxl/mem: Introduce a driver for CXL-2.0-Type-3 endpoints Message-ID: <20210210172307.000020d5@Huawei.com> In-Reply-To: <20210210171220.67bncvfxqwg5wtu4@intel.com> References: <20210210000259.635748-1-ben.widawsky@intel.com> <20210210000259.635748-2-ben.widawsky@intel.com> <20210210161707.000073ab@Huawei.com> <20210210171220.67bncvfxqwg5wtu4@intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.67.2] X-ClientProxiedBy: lhreml725-chm.china.huawei.com (10.201.108.76) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 10 Feb 2021 09:12:20 -0800 Ben Widawsky wrote: ... > > > +} > > > + > > > +static int cxl_mem_probe(struct pci_dev *pdev, const struct pci_device_id *id) > > > +{ > > > + struct device *dev = &pdev->dev; > > > + int regloc; > > > + > > > + regloc = cxl_mem_dvsec(pdev, PCI_DVSEC_ID_CXL_REGLOC_OFFSET); > > > + if (!regloc) { > > > + dev_err(dev, "register location dvsec not found\n"); > > > + return -ENXIO; > > > + } > > > + > > > + return 0; > > > +} > > > + > > > +static const struct pci_device_id cxl_mem_pci_tbl[] = { > > > + /* PCI class code for CXL.mem Type-3 Devices */ > > > + { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, > > > + PCI_CLASS_MEMORY_CXL << 8 | CXL_MEMORY_PROGIF, 0xffffff, 0 }, > > > > Having looked at this and thought 'thats a bit tricky to check' > > I did a quick grep and seems the kernel is split between this approach > > and people going with the mor readable c99 style initiators > > .class = .. etc > > > > Personally I'd find the c99 approach easier to read. > > > > Well, it's Dan's patch, but I did modify this last. I took a look around, and > the best fit seems to me seems to be: > - { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, > - PCI_CLASS_MEMORY_CXL << 8 | CXL_MEMORY_PROGIF, 0xffffff, 0 }, > + { PCI_DEVICE_CLASS((PCI_CLASS_MEMORY_CXL << 8 | CXL_MEMORY_PROGIF), ~0)}, > > That work for you? > Yes that's definitely nicer.