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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 506C5C4321E for ; Fri, 2 Dec 2022 15:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231518AbiLBP6w (ORCPT ); Fri, 2 Dec 2022 10:58:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233839AbiLBP6f (ORCPT ); Fri, 2 Dec 2022 10:58:35 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B5399856A for ; Fri, 2 Dec 2022 07:58:33 -0800 (PST) Received: from frapeml100007.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NNyFj2yL0z67njv; Fri, 2 Dec 2022 23:55:21 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by frapeml100007.china.huawei.com (7.182.85.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 2 Dec 2022 16:58:30 +0100 Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 2 Dec 2022 15:58:30 +0000 Date: Fri, 2 Dec 2022 15:58:29 +0000 From: Jonathan Cameron To: Dan Williams CC: , Alison Schofield , Robert Richter , , , , Subject: Re: [PATCH v6 06/12] tools/testing/cxl: Make mock CEDT parsing more robust Message-ID: <20221202155829.0000332c@Huawei.com> In-Reply-To: <166993043433.1882361.17651413716599606118.stgit@dwillia2-xfh.jf.intel.com> References: <166993040066.1882361.5484659873467120859.stgit@dwillia2-xfh.jf.intel.com> <166993043433.1882361.17651413716599606118.stgit@dwillia2-xfh.jf.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org On Thu, 01 Dec 2022 13:33:54 -0800 Dan Williams wrote: > Accept any cxl_test topology device as the first argument in > cxl_chbs_context. > > This is in preparation for reworking the detection of the component > registers across VH and RCH topologies. Move > mock_acpi_table_parse_cedt() beneath the definition of is_mock_port() > and use is_mock_port() instead of the explicit mock cxl_acpi device > check. > > Acked-by: Alison Schofield > Reviewed-by: Robert Richter > Signed-off-by: Dan Williams A comment inline on possible improvement elsewhere, but otherwise seems fine. Reviewed-by: Jonathan Cameron > --- > tools/testing/cxl/test/cxl.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c > index facfcd11cb67..8acf52b7dab2 100644 > --- a/tools/testing/cxl/test/cxl.c > +++ b/tools/testing/cxl/test/cxl.c > @@ -320,10 +320,12 @@ static int populate_cedt(void) > return 0; > } > > +static bool is_mock_port(struct device *dev); > + > /* > - * WARNING, this hack assumes the format of 'struct > - * cxl_cfmws_context' and 'struct cxl_chbs_context' share the property that > - * the first struct member is the device being probed by the cxl_acpi > + * WARNING, this hack assumes the format of 'struct cxl_cfmws_context' > + * and 'struct cxl_chbs_context' share the property that the first > + * struct member is cxl_test device being probed by the cxl_acpi > * driver. Side note, but that requirement would be useful to add to the two struct definitions so that we don't change those in future without knowing we need to rethink this! Beyond that dark mutterings about reformatting lines above the change made and hence making this patch noisier than it needs to be... > */ > struct cxl_cedt_context { > @@ -340,7 +342,7 @@ static int mock_acpi_table_parse_cedt(enum acpi_cedt_type id, > unsigned long end; > int i; > > - if (dev != &cxl_acpi->dev) > + if (!is_mock_port(dev) && !is_mock_dev(dev)) > return acpi_table_parse_cedt(id, handler_arg, arg); > > if (id == ACPI_CEDT_TYPE_CHBS) >