Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2043594rdb; Mon, 9 Oct 2023 10:33:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFECd6O6bWLfPHVG49CS3fWumksmyLD4XMNIGX8RWmzEPIyROx3LAXhkCZMw0yq4uMX1N8W X-Received: by 2002:a17:902:da88:b0:1c3:ed30:ce0a with SMTP id j8-20020a170902da8800b001c3ed30ce0amr20938759plx.19.1696872809901; Mon, 09 Oct 2023 10:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696872809; cv=none; d=google.com; s=arc-20160816; b=oQEoRpAS8l+jBSbn7tOgB3SvznRoPf9TcHGQZzz3eMvikVnN8xRNjYB5aJ+LPGNjD+ qoC+MFB93OlAoshIL/frRUSjnheVy0eS0hwVxCwcE289mcrrkOYIFw1L/d1Fmp+93atc HVRZnQ0KR4hsKhK+OYPZltilna9gNMgEWxky1HFP/PvL5lejET8kBojbrgP/Ga2BmM0j 1HlYZUTHaXunhWd7dgsVPpTsAgERJ9B5tNVCtN7C9cnjxTdwcbc738AyqpdkJcTPaOTU kpJjFZmBhBxVIc5mAS2e7Baba7w/OG30lBvSOmrwdbIwgGLolBGZVdPvMj1GPNSWP6Yo jjJA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=2NJktkE41x+KMwcUNGL/1eXTmHb86pKdR3zMvoFJ4WE=; fh=+XA+g/6M+wpYIqKIjWzngQgMEFuooFWCZl4spgBhuII=; b=LJloGtPDgALK1Bu/r1lisod8vwX+Rc4PTWrljHYOW33MhZER4OoIxM10cU1CYKCjRv S//jNBbgcPqKvX8TZIk4skORydF3XAJDymS3oOxE7sWE/BSxU+fJJ8lJFeRIkZrm8voy glYYe4alm9BdMHQAMOl4lckLkOQfOYNSpQTh8HSSLHRHLHX+U4RTNDY2ayEzZ6SuKBr3 Z6gfDGwIzeWhlYYYYNxH7Ojhr01UbsFFauoN4XJ+ineYlTmbf0VKCZQ+UPf7omBreUy4 2dYcwVmzS4Elm4Ljrzq26sdPeapuTc2xDZMX/vdMYE/NndI1Y7R1HcWZYtqn6o3lKvmg pc+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kIFdLJ8y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f16-20020a170902ce9000b001beef8ccd05si10609689plg.489.2023.10.09.10.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kIFdLJ8y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id AD27581C8092; Mon, 9 Oct 2023 10:33:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377869AbjJIRcu (ORCPT + 99 others); Mon, 9 Oct 2023 13:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377985AbjJIRch (ORCPT ); Mon, 9 Oct 2023 13:32:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 241CBDA for ; Mon, 9 Oct 2023 10:32:31 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02AC6C433C8; Mon, 9 Oct 2023 17:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696872751; bh=CZdCFg11N/zBqMQWFE5ZUMyNjYxDelPKhHZLSs4IVs4=; h=From:To:Cc:Subject:Date:From; b=kIFdLJ8yXsE71IACu88BR6lk6dguuyvgahZ9KcbbkAajShZk8c4YYOoHOIbDNxH+K tYNk55pqMaxVEjeHTRdn62O1hVNO8gFAfffb7rGJs9MlYXe88AwUpOVW3sDvsYp1jd L6LdJZyaikFRsRygzPn7zb55q6MRXrL7dvBx6q8aNelrr84yx0DQ0Q8wcdze5igO6y jFAFHozwAYU02C6qOmH0QycVi/xxK+JnHvbwzGILRNrjPToFOIGeeA+gKVQh4by8Bz C3o9jPFGYWWNrQoZG1qDqRL5oDUWiy3dkIG+p4DMl7qjY6VovGGX64TRfL+cKX3RPq 2YHKx9JbRPYLQ== Received: (nullmailer pid 2527181 invoked by uid 1000); Mon, 09 Oct 2023 17:32:29 -0000 From: Rob Herring To: Khuong Dinh , Will Deacon , Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/perf: xgene: Use device_get_match_data() Date: Mon, 9 Oct 2023 12:29:09 -0500 Message-ID: <20231009172923.2457844-14-robh@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Mon, 09 Oct 2023 10:33:18 -0700 (PDT) X-Spam-Level: ** 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 --- 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