From patchwork Thu Aug 22 14:04:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 13773570 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2041.outbound.protection.outlook.com [40.107.117.41]) (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 6623D1C942B; Thu, 22 Aug 2024 14:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724335566; cv=fail; b=eL2T0MLwjnBTuJ9NgeBGBjZIu8Dlp3SnWk2EN1NL33mfz/iUgAaN5THll7mFhMELRnkpLA8QbR/9vA1FyT5Cjpwvi0Fgnl9vvFF9A2jYW8P+lAi3E+yTCoVSdi87YToITC6mfI1YHzCGphwIlGtf5lr5aGYfaPLgfGVg3+T/Wao= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724335566; c=relaxed/simple; bh=a0zLsE1j2Gf3/rVV9f8v3hrhEfqyf2LjHP7E5KBlJDk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pvgAJCJWuBt1vUItq4aey5hUKgdU3pBJPmLNvBJ1lxOuQDybGODcICwIln07ZeL5rLA/o34dHWSdHBLJtgDCT13FtQKPUfUxX3XkBD4ryLstRJz33bRBEG5xqpxFBlEY3TwqDgXftKl3AxGs8+ZGeL6T89+bTLmgr/wbmtcgSVQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=VhnVhGP1; arc=fail smtp.client-ip=40.107.117.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="VhnVhGP1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nM1TzP3NZE8srqck8wnsxrF9m7xjYpOZtW+/kswnaqd5+DJWpyKNPlHqJQ5llZ9gSQDWwsOFKk7mqY2C/QuU33wpw+cUkBwyy/xcznu8AISjAJabKzG8oWMpYYfICr6ggHkwVIThh4E3Weoyhm1GtJ7RrLMu3cgEcopjTPPktKKoHlaTVPN3VpXgBhugkAkxAPiwUEYbzv0sGwtR66MsKkJj842tPhMImOsGHZDJUNjw3L6H9NHwyfWmQFoPEAjcUEOvaLZ7+sJClCC+xbNWlPwo55/InNQhzvMNLOF60R/5/kBsmoxumTxxhq+pUyV6JiE1CCY023xhmiT97VaaNw== 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=fh6gqHwq0sI6K+2JpXOAiq7ZlnK3XNIqM+42FuvrmE8=; b=VQXq2KZdc+714LJuGep7fggPWcvrF6yWH/sqwPd+k0PJrJf4aWF38RznOcjSQtKM8Y7E08audmSsNGQEJYXxstnGwc9ho/UJCqqfV28q7mPXArqYxg5TnK1JpuDF1TbvMWjyIPd7Sa1pei/QVQMU1YB+Eghk44gn9Jy1LkZJIFMX7vqk6PodrkajAgK8pNo8G82Kxo5ncBYK/nT/5iM4tvqqq89WBnaj/75VXKofHZxOD/d6tuduH4VXDraIx4EE8HEunDHB/m00GNw8mNfyI/soNvczam6IXPoBOX0p2VrkkLgkDP/1PVA5x+U3khVkvPJML2fM0kWwMPtm0/9+IA== 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=fh6gqHwq0sI6K+2JpXOAiq7ZlnK3XNIqM+42FuvrmE8=; b=VhnVhGP135GfpBm80Vg7EfMO7/fsgeIw7aa4uuszRt6pk0L9VGK7XneDo3+evENMmI29/gEkH3HKIuHro2EvfjGvXff4SZ+L1PSNTwtAKUzx8mdh8/gPMLNt5m+jBFvAvlaqccal8xfT+7u5Tlp7RPwzR7eW0VIgzDRl7oMbUMrzlLUvXy5ppCQhc6k8pXz6LCQZaEJX6EY+jX5phAWbrtpKR1rpd8/PF0q2gGhGf/+SA6sJWI8ftcGE+zEvyO145/ydXyvKSb0HvonwdUrfGnVciYYgrzg8LUhU8AqA8qfVemQs0lO9MIO2766K3skEN1U1VtvA3azbzat59rdfDQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) by SEYPR06MB5301.apcprd06.prod.outlook.com (2603:1096:101:82::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 14:06:00 +0000 Received: from SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::468a:88be:bec:666]) by SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::468a:88be:bec:666%6]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 14:06:00 +0000 From: Rong Qianfeng To: biju.das.jz@bp.renesas.com, Wolfram Sang , Andi Shyti , Paul Cercueil , linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Cc: opensource.kernel@vivo.com, Rong Qianfeng Subject: [PATCH v2 1/3] i2c: emev2: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 22:04:10 +0800 Message-Id: <20240822140413.65369-2-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20240822140413.65369-1-rongqianfeng@vivo.com> References: <20240822140413.65369-1-rongqianfeng@vivo.com> X-ClientProxiedBy: TYCP286CA0294.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c8::6) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|SEYPR06MB5301:EE_ X-MS-Office365-Filtering-Correlation-Id: 5fb28585-9554-40dc-b380-08dcc2b38d41 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: PDeDx5SsDV55zf4XkiI3P1RX1vyPWsgFgxbYjkSanJwVuQ7QWWvGAHXAAP2F6WMhRnFvNiG3sCViuhMqErtwLMZiwnTJi85P6cX1nV3kvEYb4eThxHgScKqV7ivGkqim0/+CH1y+T3p9FwJfSbBPPKUTTQe4J5nKefxdAd7ix3o57jmfoIrVRbBwJ03rs57BRorT30WK4lBxgsFMv0WXTabJ5Xrh6iEH+5PGxMjLbjjTDWyPG33l79HzT8bdD1SvRqYYe3knXrmWDtHfUphP5bqqDELKbeS2/PUCWKTjjeZPVBb5OSvLyWkzkL2L4KXn3OO662fWOFG0wQwkkusIDRWYZnEQiXdEFIyCFMfCSRbimEvzVgpbynSKlrHLINpIJMNL5UxQ7UlZ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NLI;SFV:NSPM;H:SI2PR06MB5140.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: u0/ZOMVxP7ZFiIj28AIkgfjducrS1J3p2wODaGfKyAfUZzygwMxaRu6Kl2P/+e6yfa7ZDePAlZDHU4rRahUeT0DtXkL1BzjMskOizuSYdT1dX5UzFZz+YutlKOVr9WDl3CPeGIP8GQIJKTq9f1a4eWqfE/4OqtvTgjNtoAWRLPsnDH/cxg41T8Sd6dnS6w9wMG99VUcJEUcYrtGAQ/4B5MOMik/RayP2wNiwFcQ7GlWowGnFhGO9vw4LkvGGYShcg8TOIfiHGV4pVA86Xm/6juW7/obnu4BTIRzTAYTLHDyLg4gWQ4U7uqOzsiAZMgsmEfD1/kMbLG37Sp58dzGZYDL4jXBMJeteOKh17vTsjoP5kQxeo9QZtY9fBUxlSSDYDDTbkf7dG3c+1tWSErdcPiPqELVIRh8vGEnsh1yof7zujTcQ8YnxBSZj9+a9iy0y9rJOb9ElDCTFnpUKQB23H27ufgBWwcy0jD4Vn3rF+WICHipHCazUyub3zp4fqd6CyaBMMUtX6zW9hK4BGVo4IoolQbKfYDg4dzUiwESNyN/TrutOnZsEV5jsS6odeXDGSEc8a7EvXJMIIhbeDDCQ2bBuLZNvU3rndEKbAkENqHVDDPGArhPb6xCMUImeP2kmvDfNI5vGb5+UVKeTabj4JPuff4l4GcbMF+M1E5t9w0IRsYxHRz/s0Rs2HEtL4kbDG+OpdpnvWoNcfPnNZ/GLQzwayeVf3AQZrJ63uQUm5ckzVTpF+D3jIraINtceP5FXE+AYBzrOV0fb0n70liI3SXL+3VvcmWKY/SxqYPDdk8YIbHFxhTeUWNjzGQKK01oaC9ko2+RTPjZ64Ir6kKFwzShxbyzBwdrA8VB4EaiVk/6SBs5KoWc1cV1QiFAVRhcSTwxWcEBYMn645tP4gucH743UfOaM92RahcsXqnGydgc3u4merswt0pkAnUrJ6f0VuS+cUMm7YLOpoaytvo/G0K2NJRWETXQd+7iBjmfmGOt7YtRmkGKlXkX6ZTv8/VeeiqOTLSfiGRJ6/N6g7h12Q/aP4FvxR2ZjbpVcFEErUvz22zflhNEiezi9N7OWrHyl4BUkdP98h4SR3eEQm0ni9FaV47JOqtOTMVQjHiVpy5aNRjQ2dxLFIbnxYcP4lm53Y9r93w6gw7hA9U3ZFKsCUrJsBN4B2S8chLIy684sY9zCBy1CZFpHwf4ZEcttTH6ShMW+d/9Ibu4jUqjJOOskSuyoiLxOd9YDxTm0NtgCRiuNzp1nwXGPeHyzOtX2yt4cDlc0AssdbmfgfbqNg+pojnIcNnrVZVu5S6UM9H1mszU5iWbiO4Bk/zujql8ZvrlUsHYzCb58McX7eHAsxoOUHIK5GD+QOE3VUbI9VKTLcMB1diYnwUOnmUowCyHf0R0T3GovGOvaOhOSYNqaV1pFd1o/YM1pkU6ZOkKs8ZYGetRxJ2f01in7PeJT+Hqs0oyLmNDgD6T3s6iKlPBpuC4uRpPJ+ZvjR9mKpEUyfKe+47pHn9RtI3yHIpZNkohvaPaWAj8MVCxzZzlUPFKUOlNzYwoksg/RNzkuE1VOfhmz38GAsQVg+RswOEYhH4K80sJp X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fb28585-9554-40dc-b380-08dcc2b38d41 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 14:06:00.6603 (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: EdPxc4aRtQ/FFMCaChKOh/G17DpuOT0Mx1hxdSPnCGJNJvsZeieb2+pM2Vqe0BRD83oGClOtheoSaVR71HECnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5301 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: Rong Qianfeng --- drivers/i2c/busses/i2c-emev2.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c index 557409410445..20efe0b0cb85 100644 --- a/drivers/i2c/busses/i2c-emev2.c +++ b/drivers/i2c/busses/i2c-emev2.c @@ -373,14 +373,10 @@ static int em_i2c_probe(struct platform_device *pdev) strscpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name)); - priv->sclk = devm_clk_get(&pdev->dev, "sclk"); + priv->sclk = devm_clk_get_enabled(&pdev->dev, "sclk"); if (IS_ERR(priv->sclk)) return PTR_ERR(priv->sclk); - ret = clk_prepare_enable(priv->sclk); - if (ret) - return ret; - priv->adap.timeout = msecs_to_jiffies(100); priv->adap.retries = 5; priv->adap.dev.parent = &pdev->dev; @@ -397,26 +393,22 @@ static int em_i2c_probe(struct platform_device *pdev) ret = platform_get_irq(pdev, 0); if (ret < 0) - goto err_clk; + return ret; priv->irq = ret; ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0, "em_i2c", priv); if (ret) - goto err_clk; + return ret; ret = i2c_add_adapter(&priv->adap); if (ret) - goto err_clk; + return ret; dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr, priv->irq); return 0; - -err_clk: - clk_disable_unprepare(priv->sclk); - return ret; } static void em_i2c_remove(struct platform_device *dev) @@ -424,7 +416,6 @@ static void em_i2c_remove(struct platform_device *dev) struct em_i2c_device *priv = platform_get_drvdata(dev); i2c_del_adapter(&priv->adap); - clk_disable_unprepare(priv->sclk); } static const struct of_device_id em_i2c_ids[] = { From patchwork Thu Aug 22 14:04:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 13773571 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2076.outbound.protection.outlook.com [40.107.255.76]) (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 22C2C1CBE93; Thu, 22 Aug 2024 14:06:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724335570; cv=fail; b=DbZ/4qbu8CHGiLRYo7eJ+9K2eSl6n+5TpGJdrLsRzVpwEV6O4CZ8zrAYLj5/fywttK4KFzf9PdjXz/YZxYQzC1zSCfaC+9K2z1dXc8ZBwPHqAbYlAWDUksq9CZRSp92iZfiNXakyiLXKE6hTDa1weY4kS6UMuoDWB8hkvwr1Gig= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724335570; c=relaxed/simple; bh=o81UGAtjWDlRk/lA4vWJRhoCIW+NdC52Xa5p9KaV0r8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=SA7HZkma4OJ9xSWyA3JqmR8OWVoH4w2MwjaHGyCTWsBwTZZGQYD/tQ01g9EVjr//4ImsmXzrDU4lTlYzUoxij+xeYYLGLdL5woGkR/Ngvkje1Nz2NzIvpoJf5eyw+HXvoMPvMFOSKmcEAxEdaJD0VLzhJbo68DGgNrKh6iX7qJ8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=Qdz7HYXC; arc=fail smtp.client-ip=40.107.255.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="Qdz7HYXC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t0DgNwcgKAnRiRE2YJEGu8piqQthF5Zthwq5Elf3BAMyI6IdvXvinE4kLR9qmP8odcJ8xD9yD6yQDG5Z71jUHmGs/VMojhC19JU0PMT61NyTQG+nPQOrOk81hQECR4q7LWTiyLG077NmiG0HlAOTUl2anbZwP4H9pv2RYK4l6sdejCXkY9xEwDGtmdLRxp67gm3y0GmibyvUIq0PXumH/FB7XrkhhFjA6NAF8f7OF8plKU2faxkogd248ViRodAGnk+ffu3tO5+YJ8BZ6llKXXG4jqAeOAcKeeQGaYAsOyl8X+DfOGmdhcT696r+BWAYf/ahUq9/YIouqcN8vGVD9g== 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=Z+K4GFLAYa7hscPFFxUTLQlNVnCSpxclHSjUbJWB970=; b=Oc4uEoCZgUwdUjQCWokBgOVALyHk0A0MsOMILbHaaQByb8HOJ378fWgIRiMmQ81tNSawXwRnk/4FJIzGo8S3dhjgZMNXP5pLeoDpjemmwejJ6w6bAVr6FYvm/bCV02gjckpqkbmnJY6l9GX2xLFIO3aKIhYxdyRNLPkHlpwfd88B4uGIlZjWZC20gTKLyVIEeBiSLC8EPI1et2RMTG9j7i4+Em+8sI06TT6x9pKcuRw3SUPyClEMeIViooOLfxRBy4YgEnWa8yRPf9Xs1YsUOTWqHQXLX19X0VH5SBUtjlMLEHzU059FkWyCV/FOLlK9sgHC1FCXQcoGTxiRJ6pmgg== 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=Z+K4GFLAYa7hscPFFxUTLQlNVnCSpxclHSjUbJWB970=; b=Qdz7HYXC14JLnoEtw86T3bJhhgbYy/QzWhqk81FOQI5uMoxvPCVZcPD060djeLLS8FX2vzugLDzUpl+2GuOy5Je0/liUpeYGGF6zwdD95jZ6+Y1wQ5Ebj8tEkFDvLwDnNjCmq4AQ72EDKgTKF2zlxdwK7/DskoYicnbEIXiJULbK5jJF2iOdV1oWlt7XrJa5jXD/scoV+9nPszvDTAPK3wm97Q5VLSVQzl9UsTBUpIznkH2NtHfRNuqgfaMQ2vzPSOSkE0tzi5bN2bsgISchNV8qEDqO8WtfHa1AEPZbhsXcz6WAic1iGooozLeJ3RyEONmfvJMoMCYvxW8SE0Fktw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) by SEYPR06MB5301.apcprd06.prod.outlook.com (2603:1096:101:82::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 14:06:06 +0000 Received: from SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::468a:88be:bec:666]) by SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::468a:88be:bec:666%6]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 14:06:06 +0000 From: Rong Qianfeng To: biju.das.jz@bp.renesas.com, Wolfram Sang , Andi Shyti , Paul Cercueil , linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Cc: opensource.kernel@vivo.com, Rong Qianfeng Subject: [PATCH v2 2/3] i2c: emev2: Drop sclk from struct em_i2c_device Date: Thu, 22 Aug 2024 22:04:11 +0800 Message-Id: <20240822140413.65369-3-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20240822140413.65369-1-rongqianfeng@vivo.com> References: <20240822140413.65369-1-rongqianfeng@vivo.com> X-ClientProxiedBy: TYCP286CA0294.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c8::6) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|SEYPR06MB5301:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d65d099-e50b-4e3e-dbc1-08dcc2b3906c 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: S691c6zuIrLLh0SM17WtnDSuS93KyDhiftU28qGiW4vOIYzcC1gM64ACp4px3L8WvVcrhWeXWoBd9s24LpLKPgV5s/mrLBqhefH9B2MVEPoQNQ3QB9CkQiNiHJT3tJip5OLTeQzxO2dJWfhYMq0JsWcsGYzwx/yZFKuiUxa1356fQ3DJ1hGOHzQWntHdpGTfrSnT1MK9jitxl1sbVAeIwAeGNH9+c9MRvIoIxvEDWEJUowQGLZ7CWL00BHyxJf0CrpUoO2xSUs5zvHDk1WBeLaRIY8N3YOuwhqTzmqtxK0Q+K+MZCzywVcsPyf+ESCcX17qi/K7BnSWYZ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oUsQt3dxx46i05bFxhg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SI2PR06MB5140.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: ISK2dd64EwZCReI4lUkgwP3xA+lHnWehRNSHJyVBsdLo1VRq/fMGtfInZc+CNxqquP9N8zHk0vjRqPiceFsnEiVTz+PYHN7LQyjAEGZ2RYCNoJCdq+N/Z+1oToqeff8EZpnd/3603VNVoaTg4ipg8wZYn4MpGYuZeMT8i52qjK1vQCXll3Ye3rnb0tkiWaebcYbVC5NghlLJsSr3cEnAPXFdW91paw+WmAsHke+e9O7CyMRa+lIaL1vXGM+UvVd0YiaDo4QuPxAX7U6WJMzlR+4bmEYiyW0jQUYBvXkZLv86w6Mm9gKJFwU1DEyz8x2NNTKKllB8NdQkVzixoZiV4ShiR1rrvsD6Bdghw80wIhtcCv4jIJdHCd/rqZ889vYzPSSlJvPqGQZPHxd0kaxu7YSGXkxi6ifd5tlz6OfDUz0b6s46oQmttsLmK7mY7z2SnElm3hwFjMsi1u/7ZLIkdpsqoDG7ddMrytRoP6L805ZYKs0Og4wqJp7OXlEN68CzGF5KHFGdbITAKJjT/oHprG+P8H4iGkXMJ33NMdKB0IYRCUsZcafki1aMAFbo1bY69nXmCvbvm/ZPhQGKOz4Qcy/LHLGOnBSWSN4BASCyE1A8sbaHyd/IU1musc7kwwA+hfRNpUwWy4uyTXCSGouscxOOy3ol2HUwbI+cJBJshTFIt/+0OsbaAqFjqxa8/A8F5AhWLEJlvtjHtc/XmyTkMOK7YsiGseFygIqfPvBz72gHKzGBVsUoVZWIJDWCJzEk7TPWLDw4yF/Kp52hLiezPZBivg7pQznrffZsQBhS+SiJy8fVyT7i3ansr1jahXYUWbRUmlqv223JghR4H+uWp6CW/vHwZfJTSLfh6RJhiHtusHn/5fxeX6svx8K5LOTHTR/bwjfq4vTBqGsUYsF1sehJ9dug5e8PBKqAqtdvGb6ZeZYW7O2Udtllm/6oGZ+8a9kefMZlZHTS7RphRSQxQp5c3hCrSsIcph+2SO2R8kiINmKPYF0p3gZgu/55QHVQ0ewNLjbZTHFy0nO1gI7iKWDWiFzs3xbvIuXBlR3LhhkLg6pMk83I9+TkM5gToUWGzoyJSr4SeaxPl8PQTsH8zOvdxBj2jq75VYsvPQS6GSeyxcb2N0/lxGVkR254zdYnuMRT5OSFI24dtg6MOT9RaihfFGDm2lpIKW+tFcFZI/JFmGCUQcP75ewuVR+Px7vVpbiNlhXrJwoB8e0ya5H7LB1uCeLkyKDQGSAOMBh7+AKwqkBDQlShsdLuP2aU9uDVuwM0edllP34tEprT0mCPHpoyLkjyabZ5kIi9hL2XXk7eaYeiOuthB0PmyN7hreq3HKXlPUBDjpeXmt6TVmAsPAhkzGVtxn4tcXtzkbcQmDf6RDhCtnXPtIeztu8L/eBxjvOUJttHbx+DEN7vmFWINV+2lgdpu44+5dd8gQtRiaWNArkAoNOQRtph5Q8kG0G01yMRY7QcyEyhNZ8xt7NxyMo7h/Agclf1bV3W+Hb3zoWR16WNW3ciG/07hHR61QFRuhUPKAczVxM58w4wwtvIAQJ2A52kXM1qzQg+AkWj6WLg+CAH3BrUjhO1+gop2C7C X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d65d099-e50b-4e3e-dbc1-08dcc2b3906c X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 14:06:06.1852 (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: C8OjlsEbqyJbw1rt8HRl+E9wo9b4vM3Lg+vuY2rPqNnLHhiMIPtYaxcAJw7iVpi/xsNIFoiYzWIvgxYy+Hp6jQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5301 For no need to save clk pointer, drop sclk from struct em_i2c_device. Signed-off-by: Rong Qianfeng Reviewed-by: Biju Das --- drivers/i2c/busses/i2c-emev2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c index 20efe0b0cb85..2a5d9d658246 100644 --- a/drivers/i2c/busses/i2c-emev2.c +++ b/drivers/i2c/busses/i2c-emev2.c @@ -67,7 +67,6 @@ struct em_i2c_device { void __iomem *base; struct i2c_adapter adap; struct completion msg_done; - struct clk *sclk; struct i2c_client *slave; int irq; }; @@ -361,6 +360,7 @@ static const struct i2c_algorithm em_i2c_algo = { static int em_i2c_probe(struct platform_device *pdev) { struct em_i2c_device *priv; + struct clk *sclk; int ret; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); @@ -373,9 +373,9 @@ static int em_i2c_probe(struct platform_device *pdev) strscpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name)); - priv->sclk = devm_clk_get_enabled(&pdev->dev, "sclk"); - if (IS_ERR(priv->sclk)) - return PTR_ERR(priv->sclk); + sclk = devm_clk_get_enabled(&pdev->dev, "sclk"); + if (IS_ERR(sclk)) + return PTR_ERR(sclk); priv->adap.timeout = msecs_to_jiffies(100); priv->adap.retries = 5; From patchwork Thu Aug 22 14:04:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 13773572 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2074.outbound.protection.outlook.com [40.107.117.74]) (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 A843217D354; Thu, 22 Aug 2024 14:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724335575; cv=fail; b=BGLJ1hPhfAFYquUwsn4SFsPAJxI+o+Qb5WQmKuSQHO32yDHHJAYFFmWQ4rHG45mywhIpWkQQje+4ErD5/k5vfnK59uGqtQaCZQVk+FzazSGC1i7wnnZibcu9Gz10SzBk81R8tWybl2wF3WdwyISR8/SY0VIjMMNem3klZ7uk4R8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724335575; c=relaxed/simple; bh=vnalnjId2K+5bbr4HlD5b3d5EsYOi8iZr3cfDy4oQNM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pGzs6+E3SdKHu/Blu2J3SVFcc7OmUAP+b846xUj+5YN1ua5wFsPPi3c6XZcpnlDJ8RfE++m6GZsq3muZLlx9+mJDCAb0dg+bsHqgGAebPPScjm+hTqRRj/W22Q0ZMHGn4AVDaKSJa4yguikijtde9XDQeLmWD7PC4MgZDiERZQ8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=H3eC/EH2; arc=fail smtp.client-ip=40.107.117.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="H3eC/EH2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QSIXckn5ibmnHOhjIh0ACrf2JzhQinQk8SSEX7SR0Q+AdCA6fm4f0jALPMJP6GTYiRzJAOXgHy1//QbudxOJ2T0ZgDKOJMHseDQc/XbZ+LFqJ3Aj76m55P9hG33eXzN7TTaPkbFHKXsAQWFkWzqaupqbXbaDI5JUsQ1udqxjpZWlM+5qze26Wnq01HPYnxrHht7322eqgx2cM8ywrvpzszE1nQQ1IUTNdozeR6B82tE3Ckh2yK3fxJ5m5T5neiSvhsUKLDAn2bkC1C3aZA+mkMRyNCNi3zk7+U2/BxMtcjHnKKM1gJaZ/COyuV2XOR5FRJki5BDJzmRwY8MQ6/3jOg== 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=KD3mAZ47w3g6KpUQoAKSv2PDeCM4yshrE5QmLmclw4A=; b=fsugDLg7CZTP2kBXFmHZ3JN28QAp2JiH+UETELLqlH26Vi9sesGW6Mst8Pv3WNJ1ADPI6N9Q/3eXKMWfswlruTF3uX2zLfFrDLJ5qg2QNqKa2r4QYaSkTjM3o9zngj36w4Y76NQTHsR+o40vn5D2tAoJB66b29hFICDWUuk4XLPnmi0a3dLZubSTP2F52NbrHwSIHf4xO1H8gTUn3MDF7VnUVccdAmknC2zFPqv5PL4mfTQ7Bj9vQsXrfp1983hq3zuydTtEl8tO3pWUwje5uDltyD7JzBeijJSakXbsehLI16EH0JNhehy2XWPw/xe+S6deXKBmIOgDv2y3No1BVw== 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=KD3mAZ47w3g6KpUQoAKSv2PDeCM4yshrE5QmLmclw4A=; b=H3eC/EH2zbrQouLkWPiGni5jsUzbh+QzvJ1Mu+JeCVlllPOalHlY+5ydoyx+PiMbhmDIQe9388aaywfgJcMecuO054fkaqiOtc2LQMYZW8JPLWE+RP1dhTvzd4AXxKImUWpOk+lDeozHOTE/Uz0H23BmAUsqrryCHtSW55fs1FOKlK++DZrhGIYf5KEd6e67c+SN/lf9ybyzyatiAuS5VKnixEgfBbg2QapLPrbWusCRCjHKCOG22TUbbBlzD2/nZhPhKnq2uS8G/8xvtk6Pn6isIXZXDISQ1lkfniaIfMRXksh+BsygRfgXeE2WJZop6Nv9vujuPZwIrvUBktHZaA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) by SEYPR06MB5301.apcprd06.prod.outlook.com (2603:1096:101:82::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 14:06:11 +0000 Received: from SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::468a:88be:bec:666]) by SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::468a:88be:bec:666%6]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 14:06:10 +0000 From: Rong Qianfeng To: biju.das.jz@bp.renesas.com, Wolfram Sang , Andi Shyti , Paul Cercueil , linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Cc: opensource.kernel@vivo.com, Rong Qianfeng Subject: [PATCH v2 3/3] i2c: jz4780: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 22:04:12 +0800 Message-Id: <20240822140413.65369-4-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20240822140413.65369-1-rongqianfeng@vivo.com> References: <20240822140413.65369-1-rongqianfeng@vivo.com> X-ClientProxiedBy: TYCP286CA0294.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c8::6) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|SEYPR06MB5301:EE_ X-MS-Office365-Filtering-Correlation-Id: 4978fd37-006d-4e2d-57ac-08dcc2b39350 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: aWlVKvXpTq3tjWTJWvN9PxtiMnWeitSxCgUseovHUKYyqINJbvGQ8u+99HmSDW55EubMA9CSx/UpX3LjQnY01KWZ+XXfg71fnMJ0vB2Q2xkqtUrXVksbK1ctVKJgF/9kbqPqIA8xiC1IeN91MPn1lw2/sJTOMKJIX1/7pnFkqz9/YuRER0OiDCt5Dy4LMrSYY27It1/GMqTQUT+unamRT44hxdRCgKPcYu+UZI20wcgzBENn+lIDXdqbp8vWp70+p+EvUi1NkSqOQmHHTi2x/qCNsz07btVViAjB+9BQo14IlzKI5/OTGip/UULjb26+sRy/x55D942e+y6qJ/krQUHUo5Abg7pavhKNuRuMixKjL9uXy4NsMtJvacPEho/R8bxDiYItgJGj98iVE14MWr71PFK2msGA4oCvEXgAMJRU0VyaD8Qr3X1tYZlKtvccCkyO7Q8uq+1XD9hKVOroFVLwbSETYMjxNOw+TVjWx1plyCkm3kemgGxTQXcrr+L5nnnkDpyK6tUvtWgikSZDBEhh3qqAWBs2C73qLLMg1b+MrlMVvo1t9al5e1RAJwJs4K64u2w51QadrW+DQC0vNiJgEZSteOO7HgCRgswcXPsdncnpea2sOAPOqnt/HsxMlPH4l/53PBYOSMtWEVGpH7PNFTiKbIKzr7dunb4C7bpmotj9QxxEX6riTn5FkJtCfwyBVRnugx5mzGc72Vmc+jGrmTTAoNeB/W+/mNSMxKz+ZPLdXXDyHNYZ5gFUrifPR6pv2OY+AwiafUZRvCQTfvVYUWCBQj5A6L1VIYxsZZHk5z3qPTks9RXcorz0VfC3YxmqzS6PO0eTbvIn2bbsQ6AqYZsD6X+lZ28WrOhQkh6ZANtphPSkzlf+tT12izRtNUDAD1Tv6E7DtcCxzsXeSNKVbbrq0T1A2lmIP0IKmd0ghC4rWzJDh4zKaOsQWtB9rYmko1dD/lNokP+PBmzyfHqQbn0KqoEqmrQEioDYIUJnKT665Oe1Q+sGA0WWW6jTbzSpkJdewb0lLUY0qWohN48zJgY6lZrSGMf8NclMqya3hx2Wb+HEqZxH4mhgKXGvUTbgbyiDMGTh5LQC6S+2fbwoC7yIlVi3bLgVn89TT3de3jrZTAIvvyxPz4bCAuJHlg1oq52l6CYRATIhTUelgV6pP0KPlMf8eZ2OeGjl5dnZ6U1xziOeYvGCoOg8Xh7lHumhntZJqC4FsLczEvnVy7OPeR4qM/lVD52QkQXfMYba0u/G14pqjKfAQ9F+vY7O9/cNwKIOB73jTpi3PRgFyuoaKxkSI+eAs5GVV9woAOZQ81FTrB9XyLlwMXFl9gX6/4W+o5W+U++h1BI/PfEDiGBUxuK8+vK96zqT+4F2DppfMHePQJ5XcgSgBdRNYgzjUAkpIZCRY02GIdTFzkL7sw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SI2PR06MB5140.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: hf3qwd0W6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N63aI2wa0BQyXRfjlUNfR2x9Fhbf6UbWn6VDkFWK20MY//KHAg69YjHoFSvBlPgkcY3FCtYOar/WF++AlBmmDV6ZqjL630UgKyMnmKjTWVp/k6OduLKC7LvkoHPcmlfpbfRq4TmlmJqoCrdq6zDdey/tDAU+tfcic5Kdv1nam2mbbvd6L/0XquJwwlTgrQPIvmWUEDoW26i9ZgPaVnkjt4jh50xuPuFAKAuwjT7kwkkW7/fmc1TK8v7TLrpfSG3+rIOFfztWKuHk86Vjd0CU7mfMFl+qdEFJM1YHuVRxGxQd7ZGff49y2aqaZqU+D/EaGUIhgMbQFt6NcW2oecsjZPaaLZTE3qg9HdXFV6mVzJiKTibrs6suIxzm9FXSogscfG9lz25ylh5vpXjPo7k+hDz2pFrzJWsa0bLh/FfjoRFOIxPQ23n2Sztm3Zt+Yc9JQtXJP6ALVy0DCBOZ/3OYi2fsBwaum8ZmfH9cGtZmUCX2mZpZ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4978fd37-006d-4e2d-57ac-08dcc2b39350 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 14:06:10.8681 (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: oZ9fa7wmpRjRBUmi5BEK+eicE9uGzfaJRXcUvlEZu9HiFyvEJRE4sQdebs3GM447Ueu8pbxb6hUosNDWIGwNrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5301 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(). While at it, no more special handling needed here, remove the goto label "err:". Signed-off-by: Rong Qianfeng Acked-by: Paul Cercueil --- drivers/i2c/busses/i2c-jz4780.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index 4aafdfab6305..f5362c5dfb50 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -792,26 +792,22 @@ static int jz4780_i2c_probe(struct platform_device *pdev) platform_set_drvdata(pdev, i2c); - i2c->clk = devm_clk_get(&pdev->dev, NULL); + i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(i2c->clk)) return PTR_ERR(i2c->clk); - ret = clk_prepare_enable(i2c->clk); - if (ret) - return ret; - ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", &clk_freq); if (ret) { dev_err(&pdev->dev, "clock-frequency not specified in DT\n"); - goto err; + return ret; } i2c->speed = clk_freq / 1000; if (i2c->speed == 0) { ret = -EINVAL; dev_err(&pdev->dev, "clock-frequency minimum is 1000\n"); - goto err; + return ret; } jz4780_i2c_set_speed(i2c); @@ -827,29 +823,24 @@ static int jz4780_i2c_probe(struct platform_device *pdev) ret = platform_get_irq(pdev, 0); if (ret < 0) - goto err; + return ret; i2c->irq = ret; ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, dev_name(&pdev->dev), i2c); if (ret) - goto err; + return ret; ret = i2c_add_adapter(&i2c->adap); if (ret < 0) - goto err; + return ret; return 0; - -err: - clk_disable_unprepare(i2c->clk); - return ret; } static void jz4780_i2c_remove(struct platform_device *pdev) { struct jz4780_i2c *i2c = platform_get_drvdata(pdev); - clk_disable_unprepare(i2c->clk); i2c_del_adapter(&i2c->adap); }