From patchwork Thu Apr 4 16:59:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13618080 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC17BCD1284 for ; Thu, 4 Apr 2024 17:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5ApXAM7BFDyoAC4fHFXsrGcvLrnI0p0jGRZnN21pJ7E=; b=uQDh5PlR+byh6o +zfivowCNoi+ZGXHPf+NI8keJ6dNYx/GyAKzTspcpX0z2xr+fk+AndYpHSS6WiW9DXUr2AQloc+5U aBrdypYi5u0Idzps2lW958vRUSwhIsQkGltzcCD5x011FW4+Pwp1MUnfgPUWa2D4ep4kjX3PbNJlS aRbwcV0oVCyswySP8eYT56qb/g1zDcPXf87m1+eTUwxgiHbejUXzSbBcSeamu0n0+QJ8+Gvz1ek6W 1iGs+LNAHwIlGSQSvMm4kpGzDNLmDmCKeRIbvRawmM0aBm7OCdyMLh4ftP52txD6vSsR4ZnHvWgIf FLrxd6JBDh7qTYIlZzyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsQRx-00000003a6Z-2mW5; Thu, 04 Apr 2024 17:00:29 +0000 Received: from mgamail.intel.com ([198.175.65.12]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsQRt-00000003a4o-1u7L for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 17:00:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712250025; x=1743786025; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BC4stwRnuZ8B9nod5blwzf4F2iZ6G+Mch86v9r92YKU=; b=mGqfDqoQlM10WFxrZCFexHwQ+3ETKTREcNk1ynJya8xVyDEiv8/BOmZO PhcmK+1Lv/TxAiB7h474xSa8m/+k40+a9zrrYJh13W/4OEtd1xvC4eLZx aoMafmPimWHOkJ2VWky3kG5F+Hh0VFq0w+FZp0BH7JtFD2y5rWI+w9zV3 /RrWhuptnvkLtxZzEBkkWocrzpFHJE9kYOf0WJWFc35AGeDU44+QbY6Rr 61EQBKjwYntm4xSluZ5XlOP7GmZkC+/19owqr8NLiDkMNGkX5Ab7uWN3Y GZYrLsq0GVxWdciucgakzRYXB0F4UK2WpjGRrS8SDIwFavpqzedhX5V1r w==; X-CSE-ConnectionGUID: 66TO6u7IRi289j9l2liDsw== X-CSE-MsgGUID: +859DzN2R+6X1D9zjx7RJg== X-IronPort-AV: E=McAfee;i="6600,9927,11034"; a="18986169" X-IronPort-AV: E=Sophos;i="6.07,179,1708416000"; d="scan'208";a="18986169" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2024 10:00:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11034"; a="937086879" X-IronPort-AV: E=Sophos;i="6.07,179,1708416000"; d="scan'208";a="937086879" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 04 Apr 2024 10:00:23 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EFFC3812; Thu, 4 Apr 2024 20:00:21 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Will Deacon , Mark Rutland Subject: [PATCH v2 1/1] drivers/perf: thunderx2_pmu: Replace open coded acpi_match_acpi_device() Date: Thu, 4 Apr 2024 19:59:23 +0300 Message-ID: <20240404170016.2466898-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_100025_651518_EC4D3CF2 X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace open coded acpi_match_acpi_device() in get_tx2_pmu_type(). Signed-off-by: Andy Shevchenko --- v2: switched to acpi_match_acpi_device() which is newer API suitable for this case drivers/perf/thunderx2_pmu.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c index e16d10c763de..f03aa85072ec 100644 --- a/drivers/perf/thunderx2_pmu.c +++ b/drivers/perf/thunderx2_pmu.c @@ -504,24 +504,19 @@ static void tx2_uncore_event_update(struct perf_event *event) static enum tx2_uncore_type get_tx2_pmu_type(struct acpi_device *adev) { - int i = 0; - struct acpi_tx2_pmu_device { - __u8 id[ACPI_ID_LEN]; - enum tx2_uncore_type type; - } devices[] = { + struct acpi_device_id devices[] = { {"CAV901D", PMU_TYPE_L3C}, {"CAV901F", PMU_TYPE_DMC}, {"CAV901E", PMU_TYPE_CCPI2}, - {"", PMU_TYPE_INVALID} + {} }; + const struct acpi_device_id *id; - while (devices[i].type != PMU_TYPE_INVALID) { - if (!strcmp(acpi_device_hid(adev), devices[i].id)) - break; - i++; - } + id = acpi_match_acpi_device(devices, adev); + if (!id) + return PMU_TYPE_INVALID; - return devices[i].type; + return (enum tx2_uncore_type)id->driver_data; } static bool tx2_uncore_validate_event(struct pmu *pmu,