From patchwork Thu Oct 17 10:05:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 13839790 X-Patchwork-Delegate: mario.limonciello@amd.com 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-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: nFmPJYwmky/WWDkD3sKpZo7chRo9sOtDU0hTGWq5kC1spd5TseeORJ/lwHct3wdOHwb5M4K7o0ppbGdoqou9YDqnfQ/L+TpCWF+3csCUTQBSTSzoC5kdG6GqdvN1XG8AMKNX6Xhl+fRO7pfTLRQKETiAKSBrPVVAy2x1ifoU1R/sZCBPMZ7M4NdgUty9Uk+7rZPUvBohC5DkS5X/7WOXVzLl+60tK0TwcdgcAdUO6FdYw9on8wfzpRITzlPl8ybQRLfd4ZzeqMm7oP9AheiN/6KiLR2ZU38N9wC09mOBpE0k4SlOrxbIIlR99bzRkmnZfC6qALu7MYnrazheQj98vbiNqsvUqoyWfSOibGdjrc5nzhfEorZrEy17BMioL/34Hv0KHj7X/jvDGiLpBq4hZqsveuhhMc2zmat0+TV5t/MMmeQPyshgn8SgSG289GdjuTbDfNaVsUStWXXn6EJqaL8PNTnUH7I8O2n0GMEGFUQZUAjuNC3M1NNPv9QhzfK3BA/ZYGRxfRQzQfJEHtTs60TM+6/ABfnK0skdzN3QGcESoFU1N1V0UV0LRPsTZlt6LIFJxeYXrvpyMM56JPcaN2hAj9dxZdgglJ8TybglIdU5mVFk8Mt6C6UrTNU8xGqFmOqivc7zLqsdevTMRsJpqKb9SWzgqpX8HkJGx8IRJsIQHs6wrWpKUyaskj+jHDk1eip8vJONLa6rB7MPqDRaiYoPUuDFxDZefMMR6yNhZL7H78ho7gFJs4lXSmqzO5LMH8lVj+jMdvNGnHs2b4iJz3QQP/Gpm7sgv9eizCxXKUylm7bKjpQZQbmMADkT2VwAONH0o6y4o5hz/JZqrAOPbGVmKiMaoy32OjZmJQXQSAYofyz5uS+1XTNpcU8ZokzTChgHGetyMo4nmSB2dEnMffSgGBZ3kXdjpi84bIV8jUiO4FiMVD+Lfa/ZMTf75ruSX0mFeFi0u/wLbslprRAjQLTIKni246IrD8gZInnizP9Bqh6jKB6OAwi/UUypKIx6z31sh6jCsYoO15PmnaASOOT19F/U4/KvIHIb8HPlJ5XTAJjE5F0d7peGXoaMwgICbCYkfJj8GP+XUX33hzM1PxDBH0sAB34oRMoCWTPtaX4vRlOjMVK4zik1l7vIq476PvlL8SWJz30EkmZZAFonXjmRUNH5+u8rvQurtO6fKKlKTSs6TUyYeWY4vpNgtIwpw/Uwu4dIVTjvVcT1XalZWvl89M2x6ZPAwk1pyuE8W06hz08y7lLCl8AMlunZBdGr9SWTcx/aKPctQ15capRUG3JWkvBO9xBiyUB1zjmMQFU3VlBWyc7+a782luy+qev+Lz2UxtMnDMSYC44FBouHokGomAITNn3R6xyPU9nML8J36WtwRxpLJOf46nc89Cowln7MuhLYV7RbPOrvgKiEnA== 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 Replace a similar chunk of code in amd_pstate_init() with amd_pstate_register() call. Suggested-by: Mario Limonciello Signed-off-by: Dhananjay Ugwekar --- 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; } - /* enable amd pstate feature */ - ret = amd_pstate_enable(true); - if (ret) { - pr_err("failed to enable driver mode(%d)\n", cppc_state); - return ret; - } - - ret = cpufreq_register_driver(current_pstate_driver); + ret = amd_pstate_register_driver(cppc_state); if (ret) { pr_err("failed to register with return %d\n", ret); - goto disable_driver; + return ret; } dev_root = bus_get_dev_root(&cpu_subsys); @@ -1906,7 +1899,6 @@ static int __init amd_pstate_init(void) global_attr_free: cpufreq_unregister_driver(current_pstate_driver); -disable_driver: amd_pstate_enable(false); return ret; } From patchwork Thu Oct 17 10:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 13839791 X-Patchwork-Delegate: mario.limonciello@amd.com 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-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: VKH/wY61W7+2vj66xsabQLXOAdE94ohOmv1ZtI+JGaGUe5haUr/W43SEsCdK32NsyFcrbGDBYHyl3z5+8JvkraeQ0GpaxCeBtqD3pdBFwyGtvicnTz/iugbh9xRj25bgnHS376Hpp0tB5v+YW13ANuZW2uqk+sNGCoF1qmuRb4N5/t/S3FSjVPGoWzgaiZre0yGVvHQH1qOthVPUc1a5Pj6ZpiagUSR3uIo08l+nZ9ky1RaMo2SyjwYm1Ms3HuSOtAQlmrHEN28TUZHW4UugIXV2szsaXH1u/XukiDTFla84S+jXO2qqkClTks49XywTciroBg6j/UOm6n5nwTlLOKrq2m7az9qNONM87FR866/dX+1FJrd8Sum+dzF/IF8LiVT/UjDtrn9yj/bjy2GTVzf365ZjKBvFZj9gpVuSbZ6tIZDxkbd7jIEWjdcBueOezvP1TZ0SekpaiwjKb/iU0oSydeBsA/YWTA4cHUmHf3a153Nnkx2N0wD+x1bG8zrpDG5aG5sRv4Zfnd1cu/ohsnpGIyTAoxF2SlnFwK9FqP1sEnZEUEFyPeDZ9OKyaEcGeZghGtIFoTuNSlQtn/HvSmfq28VetKacsJXDvP3ffpwDRMXtKNPcKvnSPiCC+rP9f3UTmbnCyhOM91vf42gowIV5uBw5WC4ZNgJAaw4lu2CKKEMIwR2KktQxeBJw4Kw+dPytErcRMaaoPp4cZGXkHM3Pp+1pPs5xOxdSWarbQVcLlXkmJeb8BaRtyJyNZh8SMM8KrTErR86DidpERa/PXMehrCg0fLyVVF06feumDtpWndC81VH0DP2O1ilrFqpvs754CkWrHXqriLWxN9wUXYPzuN9XN96JQmzLcLCU2Vh5TeszCURoaWKxBfe3AvBWHVFrAewdJFRDH32mXIBDVrp2a6fr4+d7MCgmleJdtNrWtar338NYtMJOZcnzPVfZgjqc4jXXVs1g2l3+lz05tKvUfZOEuZBDl4ddC1Sygic6vOocIUIWLJM4OQy3BSm6DdD6KNTTyb3gHpOaoZulPeeDAsdQw11KIeiJZUpkjLy3e+ALHJXelL92ZGUtMHCucP37KyVO2dURPQKI7V0yzT0gJnC8Es73EIBdtYPfhXI/25QZMmrLBRwti81jJZQ1FMOVsHpWN9msWlmPp0BFgZuRQeafS/96Gsroa1N45iWT7bF5YGAsMKy8OIrvd+l7o6h4/Vplf9+LIvLWSsy53B7sW2QqlQC1y3Qt4abeeU5yNC8fxgbJNMm3K6ISRT9EHdMY/qVuZc/gEIwbKTtx5o4TlnEgNPQ+nIG8sL6aIsm7aySRh/aNtd8RYUpU3OjnxdSZ/qe9Vo5csPT+/wNRNCBVfP1v2RgZTWhiyYTDlDNUX6b0WRSub6rzHOppR0i3Oxs7npP6RwpPDmXG+wwagA== 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 Replace a similar chunk of code in amd_pstate_register_driver() with amd_pstate_set_driver() call. Signed-off-by: Dhananjay Ugwekar --- 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 = NULL; } +static int amd_pstate_set_driver(int mode_idx) +{ + if (mode_idx >= AMD_PSTATE_DISABLE && mode_idx < AMD_PSTATE_MAX) { + cppc_state = mode_idx; + if (cppc_state == AMD_PSTATE_DISABLE) + pr_info("driver is explicitly disabled\n"); + + if (cppc_state == AMD_PSTATE_ACTIVE) + current_pstate_driver = &amd_pstate_epp_driver; + + if (cppc_state == AMD_PSTATE_PASSIVE || cppc_state == AMD_PSTATE_GUIDED) + current_pstate_driver = &amd_pstate_driver; + + return 0; + } + + return -EINVAL; +} + static int amd_pstate_register_driver(int mode) { int ret; - if (mode == AMD_PSTATE_PASSIVE || mode == AMD_PSTATE_GUIDED) - current_pstate_driver = &amd_pstate_driver; - else if (mode == AMD_PSTATE_ACTIVE) - current_pstate_driver = &amd_pstate_epp_driver; - else - return -EINVAL; + ret = amd_pstate_set_driver(mode); + if (ret) + return ret; cppc_state = mode; @@ -1726,25 +1742,6 @@ static struct cpufreq_driver amd_pstate_epp_driver = { .attr = amd_pstate_epp_attr, }; -static int __init amd_pstate_set_driver(int mode_idx) -{ - if (mode_idx >= AMD_PSTATE_DISABLE && mode_idx < AMD_PSTATE_MAX) { - cppc_state = mode_idx; - if (cppc_state == AMD_PSTATE_DISABLE) - pr_info("driver is explicitly disabled\n"); - - if (cppc_state == AMD_PSTATE_ACTIVE) - current_pstate_driver = &amd_pstate_epp_driver; - - if (cppc_state == AMD_PSTATE_PASSIVE || cppc_state == AMD_PSTATE_GUIDED) - current_pstate_driver = &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. From patchwork Thu Oct 17 10:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 13839792 X-Patchwork-Delegate: mario.limonciello@amd.com 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-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: lXrjIfv8s3Llmk2zx4bCD6ztFvUg72pIIUjeE1fsUe4ndziIbjy7SQp/rwWzwOj3Wtr4fXUkN3inB6UsMxVFippwG9C7KWUsjNfKYKlg+X8/YJtWa7+9OkQD1OOdBjXL/QMGZH+igtLSzrp/+pXhfkc0o4QigrJyYvLeRiLf3Aa79dbuAoahBMbT+JHPT7QoCBGAs0516hwHFWuW4MwymVKZMvWfsyz0q6+SvuHMt3xNS0nPlCb09i5cwIRBLvOi5YCmsFDp17Uj2UXOmZVijYjw0iPKltw3Jc2VFFdChwS1C8h5dIGkSY/S+rx5Ac87Fvq1PtjQBXiF0mel/ExpPaCQV5icPKMfnZBVA+CiHo6MM7FxVEam/qhR48hZtzZkWLZa09NrIw9fPPwbOgF2g0oeCqxJp6sXx5Jr2l55ZxHoSF2JQf3lzfmVZltgBCctpLuVT72Fb2xKmPWVGika8fbc0oMd6B/U9r48P6a8X4yLdx54RcazW5xSmiH3be0lq7Fg1NkBPm2zGF5jrhWY3Sep0VfMZxfiXrpsuvLwdvTm1U6By74Sh4PNCTqqDnQwomXhk1z95m8Gcuk2eSyEKvTVc5cPOY030c5gX6TDxHVzjXBwKs+NZvTZvYu8jTPWGqADaOTKiUjbUxaqu0RJMd+UO7fATiL8shpReC9U6LqqZFoYRIqiQfh12lcHMpir6LIrrDGlEPRhh57EsEZazYfcKli5NJJVt4Abh6gTVxibN8whc+VFf2zcttKUo+HEW9wXGk3nqvtJhx4j6i6vWWr8D5TlWqFaZT7weWcOw0167fWlASal2ffFqye0frTRmF/cokQS0QWLnX90b0JJAmeRKlVCQvkCvMQAu+zIOSTLgRQ6yDk4gtN5FnKlbNuTPFQTuB8AS32eiJxM2KnT+KAH4TWcBdlF9fnkxoTaaotVoeSvgBJr/bRins7d34K6d6iDRQZsMrpuSVxhwVME7dspJuDL8MLbSA9RRCJ2Nb+N0Xb5E+sqUxHnGZ/hCB6H4Cr/pTo+N8UeTS4ahIl5EstyqrKYW84Yri87aZ9UIX8wvp20Supe5QIiLGNxjHFjVorYINrIVU5jZMpksLt+wYgf9HjvtG2Y9V9oJu3pV2HNAbpRCLcDtG/Nud3vM8fKou5a3fArX9IKnvpknaW4LDkB/PKPTPP0CBu8Qn5Z1/gC+BSKdQHYjEMISzsaEtVXRmEYQxHKCajg4ijJHieCehdJsmF/EVHR4ToJsFLbGzBABThIR3AEJZGl1IckxCDIR8cgTU5nnCCJQlzRsdD1R4u5B4TIp/IDQyAd7QEVD5FKda9FfWy44/G5IKwBKjSMclOkPGZiU0X8avrkUV60n3LYSaH7OZ4bqkev+1vLLh5/nKa3E2PNHw4xn16QMEKx6TOw1UCLnpamtS5pajEXlw== 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 Replace the switch case with a more readable if condition. Signed-off-by: Dhananjay Ugwekar --- 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 = CONFIG_X86_AMD_PSTATE_DEFAULT_MODE; } - switch (cppc_state) { - case AMD_PSTATE_DISABLE: + if (cppc_state == 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 = amd_pstate_set_driver(cppc_state); - if (ret) - return ret; - break; - default: - return -EINVAL; } + ret = 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"); From patchwork Thu Oct 17 10:05:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 13839793 X-Patchwork-Delegate: mario.limonciello@amd.com 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-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: dDm7EPigEf7Sfc5fX6f6G76gvXOFELlXoEEIpnVQo7qS4EFSa9bGada+pPgQijSgWmDwC2IwZFPU/luYyY6bhhvnKjZo8HZuDw4x+8ANFvwyfR+t+Y6zY9HIjQEqDPAr9vL1Vz4JFJ3Fc6ZKWG0hLtLvHn3lIaBn4p0u0P/J9q8M2KJTAQ8yddXFnthN/CU0XbJ9DJabzjWNSFZJNao1qm6ozL8q6nEMrjwNAquUPXczPpb9l9dTL58n0OuMuQ4lDfdc+a734Ix8YSQZQO9FgUE2PJYgbTLxwG7uZ5IxnlM/bmsDsgRqHSK+dG1iTx/diwbRFahda/yNiqHDDfAm8dCTJTCNNlWdJIbi4I9cOZebGDhyCEBUeJsqVIISvUWLqwDhrZ0dpu5u+5tPq+/NnnEUwELl+H4mHSZJry4Gf/Vx02l9BN0oZ4BEPnb/8Ts+Jd7EbGloFuXraF7Y7imvg1PWx3RlFXEpIUpRMJm23K5zj7CucdCsTd5uv2ucdFtnsXxuu8xlpqZDwQkTHLyFnDP60DUF9lNMUt14Fh9sDM/Yes1sylxuisWZqIEph4sMgM04zmfLRpQTityV0e6HDjeZ4MoUQz25nuByP7RA04Fghmi/029mr3eaXnSAA7ouSYOyS5R/hxj6lthEH2A09byBbMNqG86r+YF5Z58pGaTJxygr/eA2Fr6tnvIl6d7pJ38FklGYweUFxwDMK2QLWuueBPWKYHGBcIDAdp+nvlj56LkLUdZ+PXgx3A/6LIRsj7q/aiEwVf9VMt/0IbJE3UQ9ELcswuAvqRME7cWC+qlXHptagYpFeI0kldzn7xcpIROmudnUElq1EWTkh8aIHaSo3RneTapVxVwtGNhOG1T3gyzdMsZHAR7Uxk0/Zc9wOiOUfcmXZplMKeCjuC5zUkHl4NpMsk/BB7Kvt/tM85G4t1UZieklmohJHEQS5VF2cB+pZ+OEpMtFnB4iP9mF/yF6VoNAEYdgeD9jMbTgHkFQUqTZQltB6GJTjKNiFBbfl8n4+R6pLvOQi+kUGD/zSkI8toMjVFoR1KklRNagTMCFL6Uw0rFvkb3+sWXShe58zZa4JrEwdJpc3OAHms6bvSPUUCO7PpaLS2xywsdbU2qLpCHsd7csiwtEXdrKIURNCcZ1ka+AZ6ImqA/lbyE4pRLeg9s7LzE2SI0Q9pCrzbYhJqRHcAkCQx4S8btl16PLct7IGHxlDRSF+DNnZPMw409+DUP8Dnzje7jTs9qhQzo8bYmrIQgGZkfEPf9zaV2WBcqOM0sGgBGPDVSlrnnzPUO3DIJ5nprKw9jZj+PAJdGENt/fJkXAmBUgmu3YkksbS2kmZIan9yZCkQ+4nDPcO/UnJTPkAl7vOa1gy2u4O9q5CY7zYWN6SqYPO+rPUZsy2AUAR2+fL0Ogpr/gnbe77w== 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)(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 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 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; } - ret = amd_pstate_set_driver(cppc_state); - if (ret) + ret = amd_pstate_register_driver(cppc_state); + if (ret) { + pr_err("failed to register with return %d\n", ret); return ret; + } /* capability check */ if (cpu_feature_enabled(X86_FEATURE_CPPC)) { @@ -1870,12 +1872,6 @@ static int __init amd_pstate_init(void) return ret; } - ret = amd_pstate_register_driver(cppc_state); - if (ret) { - pr_err("failed to register with return %d\n", ret); - return ret; - } - dev_root = bus_get_dev_root(&cpu_subsys); if (dev_root) { ret = sysfs_create_group(&dev_root->kobj, &amd_pstate_global_attr_group);