Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp960533rdg; Fri, 13 Oct 2023 06:29:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgI7LbkBS2k4d3g0bWE8lSBX80EwLgTPfl5eilQVkDSOAJYSve6ZJxXcB9h/8P7zKYxO7M X-Received: by 2002:a17:902:f541:b0:1c4:13cd:b85f with SMTP id h1-20020a170902f54100b001c413cdb85fmr29551093plf.5.1697203758394; Fri, 13 Oct 2023 06:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697203758; cv=none; d=google.com; s=arc-20160816; b=dtdvOPzpeyEbc5M3XCz6QueT7CegKcY8MiFnlL/co/oET+UqHt36CFRxCNvGHKluk3 YQgpnGZfuD7S4GyGw3iuV5RrU4452PD19rVRbKy19sfV9QQbVQN0bShjDcZkjUGhf+Jp jfltYUd0d5l4RYKb8wFOXac81HOYZT+nthBZKAarkcR2OJSE6EqmH/s6uIikPODzp4qa 580qh2Lv2cpcliwkGi2ozi6HvqtoD7UQhNz2H2bDRGE9GDubr5/D1IY2jCysSILodb20 Gdh03TE2dBCt6sCQkMhRNfeRfLu6qi2O4hr+7dRNDYa1O5HAagLkOL9NwMa1wBQ3rGD3 Myhw== 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; bh=6GuMc8H6N8RPh9n2FL97BjDixSz9sxvxrU/dU6FJjzs=; fh=W9rtJtCYmbC2AbDXhOLwJNF37NpGTso5C7JKv/ZwWys=; b=OEkKEOO7IQAK7I6mm55jDw7jVrh88pWrowHBEC+QfmelQ037peRWc/26JfWtADFjWh Czr1P2ZjrIagVlUoqxENhCpLQj2YgpAehPwxnCbQRTlNcPbR2uO3GzXp+VTH8Erc9ark Wsw2kg4ALpKD/6/rqPXKXBIO8fMWBv8CsCfNCNc2zqaQn03rHDHD9fVHMxq3zNqo5C32 0s8ZQkgUz43LXH4gNHAzz+wb/dkOv6tmRFxxXdI4R5tL0DiqoHuJEd+ugmCKBi1/1MGg VZ1UD2opvrHzlI0llUEYMFiSM7EkFnC5GKVuq+HCQr3SUTC9+xgsbYlTPLElsCLR9AYQ g/3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id o9-20020a170902d4c900b001c7388413besi2292310plg.529.2023.10.13.06.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 06:29:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 63EBE802843B; Fri, 13 Oct 2023 06:29:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231949AbjJMN3G (ORCPT + 99 others); Fri, 13 Oct 2023 09:29:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231823AbjJMN3F (ORCPT ); Fri, 13 Oct 2023 09:29:05 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1B6D3AD for ; Fri, 13 Oct 2023 06:29:04 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 371CA11FB; Fri, 13 Oct 2023 06:29:44 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.34.145]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE93F3F762; Fri, 13 Oct 2023 06:29:02 -0700 (PDT) Date: Fri, 13 Oct 2023 14:28:33 +0100 From: Mark Rutland To: Rob Herring Cc: Khuong Dinh , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers/perf: xgene: Use device_get_match_data() Message-ID: References: <20231009172923.2457844-14-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009172923.2457844-14-robh@kernel.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 13 Oct 2023 06:29:15 -0700 (PDT) On Mon, Oct 09, 2023 at 12:29:09PM -0500, Rob Herring wrote: > Use preferred device_get_match_data() instead of of_match_device() and > acpi_match_device() to get the driver match data. With this, adjust the > includes to explicitly include the correct headers. > > Signed-off-by: Rob Herring Acked-by: Mark Rutland I assume that Will can pick this up. Mark. > --- > drivers/perf/xgene_pmu.c | 37 +++++++++++++------------------------ > 1 file changed, 13 insertions(+), 24 deletions(-) > > diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c > index 9972bfc11a5c..7ce344248dda 100644 > --- a/drivers/perf/xgene_pmu.c > +++ b/drivers/perf/xgene_pmu.c > @@ -16,11 +16,9 @@ > #include > #include > #include > -#include > -#include > -#include > #include > #include > +#include > #include > #include > > @@ -1731,6 +1729,12 @@ static const struct xgene_pmu_data xgene_pmu_v2_data = { > .id = PCP_PMU_V2, > }; > > +#ifdef CONFIG_ACPI > +static const struct xgene_pmu_data xgene_pmu_v3_data = { > + .id = PCP_PMU_V3, > +}; > +#endif > + > static const struct xgene_pmu_ops xgene_pmu_ops = { > .mask_int = xgene_pmu_mask_int, > .unmask_int = xgene_pmu_unmask_int, > @@ -1773,9 +1777,9 @@ static const struct of_device_id xgene_pmu_of_match[] = { > MODULE_DEVICE_TABLE(of, xgene_pmu_of_match); > #ifdef CONFIG_ACPI > static const struct acpi_device_id xgene_pmu_acpi_match[] = { > - {"APMC0D5B", PCP_PMU_V1}, > - {"APMC0D5C", PCP_PMU_V2}, > - {"APMC0D83", PCP_PMU_V3}, > + {"APMC0D5B", (kernel_ulong_t)&xgene_pmu_data}, > + {"APMC0D5C", (kernel_ulong_t)&xgene_pmu_v2_data}, > + {"APMC0D83", (kernel_ulong_t)&xgene_pmu_v3_data}, > {}, > }; > MODULE_DEVICE_TABLE(acpi, xgene_pmu_acpi_match); > @@ -1831,7 +1835,6 @@ static int xgene_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node) > static int xgene_pmu_probe(struct platform_device *pdev) > { > const struct xgene_pmu_data *dev_data; > - const struct of_device_id *of_id; > struct xgene_pmu *xgene_pmu; > int irq, rc; > int version; > @@ -1850,24 +1853,10 @@ static int xgene_pmu_probe(struct platform_device *pdev) > xgene_pmu->dev = &pdev->dev; > platform_set_drvdata(pdev, xgene_pmu); > > - version = -EINVAL; > - of_id = of_match_device(xgene_pmu_of_match, &pdev->dev); > - if (of_id) { > - dev_data = (const struct xgene_pmu_data *) of_id->data; > - version = dev_data->id; > - } > - > -#ifdef CONFIG_ACPI > - if (ACPI_COMPANION(&pdev->dev)) { > - const struct acpi_device_id *acpi_id; > - > - acpi_id = acpi_match_device(xgene_pmu_acpi_match, &pdev->dev); > - if (acpi_id) > - version = (int) acpi_id->driver_data; > - } > -#endif > - if (version < 0) > + dev_data = device_get_match_data(&pdev->dev); > + if (!dev_data) > return -ENODEV; > + version = dev_data->id; > > if (version == PCP_PMU_V3) > xgene_pmu->ops = &xgene_pmu_v3_ops; > -- > 2.42.0 >