From nobody Tue Nov 26 16:33:06 2024 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2067.outbound.protection.outlook.com [40.107.212.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B7D91D89F5; Thu, 17 Oct 2024 10:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729159647; cv=fail; b=RbURD0nAlvhJiVi1tCWes9alDMnJsM4vVRa9YWLm/YuZEun+h1+RVXV5df0x2ek+dUE1HhsYPUUgAIoSRxpmD9wSvNzWIuFbUeX9vgcSmhllHYBM41ilfRme14dryVcJQeY8bQfqczUNoO8eAqbHhKtRsH1oChy9ULjDhZF9wqY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729159647; c=relaxed/simple; bh=aEyCR64eDAWG6JAglbHOR/9g4tGl7WqfkHzgL4yFnJM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ATVAb2wFYARQH8dBwuCwMXFbTWFDB17nr2AZuoDL9rqu2AIMB0uQsYdu242npwO/28b75IiDFMGfgVVfvIlUonU1dfgjzz39O6WkGiVTd4Cz8RqRLNFUxbatbRnkkJ7SjHKuOiMkQhurlMM5C6bBvzdyB4e3wfU48R20UBu7XEE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=tSiFOr8A; arc=fail smtp.client-ip=40.107.212.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="tSiFOr8A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JwQ/6v6931LLOVoenC5LJiaQ9IyCD+lpytzPuVHjnu8p/hsIUkIgmB8bEzIgfT+nmDmNwsk3stuQbYcuot3KQ9RBjzwqLVnaRm1lmxsyjkLVpsnFddHcAW5tZlk2s6P+K0hqyWsXdB08C0+9JNeS1Uc9f8zzYKLDibG08ST7QcihviKB8xpJepS3HV4/GXMM6SyF2Nx22BeiZfvCFDvIqoeyMnEv2opVtxu6WclQ9FEdH4PLtUh/32rhydjX04Y2oaxuBQC5iS+k4RO/dMp4vTuc/hMyrhetgBFgKwky3pen9jKn9i3u7oZx4tzaHx2HIWOC7uSYdl6tgObQW7Fl1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G8KQgEi9h2Fbcj/8I6vq0G04ump/+7AMYvEJ0TyYGr0=; b=ZJDEQW5vdhM31J1KBxGIAlN/xwTT/Rr+XCLNbVgDPCuqkAg98Z6+HLKJStmnlJKGLv/wvu56l3M++zToCteAIb35Q5szIyRNtd3KXqwpcXPFaDKYAcxx67AS1Drc67PwuiQDJqonVJnAJ/491fqVjGlX0VwAmoQliByrilKNd3c47SiegP271CSO0zc8h3bN/RQdQeRksGQqCzyuccxihk9PXtoPo2lV0F4vAat8NLksTB5LvjZhjrqo71Yc2/OThSLQy0l2BxG2aenHyxSB7gg9D7YTYQWPc0r50hklJ6w90IqLdShi8fZ0SfKyVO5awfcM4RyP2Newxsz3yCbYEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G8KQgEi9h2Fbcj/8I6vq0G04ump/+7AMYvEJ0TyYGr0=; b=tSiFOr8AP/nAXQJn3r0A1yfeIaGslXsucvwEtIBcRavn+GeXRFwxIpm2ZNvLX8xsU3n897Ip53JF3zfVA0zgq0hzUR1q3iHEZf+2fxP9syvbRHMu73/Kwinv2LCz/vWJdBuiBZL8GHIhaEZftVw0SJRAbhwXH+KUwXfIBOxwtoA= Received: from DS7PR05CA0048.namprd05.prod.outlook.com (2603:10b6:8:2f::19) by BL1PR12MB5755.namprd12.prod.outlook.com (2603:10b6:208:392::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 10:07:19 +0000 Received: from CY4PEPF0000EE39.namprd03.prod.outlook.com (2603:10b6:8:2f:cafe::3e) by DS7PR05CA0048.outlook.office365.com (2603:10b6:8:2f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.8 via Frontend Transport; Thu, 17 Oct 2024 10:07:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE39.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 10:07:19 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 17 Oct 2024 05:07:15 -0500 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 1/4] cpufreq/amd-pstate: Call amd_pstate_register() in amd_pstate_init() Date: Thu, 17 Oct 2024 10:05:27 +0000 Message-ID: <20241017100528.300143-2-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017100528.300143-1-Dhananjay.Ugwekar@amd.com> References: <20241017100528.300143-1-Dhananjay.Ugwekar@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE39:EE_|BL1PR12MB5755:EE_ X-MS-Office365-Filtering-Correlation-Id: e32fd990-532b-4055-18e2-08dcee937c6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?nFmPJYwmky/WWDkD3sKpZo7chRo9sOtDU0hTGWq5kC1spd5TseeORJ/lwHct?= =?us-ascii?Q?3wdOHwb5M4K7o0ppbGdoqou9YDqnfQ/L+TpCWF+3csCUTQBSTSzoC5kdG6Gq?= =?us-ascii?Q?dvN1XG8AMKNX6Xhl+fRO7pfTLRQKETiAKSBrPVVA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YoO15PmnaASOOT19F/U4/KvIHIb8HPlJ5XTAJjE5F0d7peG?= =?us-ascii?Q?XoaMwgICbCYkfJj8GP+XUX33hzM1PxDBH0sAB34oRMoCWTPtaX4vRlOjMVK4?= =?us-ascii?Q?zik1l7vIq476PvlL8SWJz30EkmZZAFonXjmRUNH5+u8rvQurtO6fKKlKTSs6?= =?us-ascii?Q?TUyYeWY4vpNgtIwpw/Uwu4dIVTjvVcT1XalZWvl89M2x6ZPAwk1pyuE8W06h?= =?us-ascii?Q?z08y7lLCl8AMlunZBdGr9SWTcx/aKPctQ15capRUG3JWkvBO9xBiyUB1zjmM?= =?us-ascii?Q?QFU3VlBWyc7+a782luy+qev+Lz2UxtMnDMSYC44FBouHokGomAITNn3R6xyP?= =?us-ascii?Q?U9nML8J36WtwRxpLJOf46nc89Cowln7MuhLYV7RbPOrvgKiEnA=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 10:07:19.2823 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e32fd990-532b-4055-18e2-08dcee937c6a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE39.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5755 Content-Type: text/plain; charset="utf-8" Replace a similar chunk of code in amd_pstate_init() with amd_pstate_register() call. Suggested-by: Mario Limonciello Signed-off-by: Dhananjay Ugwekar Reviewed-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index b0a1c472cc3b..856f0d11983e 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1879,17 +1879,10 @@ static int __init amd_pstate_init(void) return ret; } =20 - /* enable amd pstate feature */ - ret =3D amd_pstate_enable(true); - if (ret) { - pr_err("failed to enable driver mode(%d)\n", cppc_state); - return ret; - } - - ret =3D cpufreq_register_driver(current_pstate_driver); + ret =3D amd_pstate_register_driver(cppc_state); if (ret) { pr_err("failed to register with return %d\n", ret); - goto disable_driver; + return ret; } =20 dev_root =3D bus_get_dev_root(&cpu_subsys); @@ -1906,7 +1899,6 @@ static int __init amd_pstate_init(void) =20 global_attr_free: cpufreq_unregister_driver(current_pstate_driver); -disable_driver: amd_pstate_enable(false); return ret; } --=20 2.34.1 From nobody Tue Nov 26 16:33:06 2024 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2048.outbound.protection.outlook.com [40.107.237.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02BF01D89F5; Thu, 17 Oct 2024 10:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729159686; cv=fail; b=GP+n2NrVM/GDhWNqM9nke4tOxm6iBJ26riC+B2PFtW1ez9w7mvM9m2y2jLe36+7B7XCcxq55DBHEGqT8Fvly5hSdMx7jdfDjoHzlGDYODN1+7HLY81TcT7GJtjG1iijlg9IgJjTsuCV/YgNuNmLSjJWILo6rzuswLj738vORooY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729159686; c=relaxed/simple; bh=iMQ/RfFJAB6/ZPUDgvWylY6gaKv8e9GOj7JMBTpHv3I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=S92Nax61G6k2CtXhMJROozuD4lgcXXoBEQHHNdAnVUogWWSms6M9cVw8pKCY1wt4cJXs04UtzokCM7IJsQ8MguQ/se9H40fHkWD2waiDM2h26hRNtAZSi08aHwcLU8wXARhYSEvjQxpVMMy6lPzr5mn1gQwU30vACoK0P4ddFDc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=GmqPbfsm; arc=fail smtp.client-ip=40.107.237.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="GmqPbfsm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=soGfFW3Tj8eUQFG6n4ZOcNYHQ1wdKuU81UQ84LWhKrc3HIIeHWySh66/lpC6V06gOR1u2E/ZfW//rRBAlMYGmTbnCAWgBwaoXzuRDEuw2NV+0PEZhDHPWm+FV7FYWQqjz+9bfGZn2HCF3WyKgsMmL0394lPL51BlTEkUmC/G78cG1ABzVlXgf+d/ptk9DJNUVL0e6r36G2OrdQvw44EnUUnSVDAcowAe12xGG/ud4u9JshJGyOMNMKlVfx4XzMo1k11EBMlZAjMGnQU8/DFqKVdZXqpGOznxhJDEbz+oitH92TIxeM5ZK08s62+NnAPBQ5eGtrdSzMX9cKXW815c1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4MsnO0bZqP1Ofc/njtqojvZvmOXvF3Iew9Atks0Wljc=; b=I6myHGkUOdJq5JF/ZvAVzEZGW4s279nhFfo6sVnARb3CV15/sSO3nwUugi91S4HNuiLrPlBOtr0eHo+/Xs9sTAiWBWml6iO+NcfbBflzo3Wx5RX2XH9ccRpNoqvzqh2HsrKYccBTHUFPLjpdDlUpnrlPdy8k4GJy4lyVdmr4D+t16BHhMf1U4FdlQCOzgvwT4NpntHKz+Q0lTDuWK6L0oeI1+zEawwWgtmxuy/djyGB1XzxlEilHHvCms5LemcS292VvQ4j7l3Q+CAJZN2GElOTZNFrxTG/m0H/IsOCYDnBZhml14ZVDTQy2jrq/M4sWPMxE+Byc4V8lg6MwoVfehg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4MsnO0bZqP1Ofc/njtqojvZvmOXvF3Iew9Atks0Wljc=; b=GmqPbfsmLYKo/G+/mF0Vgzzc0UKh214SsRt2J+NvIWH1fcOnmwA+ye3DBMLALDyIGtPCkvR8CHZ66eh/L+tTeW4FdWUpkObftUML2LUj/jf9BUrFJeFPtQlySAmIDbLKwWbV7gbmaDWSa3iAL0kOXIPK2SFqgA9Qy9IolXMR2pA= Received: from DS7PR05CA0057.namprd05.prod.outlook.com (2603:10b6:8:2f::21) by SJ0PR12MB6735.namprd12.prod.outlook.com (2603:10b6:a03:479::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 10:07:57 +0000 Received: from CY4PEPF0000EE39.namprd03.prod.outlook.com (2603:10b6:8:2f:cafe::58) by DS7PR05CA0057.outlook.office365.com (2603:10b6:8:2f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.8 via Frontend Transport; Thu, 17 Oct 2024 10:07:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE39.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 10:07:56 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 17 Oct 2024 05:07:52 -0500 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 2/4] cpufreq/amd-pstate: Call amd_pstate_set_driver() in amd_pstate_register_driver() Date: Thu, 17 Oct 2024 10:05:29 +0000 Message-ID: <20241017100528.300143-3-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017100528.300143-1-Dhananjay.Ugwekar@amd.com> References: <20241017100528.300143-1-Dhananjay.Ugwekar@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE39:EE_|SJ0PR12MB6735:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c4b163e-0c58-4fa6-299c-08dcee9392e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?VKH/wY61W7+2vj66xsabQLXOAdE94ohOmv1ZtI+JGaGUe5haUr/W43SEsCdK?= =?us-ascii?Q?32NsyFcrbGDBYHyl3z5+8JvkraeQ0GpaxCeBtqD3pdBFwyGtvicnTz/iugbh?= =?us-ascii?Q?9xRj25bgnHS376Hpp0tB5v+YW13ANuZW2uqk+sNGCoF1qmuRb4N5/t/S3FSj?= =?us-ascii?Q?VPGoWzgaiZre0yGVvHQH1qOthVPUc1a5Pj6ZpiagUSR3uIo08l+nZ9ky1RaM?= =?us-ascii?Q?o2SyjwYm1Ms3HuSOtAQlmrHEN28TUZHW4UugIXV2szsaXH1u/XukiDTFla84?= =?us-ascii?Q?S+jXO2qqkClTks49XywTciroBg6j/UOm6n5nwTlLOKrq2m7az9qNONM87FR8?= =?us-ascii?Q?66/dX+1FJrd8Sum+dzF/IF8LiVT/UjDtrn9yj/bjy2GTVzf365ZjKBvFZj9g?= =?us-ascii?Q?pVuSbZ6tIZDxkbd7jIEWjdcBueOezvP1TZ0SekpaiwjKb/iU0oSydeBsA/YW?= =?us-ascii?Q?TA4cHUmHf3a153Nnkx2N0wD+x1bG8zrpDG5aG5sR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b0WRSub6rzHOppR0i3Oxs7npP6RwpPDmXG+wwagA=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 10:07:56.9856 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c4b163e-0c58-4fa6-299c-08dcee9392e3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE39.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6735 Content-Type: text/plain; charset="utf-8" Replace a similar chunk of code in amd_pstate_register_driver() with amd_pstate_set_driver() call. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 47 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 856f0d11983e..5155fc0019df 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1191,16 +1191,32 @@ static void amd_pstate_driver_cleanup(void) current_pstate_driver =3D NULL; } =20 +static int amd_pstate_set_driver(int mode_idx) +{ + if (mode_idx >=3D AMD_PSTATE_DISABLE && mode_idx < AMD_PSTATE_MAX) { + cppc_state =3D mode_idx; + if (cppc_state =3D=3D AMD_PSTATE_DISABLE) + pr_info("driver is explicitly disabled\n"); + + if (cppc_state =3D=3D AMD_PSTATE_ACTIVE) + current_pstate_driver =3D &amd_pstate_epp_driver; + + if (cppc_state =3D=3D AMD_PSTATE_PASSIVE || cppc_state =3D=3D AMD_PSTATE= _GUIDED) + current_pstate_driver =3D &amd_pstate_driver; + + return 0; + } + + return -EINVAL; +} + static int amd_pstate_register_driver(int mode) { int ret; =20 - if (mode =3D=3D AMD_PSTATE_PASSIVE || mode =3D=3D AMD_PSTATE_GUIDED) - current_pstate_driver =3D &amd_pstate_driver; - else if (mode =3D=3D AMD_PSTATE_ACTIVE) - current_pstate_driver =3D &amd_pstate_epp_driver; - else - return -EINVAL; + ret =3D amd_pstate_set_driver(mode); + if (ret) + return ret; =20 cppc_state =3D mode; =20 @@ -1726,25 +1742,6 @@ static struct cpufreq_driver amd_pstate_epp_driver = =3D { .attr =3D amd_pstate_epp_attr, }; =20 -static int __init amd_pstate_set_driver(int mode_idx) -{ - if (mode_idx >=3D AMD_PSTATE_DISABLE && mode_idx < AMD_PSTATE_MAX) { - cppc_state =3D mode_idx; - if (cppc_state =3D=3D AMD_PSTATE_DISABLE) - pr_info("driver is explicitly disabled\n"); - - if (cppc_state =3D=3D AMD_PSTATE_ACTIVE) - current_pstate_driver =3D &amd_pstate_epp_driver; - - if (cppc_state =3D=3D AMD_PSTATE_PASSIVE || cppc_state =3D=3D AMD_PSTATE= _GUIDED) - current_pstate_driver =3D &amd_pstate_driver; - - return 0; - } - - return -EINVAL; -} - /* * CPPC function is not supported for family ID 17H with model_ID ranging = from 0x10 to 0x2F. * show the debug message that helps to check if the CPU has CPPC support = for loading issue. --=20 2.34.1 From nobody Tue Nov 26 16:33:06 2024 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F41B01CCB44; Thu, 17 Oct 2024 10:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729159724; cv=fail; b=sg0p3XEe6N4341srTUF/kadH2fTmWQjHjndmISUdXaKIC2qvz/Er4xqlc152e/b7TH96C/fKVCB84aNDNfBsakl+gu6eEkKGpev/I616wwYEUZiKggoND586WDBhQA9cSV3ERBulwYLntuiNI0h6i2RwLFSL4WDvkVTh2UXXSsE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729159724; c=relaxed/simple; bh=3111Xd2FxX110br+W5Ji3fc3QlF4itA0K+MiSgaB+OE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WiFd4G9VnGWwV6q3LirTmlhl7bff3TWfai6XRx7l7CgY/xUufIZu44mqcY+EtBmBwKVnrHzPqZ7Sn+sJZPRbtISRjnQ/82AGHSEx3bJdASSGDGW2LzUfA3JCEOKsGtVk/99LN+gW3OMqArYJQy1E1O6Za8J8+OhZQ9HYfSxBtjA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=tLAFmmhw; arc=fail smtp.client-ip=40.107.94.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="tLAFmmhw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u7UytCfeoIwaMKY4YU1YhT99w7Z/zlEh8MNHvESpCqtWCjHAoMQSQfaC1KOCUd25IXozS1HkSAUzMUhA2ZUn+gjNJrKfbb8+Fea9oLupZ2bvNVGLfky/Ad0/6HSo2A4tUAvAumsqCDLeOB1ZcwYYcVjqwZGIP5pv3mXZ3VeVtGqU3wBlpUroTeozIJL+KcJkVquU/pNLpqitL8UcbS7/kDqZ5Fvqq5jKvwVgMbGqpXC7c+hfcB82j52OVs4l+bFxFPg7A4VRyndw6d6IqPzPQM4QOVUy4vH/oX0fmjpipMQSocM5j4HVjDpNz9TQBLG0zkp4EfrK4TTOJLBBVUuUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wX/6asCDmmCQmGx13KVZqjiUpUKq6gVhy6QbbEbRJxw=; b=jTnOpvB5P1SOOXofLh1wvJw6h2bhsFaXDi/9m8PTh/TpMokZheaO9UANikkplq5TAj1Vj4V7jM/BEWEzGsZkKh7C7nDulqQTtbWUY3MvGxRBLjPI7wdHAZF4LiwooLvHD+dPv1ChOGeBHDGHhR/1Sx89Vl+Vn7BEoRfaHUKA/+cSe0HIe/LXuHUxh9y6t7DELsX4OuWPBn1Oj6tkKrc0MzwpL7OUVifLHLcDaqNMRWPPyTH6TuaIGoBRKgAgkdYnOngQdPBUFQ0EJZB4J4r5XWvXbRICFDdOZzB+2YDqOiZ77a+XYpcKf33RRl8x3z1oRng80jAa0eD0PRrAxB38Ag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wX/6asCDmmCQmGx13KVZqjiUpUKq6gVhy6QbbEbRJxw=; b=tLAFmmhwqsC326AoxJX45wlO3Cfbq4PTH5kLahGKVUBLTjL4pHDahqHgHEaDPOuJOGU2s9NGCWNS5DcgP4qVK34Fo7MnqnTvcCdJghJAuY5x1PLAq+WfzG9cIuFm2J2aQhBKozQ2Xp8OGBUKr6GNunr1Zcse74zE5tuXezDRTis= Received: from CY5P221CA0066.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:4::43) by DM4PR12MB6349.namprd12.prod.outlook.com (2603:10b6:8:a4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 10:08:35 +0000 Received: from CY4PEPF0000EE38.namprd03.prod.outlook.com (2603:10b6:930:4:cafe::6) by CY5P221CA0066.outlook.office365.com (2603:10b6:930:4::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.20 via Frontend Transport; Thu, 17 Oct 2024 10:08:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE38.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 10:08:34 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 17 Oct 2024 05:08:31 -0500 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 3/4] cpufreq/amd-pstate: Remove the switch case in amd_pstate_init() Date: Thu, 17 Oct 2024 10:05:31 +0000 Message-ID: <20241017100528.300143-4-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017100528.300143-1-Dhananjay.Ugwekar@amd.com> References: <20241017100528.300143-1-Dhananjay.Ugwekar@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE38:EE_|DM4PR12MB6349:EE_ X-MS-Office365-Filtering-Correlation-Id: 53d33908-30a8-4a34-f8fc-08dcee93a958 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?lXrjIfv8s3Llmk2zx4bCD6ztFvUg72pIIUjeE1fsUe4ndziIbjy7SQp/rwWz?= =?us-ascii?Q?wOj3Wtr4fXUkN3inB6UsMxVFippwG9C7KWUsjNfKYKlg+X8/YJtWa7+9OkQD?= =?us-ascii?Q?1OOdBjXL/QMGZH+igtLSzrp/+pXhfkc0o4QigrJyYvLeRiLf3Aa79dbuAoah?= =?us-ascii?Q?BMbT+JHPT7QoCBGAs0516hwHFWuW4MwymVKZMvWfsyz0q6+SvuHMt3xNS0nP?= =?us-ascii?Q?lCb09i5cwIRBLvOi5YCmsFDp17U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ii?Q?tG/Nud3vM8fKou5a3fArX9IKnvpknaW4LDkB/PKPTPP0CBu8Qn5Z1/gC+BSK?= =?us-ascii?Q?dQHYjEMISzsaEtVXRmEYQxHKCajg4ijJHieCehdJsmF/EVHR4ToJsFLbGzBA?= =?us-ascii?Q?BThIR3AEJZGl1IckxCDIR8cgTU5nnCCJQlzRsdD1R4u5B4TIp/IDQyAd7QEV?= =?us-ascii?Q?D5FKda9FfWy44/G5IKwBKjSMclOkPGZiU0X8avrkUV60n3LYSaH7OZ4bqkev?= =?us-ascii?Q?+1vLLh5/nKa3E2PNHw4xn16QMEKx6TOw1UCLnpamtS5pajEXlw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 10:08:34.6988 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53d33908-30a8-4a34-f8fc-08dcee93a958 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE38.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6349 Content-Type: text/plain; charset="utf-8" Replace the switch case with a more readable if condition. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 5155fc0019df..13ee5cac901d 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1843,21 +1843,15 @@ static int __init amd_pstate_init(void) cppc_state =3D CONFIG_X86_AMD_PSTATE_DEFAULT_MODE; } =20 - switch (cppc_state) { - case AMD_PSTATE_DISABLE: + if (cppc_state =3D=3D AMD_PSTATE_DISABLE) { pr_info("driver load is disabled, boot with specific mode to enable this= \n"); return -ENODEV; - case AMD_PSTATE_PASSIVE: - case AMD_PSTATE_ACTIVE: - case AMD_PSTATE_GUIDED: - ret =3D amd_pstate_set_driver(cppc_state); - if (ret) - return ret; - break; - default: - return -EINVAL; } =20 + ret =3D amd_pstate_set_driver(cppc_state); + if (ret) + return ret; + /* capability check */ if (cpu_feature_enabled(X86_FEATURE_CPPC)) { pr_debug("AMD CPPC MSR based functionality is supported\n"); --=20 2.34.1 From nobody Tue Nov 26 16:33:06 2024 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2086.outbound.protection.outlook.com [40.107.237.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDEEE79FD; Thu, 17 Oct 2024 10:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729159771; cv=fail; b=iWDM+1ujMuMm65hgyRKfFRTvL67hADWUbCemLw9PNb3wgevsEqolWNXsXiT8Q2jnNib6OnTKApAzT2Ok6M1iQVY0s3avMamLhrfZt+aKygE8H1CKgzXfY1rEXIZw6Om9Oe7uNeDTPw3khcaSxm6lT3W2rjldd5cFlE0B4mX4Axw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729159771; c=relaxed/simple; bh=/nuaUoMskNbrRQLWZycWtEOezRWPa28W9kBl6b1PIsw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NvC3w9e+0PTRtpKmpvwyU1Z/eLIbc6D+EHRIM1E7GFbuegiLFozXoELs61qgVHh4xmnueAK/6YNt/HaFGI/iQ50teprhlmS/ElwD/zBKDaE2/d/fMQTAaIVCL/n+aCCf3bTX7KfEumWPhKN70j4RjqXDG0ghcYX1+1XflqTj+8s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=0ZnRC/Tv; arc=fail smtp.client-ip=40.107.237.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="0ZnRC/Tv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tPUbzu/bWBU9DuO1GzsjQpn/lVgjiMJN/2m78qqd5+sqcJTgvXu1zQZuHFEeU6JrcVhAj6ljedmSRumb79EzWJWxftORxqt/CP2pDfZYzF2TKoGS4mKGIR8PZbYtowlyiPGtoQxm0Hbsr23b7sCVqWohHLO3Kigluw9uiyAjg4ielGx0AvV9havIau7AmBOGVpBtUKL9KNn3ghwCJysoBolQTm6bKRfkSAmtcb8SLfx/Fly0eDvQgucBIi3RYO65mOYVHD74VwYoDABA12uWk61U3Yj6ILuZkssQhIQog4nJnkV2nhdKblet78YQOfH+3nHwiqtvxnv0biDeH/IMTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QduDCaOD2bqDylcRhEFSnNr/GBlo5ezbhSFw0ZCMZ6I=; b=gspEDYCabqGd38PSVVgpA0loEVDmbYqWGLJ4zUBcm8uOuO3Vp1fCOszC5766J1lzhOvRLsDuAPVv8LJvnRgmLZnIXz3jh/vrMjj+2OxG913TG0RfKHUzZklBa3j+dc8ujn25mzSHTSDOrMIEnqEp5EP3gQg19TQ5qXt6P9b3r5ijmYxPk02gEWFDD9iptKq5DkTJLazN/F8uWD/IgvqQcdkG35h6I09FhzY6mV7y3PIsLBNsYjkSTJSOWGJ6m3qrKMuQVLm0/9eTBo+EYZYvkpboNc9bRWCmZY2191JcM4xFCJVw3oiF9fUIktff2VUaznFTzFXjAJ5aolFAfPZ2Dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QduDCaOD2bqDylcRhEFSnNr/GBlo5ezbhSFw0ZCMZ6I=; b=0ZnRC/TvhPN+58+pf1w3pImsxnZxuDYf22IAzO8weCW+CvI5yoQu5gmRmwxDgq1PPVtEmuJp3hsHsjtxWol5vzEWvBDLaH8EYf/011EGJc4iYB6DLJAWUrg2er5l64p3OfH0AO0iVXwAHSIVYgLD0bu42NJFV+sSzKvihNsiBtg= Received: from PH7P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:326::10) by CY5PR12MB6430.namprd12.prod.outlook.com (2603:10b6:930:3a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 10:09:25 +0000 Received: from CY4PEPF0000EE3E.namprd03.prod.outlook.com (2603:10b6:510:326:cafe::2e) by PH7P220CA0023.outlook.office365.com (2603:10b6:510:326::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18 via Frontend Transport; Thu, 17 Oct 2024 10:09:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3E.mail.protection.outlook.com (10.167.242.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 10:09:25 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 17 Oct 2024 05:09:21 -0500 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 4/4] cpufreq/amd-pstate: Remove the redundant amd_pstate_set_driver() call Date: Thu, 17 Oct 2024 10:05:33 +0000 Message-ID: <20241017100528.300143-5-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017100528.300143-1-Dhananjay.Ugwekar@amd.com> References: <20241017100528.300143-1-Dhananjay.Ugwekar@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3E:EE_|CY5PR12MB6430:EE_ X-MS-Office365-Filtering-Correlation-Id: c661a197-1843-429f-86c0-08dcee93c77d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?dDm7EPigEf7Sfc5fX6f6G76gvXOFELlXoEEIpnVQo7qS4EFSa9bGada+pPgQ?= =?us-ascii?Q?ijSgWmDwC2IwZFPU/luYyY6bhhvnKjZo8HZuDw4x+8ANFvwyfR+t+Y6zY9HI?= =?us-ascii?Q?jQEqDPAr9vL1Vz4JFJ3Fc6ZKWG0hLtLvHn3lIaBn4p0u0P/J9q8M2KJTAQ8y?= =?us-ascii?Q?ddXFnthN/CU0XbJ9DJabzjWNSFZJNao1qm6ozL8q6nEMrjwNAquUPXczPpb9?= =?us-ascii?Q?l9dTL58n0OuMuQ4lDfdc+a734Ix8YSQZQO9FgUE2PJYgbTLxwG7uZ5IxnlM/?= =?us-ascii?Q?bmsDsgRqHSK+dG1iTx/diwbRFahda/yNiqHDDfAm8dCTJTCNNlWdJIbi4I9c?= =?us-ascii?Q?OZebGDhyCEBUeJsqVIISvUWLqwDhrZ0dpu5u+5tPq+/NnnEUwELl+H4mHSZJ?= =?us-ascii?Q?ry4Gf/Vx02l9BN0oZ4BEPnb/8Ts+Jd7EbGloFuXraF7Y7imvg1PWx3RlFXEp?= =?us-ascii?Q?IUpRMJm23K5zj7CucdCsTd5uv2ucdFtnsXxuu8xlpqZDwQkTHLyFnDP60DUF?= =?us-ascii?Q?9lNMUt14Fh9sDM/Yes1sylxuisWZqIEph4sMgM04zmf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165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 10:09:25.2388 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c661a197-1843-429f-86c0-08dcee93c77d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE3E.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6430 Content-Type: text/plain; charset="utf-8" amd_pstate_set_driver() is called twice, once in amd_pstate_init() and once as part of amd_pstate_register_driver(). Move around code and eliminate the redundancy. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Mario Limonciello Tested-by: Klara Modin --- drivers/cpufreq/amd-pstate.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 13ee5cac901d..6f6d961879cc 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1848,9 +1848,11 @@ static int __init amd_pstate_init(void) return -ENODEV; } =20 - ret =3D amd_pstate_set_driver(cppc_state); - if (ret) + ret =3D amd_pstate_register_driver(cppc_state); + if (ret) { + pr_err("failed to register with return %d\n", ret); return ret; + } =20 /* capability check */ if (cpu_feature_enabled(X86_FEATURE_CPPC)) { @@ -1870,12 +1872,6 @@ static int __init amd_pstate_init(void) return ret; } =20 - ret =3D amd_pstate_register_driver(cppc_state); - if (ret) { - pr_err("failed to register with return %d\n", ret); - return ret; - } - dev_root =3D bus_get_dev_root(&cpu_subsys); if (dev_root) { ret =3D sysfs_create_group(&dev_root->kobj, &amd_pstate_global_attr_grou= p); --=20 2.34.1