From patchwork Fri Aug 23 12:29:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ying zuxin X-Patchwork-Id: 13775634 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 CBDDFC52D7C for ; Fri, 23 Aug 2024 17:39:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC8D610EC9B; Fri, 23 Aug 2024 17:39:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=vivo.com header.i=@vivo.com header.b="qUPstVKw"; dkim-atps=neutral Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2048.outbound.protection.outlook.com [40.107.215.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 484ED10E058 for ; Fri, 23 Aug 2024 12:30:43 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cP+KUOn8cXTj0LnlIrofZoOOH3i+C/9rJT2Bpr2AebBJli1MqtIansZOKmQko6g1W4EfEKf9MEVUKnwDmVE7KcXex7JgSlf9rb9y6M+pQH7keyXtH6+BpmZ3p7WOlfKUqIaxe5Wkw8+qkXwm08UijjSjDx+GNVw4eqYyJgH7KujrodqNoHgdo3haxxVNwVnOLoYPblU1JbtYivSdeVItilrlZu7gxCxFVEnftwN5LVGsFKAirpu79rGi4RefDNaWQSjgHT48+53LbnyX4U02rBvajRaKD7MmNITZHbbXbYMnbKMFWNQS+Kc1vkvIB7dqQyKWovdKyUsQ0pySA0qJ3g== 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=d7bpAQ7cupdvEUiLMqx9JD8lyHyWFdLB7t/mchCwnAo=; b=uZxpqL/Ol5ihUscpfl1CI2w4OsF5qpm/XKqIcO5lninZZEpW+piXoGDGI1/5aRmxu3Zd7gFRNqeiOhpFrAemSMuZc0STL8Y2wj89AUyhxNGDWjtzx/x0wQUt8dAg7qkKXvwxHJ+FwxgRdr3VkAbV1LCJwoAe4zZ72rIwOq0wd597O7x1sfNtLbtm+B9GOEwXme/ksPCRrM/Nsz/VPnXnFIy9flfB4KY8n+3kPM2piicB52cwujGcMLwqox6J7tTGFkPrxyDkYWFki/nkjp/8oyqBbhExB+/xKEbhwC7phvx4DijtKtVAh5a0CKMMcysWJ2wMKHZxFpPRYJX/tMmoBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d7bpAQ7cupdvEUiLMqx9JD8lyHyWFdLB7t/mchCwnAo=; b=qUPstVKw3Xaz8MvZdr73xOsCToHZczuQqNl1i7zYVYQJC3NavUtTAeW7SkPGeJsD6802Wqk8H3t4NpZH/tDGJUN6PNnIEt9BMcdKAfMjb8pqPe2FoCno268tDnkj6hNz0IrlB+p/Gq49cGOPEjqe1GpFzs6+sye8RDcfj11Zi/YlJGfnL9Sg2vTK42R1DhbNSnnQQ6/g3CjQW+RRO28Z59TEIOXa5IiclVRJPgLZe1nsl2PyUJCwNmJiC5yWnV0wnny7P9KG3us3dY1wuQirL6j0FcHQaBEa0aEkXZm32LNSa78//yU1tqkltHMcPMZpqJrlNcD67FRX37/Dzouhuw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB6332.apcprd06.prod.outlook.com (2603:1096:101:123::11) by TY0PR06MB5529.apcprd06.prod.outlook.com (2603:1096:400:27b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Fri, 23 Aug 2024 12:30:38 +0000 Received: from SEZPR06MB6332.apcprd06.prod.outlook.com ([fe80::6b3f:3bee:4364:6919]) by SEZPR06MB6332.apcprd06.prod.outlook.com ([fe80::6b3f:3bee:4364:6919%4]) with mapi id 15.20.7875.019; Fri, 23 Aug 2024 12:30:37 +0000 From: ying zuxin To: Helge Deller , Christophe JAILLET , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, yang.yang@vivo.com, ying zuxin Subject: [PATCH] fbdev: mmp: Use devm_clk_get_enabled() helpers Date: Fri, 23 Aug 2024 20:29:57 +0800 Message-Id: <20240823123027.5753-1-yingzuxin@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SG2PR01CA0172.apcprd01.prod.exchangelabs.com (2603:1096:4:28::28) To SEZPR06MB6332.apcprd06.prod.outlook.com (2603:1096:101:123::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB6332:EE_|TY0PR06MB5529:EE_ X-MS-Office365-Filtering-Correlation-Id: 94be780e-5b6c-4caa-b6b7-08dcc36f6497 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: exNZgJHnelyKQQK+pDBj3PnIVpJyTuCVtRLYTX4TM17S8I87QXfORd4B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dih/m5pk9E4ZwRWJV9tzBN2I8hNsB9tYvkhh/IyvliAoG+HOt7EnjVc/EKenuHo+whj2QWPpl3QKbcgJ2xI/6bUFFN424EgBefGoQ3L4Sq/BD1Sd6DKJi+KRoC1ORMV2lqDIromYOUVGhDtYaXNlEJ/eSHNGZYqzRVvM6zKmxkkf/W1Vh06GiwjiC6Xh/jp7TcMHP1FEBn3QbkO4EEeGk1xoCnEFksXENcq3UMl+0HMpxZPNnoHDF2Vc/9dhVk2tlh32puH1w4X0tv5GWWbN7HStwvw1F1ptHsMywCcji6YjjEng== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB6332.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +gSqx12Wpm+p+ScQLoJf348zO7DacvVe8DcpRULlUbEvFT5pjAM15hS/sajByl1D6TzrN5+lvot4Nt4f1RsSlhUP7X/PnKjVZ7wAtB5ZPb29TPP3VzJQcXvZQoQkA5s/t1O5hKf5HQ+e9ix00oiGPRDjgJl11iUDLC0ShkJKuhCE8GPoso8tFr83HyYNCXDfJyN3kQcCSFB2Holwo0SLZTqmgV26ihoGlPmstLThBaRxn8TP3BaXk7s+jaXWGKtQw9C4SbGAi4DLMbV0ijhx69a/Er/tQ9vEyZIwS6I93pGq+d5mkjDU0k6dNOcO2azAX13UViH5Sl1mQ7KRKmVtd6s+UpplsmPlln1TRGDu+Pt7ePvrENJls6A9rjZF0HAKO7B9JcC9B/54rOUR07PRqC+XArcwqumBobK8f+X3nTuTbbyhc4EwuFsgDAYZjM9g5lluVGGV6gURige/HAXmoonXCtimabcuO7aPtID+yfOqP4thOStXmQ9SKHKyqZ8MAifz9nyLI1eYo+w/HDNn6Xym7CRi4jDJWY4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-MS-Exchange-CrossTenant-Network-Message-Id: 94be780e-5b6c-4caa-b6b7-08dcc36f6497 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB6332.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 12:30:37.7418 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 787Gb8ihiFYEEAfQjt1RXXBagpc+EEXaYYZJlJ4JjfEGyP8NatedIHJ3VX8974rGYaPaqDU+QnnsSjztqoIKng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5529 X-Mailman-Approved-At: Fri, 23 Aug 2024 17:39:52 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). Signed-off-by: ying zuxin --- drivers/video/fbdev/mmp/hw/mmp_ctrl.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c index a20a2c408127..03e23173198c 100644 --- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c @@ -512,16 +512,13 @@ static int mmphw_probe(struct platform_device *pdev) } /* get clock */ - ctrl->clk = devm_clk_get(ctrl->dev, mi->clk_name); + ctrl->clk = devm_clk_get_enabled(ctrl->dev, mi->clk_name); if (IS_ERR(ctrl->clk)) { ret = PTR_ERR(ctrl->clk); dev_err_probe(ctrl->dev, ret, "unable to get clk %s\n", mi->clk_name); goto failed; } - ret = clk_prepare_enable(ctrl->clk); - if (ret) - goto failed; /* init global regs */ ctrl_set_default(ctrl); @@ -556,7 +553,6 @@ static int mmphw_probe(struct platform_device *pdev) path_deinit(path_plat); } - clk_disable_unprepare(ctrl->clk); failed: dev_err(&pdev->dev, "device init failed\n");