From patchwork Fri Aug 23 03:51:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 822285 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2059.outbound.protection.outlook.com [40.107.215.59]) (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 BFEFF383B2; Fri, 23 Aug 2024 03:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724385099; cv=fail; b=BHCtWpZWLO5HyvHvI+VB4GjBpSEUu98P7K4T7FlPxyeZASVCXAfkClfnr/EcLSKa0xTnBCPKIWxAsxmsCG/7kmrt06Hb4c/JV0zhqicDggwTxgds4K8rCCNVftau/L6du76scSfka5nHzUPSMZL6DghTUxPrn2TN2rk/MMJSpho= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724385099; c=relaxed/simple; bh=a0zLsE1j2Gf3/rVV9f8v3hrhEfqyf2LjHP7E5KBlJDk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Rlt+2vuqVqC4lRU/1VgLWYB2S31jJm8Djv7q2pn+IsOw0ytSjFuRI7LxnBSbU/wQfz2cFCH2+a/qw5sQ0obfrhand9RO3AEE6BcUskzleQLu9pn9iBM8DYC1ws2UTZ3jzelfMVztzaXB+F4xfC8dysBXU2nrN1P0Fhef4I+c1ug= 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=EtluJSyh; arc=fail smtp.client-ip=40.107.215.59 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="EtluJSyh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PE3Q6KGwchK52HvZVPASh6HNlJ2AVDoEDnF2XPmpEuk3qZHxnx79YRKsUlxZHX63SK2M66NyfKeJt7Df2Whwc6BAcn8s2RSisuTusI30lSp9bSDRB1QA0nLbM9r7e7QW0aWgw1Iafq2Zu0IcbsX9HSGf8fTxvJJpjnzNfWLk+dukk/K20jROIrcWT7mTSzBZZsb716OaeGIhfmSOwZabNrwd0DiJjXm7UV8QOarY/t+hfegYNZjn97lXq5Haky+Q7dJ55c4UtrD4sebor7DWkcv7SvooUoAeXKOiMtNGgpcYzfyCgacCkmT6hQppPgb4ydPg1ZpNHm2qI6L/w7OvMQ== 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=dHZGplsN+FjjgxoxVQpkgqj9Wvq7aq+3uRonnHdxKxLAAxu+iVX9HVs46SUnkJEFbllokMQ6EI39ajpIreGI4w1gKBxAN1Ykce574gqLsd7/aNIdT43ks03cXNHesLGjV6/+91FLo1y57O3/yl0WjklqcchmsuV/wXneCjNHP7AGxx5PkyzpZgkGzCwYg7+eGSyxIvFLAA8PPmQQjl1sn5NEInaX9G8+VPm/aCJX7izImkbKAfTWQTr4EZSmR+XD9FbM4aSBmTXnsDR/Vivw7wwTVP1HtGHyGkqDUYYiGJQwrjcNgiECa5wlSAN0gWnTrtt7LXtKIhbV8K4pq6KvWg== 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=EtluJSyhk0JkdhyJPEY+UMNtWAmj4JceqfV4XhpeVEIz78z431ffV/LbjMrm+EGIrPA6tdVtZOL4daRIfsnEUdsMLemmcVGJj8r3ny+PV+NqFl6L6rWkpw9wn6l5wpMm4OMXznwHagXYDkpHjYlB9WDT4xTziGfM1j2v2hD+7Q2aQuBec7Vo2+DKY2GphTed2+2NHe9CPmf27fUZv0+hTJlT316KWzi0cWPv8hG0b5oOqvt0JaTgSbc0UVRdDq2wmKUr4ZrtLYX7CgXKhF/x0BwwUmEjvO/ocluZJZu+7McRjgcRiyaZdu7/A1BbVS+5lPa7K/QsQDxY8bRvMYBcug== 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 TYZPR06MB5949.apcprd06.prod.outlook.com (2603:1096:400:337::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19; Fri, 23 Aug 2024 03:51:34 +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; Fri, 23 Aug 2024 03:51:34 +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 v3 1/4] i2c: emev2: Use devm_clk_get_enabled() helpers Date: Fri, 23 Aug 2024 11:51:13 +0800 Message-Id: <20240823035116.21590-2-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20240823035116.21590-1-rongqianfeng@vivo.com> References: <20240823035116.21590-1-rongqianfeng@vivo.com> X-ClientProxiedBy: TY2PR02CA0061.apcprd02.prod.outlook.com (2603:1096:404:e2::25) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|TYZPR06MB5949:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e3f713e-a081-4bfd-1c09-08dcc326e1d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: TmwKKpL9L4Og2HUnrg5ZddMBQEp3A2SVF3eqnSNHBgfzcpLgRYZUv0LJFSnzpCsqviEirXxDUuht9AtEV/P2PHhrpqGR34kH465WgUI0WJXfZUuR97bUrXzeCpx9Wj6nWDs1d+CLCiaoXKmDvoNv9KhRZmfsfY8T37/uS8UuAgWXeL57edYzC+Fb4ZUVOyqk/0MT8H1nHs5aKR4/iW+lAK+MxXKpZz2AhT3gJ7NKIAlv2BuxOQnIxYRtHW0OGOa0rm4dLiqhYC31sdkMk89lksXizSiFBag84DiteVgbb4zN2MLwmQyvoLlKBOtW4ecTE1NC3cvc8XAgouLO4fo/pDfk7sw7RuDNc54549Ju/vaWdhVttsJOz758i/ddZbYg89rm0jlKfVk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:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SI2PR06MB5140.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B3vOppJOvTxv+MQ2TZmb/eb16Wt/VLqpaQn9O4lIIjd+8SgFTyz/Zc17fOPVN12TL50d2//rnTI6Nbv9YDWHiMwaFdjvZsknmOaUBs797udWZaHOK7xezkk9V8PYdium9ortncCFvwH/5D3fCG6jaI3c2VpgKWehi8doCPV0PUQw+U1NJjvQf3vX8dHQMF1o4I+xvplFm67JwXafC0ef9jEPb5uWhyN3Zd3zSoafYSS1+lSTYaAs4LTCxYWS1SPY+6k6XrGKo4pF3W4HZI/Xw8uciWiMJ+YqGyb0k9Cm2H7QBLEhpG/zxcYjK8Tc6yNTnXIenuPhqU4ZJTjYGO8FW8TcjV+ErUjylsng4sG+xyfcFMxaJudCQ4Wzr5g/qneLLrH9QXj1kb8PSbn5yxM6T2NiUpWF9fbf22YUL2Tbzp7AsmGfJAn2pqDEXqfF1Cc/HOugAVMxIFvT4pHgts6oiGFqaFh2w4za2iQWLxUuaQcr0JKmt6fFUO+NZLt22wJYKaccScIHiH8ZPMKe3Z9eYcoD9ZDTufa87aivYmzKctVsk4LWKplYH3yZSP6r15LQ1Z9mYcSizpNopkV38JJJdE4HKqiEBW+gUekryFmN9RATl8XlH1fgNhRDntHokUBTl8z9w5U62l9CipG5sYiA+mq6+h2+ZNFggh+5NpB02vtraB1UzZOA2Sr7yFZtMV/OPxAOYYufEF7eLvBJyYM6QyeLclXELjrgQKaWZM+rWwHlSU+zafl8fUrMja6VwGK093gehDFmW0Xgl8eujhs3UZhk2eHzaH5JKqLK4mye6MOx1UTWpKWCtnqznVr/qnr85S0ATv6ClZ6VuT+VOY3UEA2C8VMqE57vjhSHJjNvu2onLP7/iY74jeumfPcSlmrhg55lCmMPFWgC5N4rTUW8eVffqNK/QDxvFT07jsTEfJEEQ9RDLy/BKiKApyWfn+DAnpQjeyqfNq+f6fXEjW/kQckrZxL5fv/avqTxSEF5kAajnHM2hciQiNu3SZ5ff0qJ0XepSQMXYsOQ25maFWRrWn0EOzh5hfIXgs1u12evcrMn5G04YoedBCjvnbpEm0BK6cyKG5AWNaJzzygl5oonlNaAVRlkV7gyAo43YTOEoXf5KVfMZTs1OHXNSYjYzpngk2GsJR7OKbUI9Hc35/CGIZxgGuRnwvrCZL+4QEPDbGQZMoIjXkMZX5xqFDb8mTY926A+cLZmuCsmXXjJPemewBQd15FGxX1Ah30vWNa8u6/ZM5Mn0wYEMsCO/K0T/MhNLj1rwijdRkZEJInbBUkKArBfYiUhN6wyRTgL77E2lJ6XZ0kwyEf/LHAIA0UChtbeq7udv3vzGJW9+YjoWbXyCiHPsp0iyKomojrmxB6Fy7rbjDek+64DAqmrZkdcRr1sac8nyvLdwnCbE9/cqD+UTo/5F0JJhQhZSZAQTvUHdAGzyMwGBMVNdFMRYKJ7PgadUSzilFR553bqHih2g8dXRtgAn2PyH6zrvdL2jRPe42e7jYEW1/5O4V+ateGtSHjHvE5zetTBiX2ZXMsNCnAhLGbh4bXPiBUNjO9dMhHfoWGJv61sQAcqNp+5mJjBjZX6 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e3f713e-a081-4bfd-1c09-08dcc326e1d1 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 03:51:34.5972 (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: cgf3AeqpPU0KkYLD+Z2Jvwgrv+cnfUu/sNoatfwaUSKf3vawJ3fo4+DFSSG8hLSVDbwM+NLEtHQ7YXZXgIY4Iw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5949 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 Fri Aug 23 03:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 821863 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2059.outbound.protection.outlook.com [40.107.215.59]) (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 19AB14CB37; Fri, 23 Aug 2024 03:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724385104; cv=fail; b=Sk8tLRCfdOarmtfxBpiMFQXmCRTrh07m900WKOSBXxDIPHMK3fcW1er+jen7oQQEkz4H1l84BPrIF3KrSUF41Wz/ZmukoNn5P5c1nHQ64iB01Flr5nsmrUDqLUYCwp6Z5lXt0ia/mVfDyLCkpZtCoB85gE1QNCLiOi9qS0lq5Cg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724385104; c=relaxed/simple; bh=rnEXFiwNKMbpfOjsw+4Sd+pv6oK9+XmnorAPrPZ8Vxo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=lvEWFimmS+huA+fW6d7Wkb9CgkV5R2a22nq1aBFiuSK7yg5MJNmeqoDYil2vU4Evxbl36J40u4hdKMD3lY/VaL6Hxzvte1UtPq9ePQTMxQ1J4Kdp7ZBTxxzX025lJLQHnfXSVyfVNZdjCo1V8p1LD03to9l5L0x+izd1MaP3wMs= 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=lNLpzooA; arc=fail smtp.client-ip=40.107.215.59 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="lNLpzooA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AtAVO+yM2ojNjGoRFFQJIrEr/Ku/J8TCvQJxqgHuPMDh4emNode+DUTCvRbqbZpa6syWMf6C17E0aTws5HVIRAL/1/OC20ZyNGN7J1iN/YcS6Wa657TKl18CFkJIo8GCL6rjH64X8VbfHv5x1kqo0He3BD57AmI3TAjNxQX9hWk+fDErBaJyMz+KFOAC0yY1oWGnatjdwrb8JeYQngiKMlNu/pBlD2pASaCUjOYrSLw5HTwso6Gu9e41DlS/QsxGtZYtcTG2DPIW45G+K2q2SPoX2PeqFSQdmyBJQjnv2UA4haCiPoIGFrvsQtDRZJwpjlxAntOdP22LYSgVybFmzg== 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=fuY0CvjcrvomH6T6H9uNr1HhlcMrjZfipupAykyAugg=; b=vg+bqdEfTJ9JKDLSDIdT2bV+UreXifBPpQ5pXFqsUwGRQ/HILEx1hDSjU3Jx/Nngwv0fHUCKBkuHWufmXHbLKgZdkuctF53L1Q4fo9xPntjdH2D4/eOwQO7ZET5vs+jrGqFtLNFDHVDefg8XLMQBSUvSB4u570X7BClmTTTxzvCyXYFkHFcneFQA1nFF6o4Z5w4mjwYo9Z68D6qtXkVw0xiQItumhVMpC3oOS3a6yXK2asxTn9sU50kFTnkaVas6T1oFrjU843/n7BzrSZc7SxepXdIWdm3QK9uS0ya3fUbnxMC+e8oZOSVOc73TsJ6cpwpDN5y8w2e8C3DJ3l9vPw== 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=fuY0CvjcrvomH6T6H9uNr1HhlcMrjZfipupAykyAugg=; b=lNLpzooALni6+DlTo5sOFHUBcgQ5tRulmtxnDP+0XtXz4L5Pbn4rel1ibS57xKth3908qzk8e5SX4AP7J7gghCJd3VypfRjIw3fQnN5XqelR2s5WjtgB0cOuM0VtIEShe9YZlw28O/ghXC4oi1t+3Uj13uZCLmoPEylmcr/yGt0Nb56sJj+Q9oqDnECZvqK/9Fp4aKir3t/AtMWlh0AEq5FjGqiMeygh+Ph6U2SsYyc9oUyGjakFBSyYAcxysv9BFfIMcVMvxLA64M02ivFjGFnI5d8lnslvVDj1ERiv33kQWf3mTOdjprhtNNpSPG66Zb1B5HVBchJGYyKoQRJVzA== 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 TYZPR06MB5949.apcprd06.prod.outlook.com (2603:1096:400:337::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19; Fri, 23 Aug 2024 03:51:39 +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; Fri, 23 Aug 2024 03:51:39 +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 v3 2/4] i2c: emev2: drop sclk from struct em_i2c_device Date: Fri, 23 Aug 2024 11:51:14 +0800 Message-Id: <20240823035116.21590-3-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20240823035116.21590-1-rongqianfeng@vivo.com> References: <20240823035116.21590-1-rongqianfeng@vivo.com> X-ClientProxiedBy: TY2PR02CA0061.apcprd02.prod.outlook.com (2603:1096:404:e2::25) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|TYZPR06MB5949:EE_ X-MS-Office365-Filtering-Correlation-Id: 581c6c84-bcc7-4b3e-1a1e-08dcc326e4e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: LAweTv7I9JOrAJRTM2WEFY+Vld6ghfxhuyjL5KX0iXGGUOkzTZcjZqCGN+/5KlL+QLCwbArHFPHxKlnCDFcS1rET78aoRomN/5PCiuYtJcnPu1RmsFR74kldVDify370oco2+ux+7TGjBrNcGkO5UPfi4amZXZ1cLP7eMoo493kjT49NDl9HyJfA3ZWfZH6sO3BDoglVu/zqUwqjFGsvGBWdw3WzQq3zj/2QKGjH4W9OV8UMqHo2avm4BY65uhnELqBnZJ5+rl0v23oW3VmfEzoWQwYhkh2jEa7fSgXG8uqjfgXZdRuV8o8t7m9ibAy4VpjoC5W8yv0SJlCMcQJYqGJnP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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)(376014)(1800799024)(366016)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WVHM9ADR9zQFovm9y3H6+0r/qZPMwWosuE7hZN5Q13QvtrRPsLJwW0y1Dsa2mkhYoUhGq+gMoimMAUSDXd4IXipPt99uhbKMlnreQ6yKqP8vJHdsfVi+k93W5B3ELgXwap778PsqdER63S6Bpl6WoyhoMLi3nW3O8RrQzaNk4Qf6Ml4fuDQjjj/wOcaFPT4giGxDQQJ3Iwc3whAT3u04+89qfaLow+E1WUY/miaB8senUjPCT2LQa5x9Jyxit7Scn6jB0zygfXUrZMZsoRN8TSaRnrzfl0LFlINzRmj2uTavagqx+rjCPJ6mLJrqjf5RMEZeDrVJcDLn0owqXPKfyucivbiJDWs5F1GdixJc1cd2qYI7jBa97cwMQ/xtjduhEV/qX+ZflZeU+0j6gP2NxpCzYJTcifM9ft9hVj3bcDh1xQVgKLDP9Aww3JgwnrT2ay1AZII8gwjEV1zD/L7pN/hor0+ZYWQ6Jl+CxvjG4bXNqyZYb91RiKMv21LtfEAOpkAxVpRw5o12MHaZCoyNhGofOax9X4QBYz691vXvyilbQARruQ3A9hRup+tqpDwGdEFYGj2W7AH4SBfYYlmFAEiZAmLFgFLBxJVsSMMp4ZgQ5sM51o575PgeSy0BL1338rLQJk8WYQV1EH+rzdkKOazSL++ajzwYGC9gN+LfpWm20YKjybq8rJs+gP36+1B1Dalew8vNaMEBAF7W/iL09XHW/wJf4UvSGbQmbg2eIe0fSbYB7MKT0uUtnw85wfZmsEBBx/9+Zi88ZzHYYgYS9/Qxa5zzYrZHxcKKVm7esn8Hsd5Wmygv8O5s1Mn0kWk6C7tqMP3//sf5u8zJbhVWLAjTf0wLs4d5Gbr7UrEKoX/wgrFSfgA58O/miHo/f+0taeKSZyPAJ6g8lWhsrygvDbcFM4iEISEpIkBgdRg5FffSh0wzVRMmTNMGHDW/K8Ro0gyWzfXR63E6cGI4DECNa7i+LXe95XMGQeQ56uEkSkHyO58Y/kUAfPQOJt0qIVVYn4zIfFWZbTQeu/EGhvV1SL10yFKm+Yb9hPrYzprgDOdwUgIJMRai0a1EgmJCWamgyl0fScw2lyAvFUoctNXDuCnuZkHW0xIJ21+70rLk04wFdfnzjuMaLLlHlWkl+2lHfggbYYnqL64M+4EFg8Oqhi0XyqwpwjlryE6jEJGLKQuXnJ1xptlif1WcOQct0jRdD3C8cdhHvzCsMXcFrvKXwQauEDrysPgCUZPF6GeeXtwC8yCCjrc5aWlkHaaRtdK9a0Au/GeYmaoA99Aw9eVAlL7PpgotRQfcmP13Gvs+vhLEo/P6YzWVLVa+4ojcpGRZHAAdGeTLn6LIzOzRGMa01QqMH9CAFLgZNKoYvWtcQt1CwJhcS17PKiEiRq9b4AC/1eQ3+BfVIKgfkmExb8JA+33oB6Df8cIorJ1pQWNd5NLXgkFi5H9Rg1lPLwId3d5MCzAsozoyPjKh/rLYEDwPjmzfavuux/cI5nMPxu6BQOfnz5YnjBkZtISeicaoZuZQFqVQQXRXvZlXXAgA/EhnKWTQxK12GMIv5aJtmLd2K7MV4n2n2s4O7KVCmPvplY2D X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 581c6c84-bcc7-4b3e-1a1e-08dcc326e4e6 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 03:51:39.8131 (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: nHQAd92Un3eTPD714jFxN99R5nX9GfW/mW+xtvhMI9/3YFDefV9h8LmPbgv+8qNnJcYZxB2a5TB0+zThqFJdrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5949 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 Fri Aug 23 03:51:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 822284 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2076.outbound.protection.outlook.com [40.107.117.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 D8F2652F9E; Fri, 23 Aug 2024 03:51:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724385108; cv=fail; b=dHls/ZROEdtlSa4ru1zP9ceCPwwZjj7W6OleWe03qRFBUE64sBylRlM2kYA4vSw1clKicbOcYdB1pjBK/0NJpWPsPS1X1vRwVlaKuG6ZXyxyt83VBXGFEOitA3QghD1Uq0V8hc4CjxrFiIRoN/cBlFZ7tTMLQNvpw/Rl0dADEEE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724385108; c=relaxed/simple; bh=vnalnjId2K+5bbr4HlD5b3d5EsYOi8iZr3cfDy4oQNM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=PAi3K5vpiWfU+KhXCjhUiD2BxurfvyTGFW9ekZBz3aH6LwAvsr4XSVwW5jANU02BZ8DeUbW4XgiijhUl/q7lMCH5d08OsUcK0At9Lg61F25vkluhiWzEPIiESkR+4L0pBrCfx/S8t/iGdl3heEkDLDb5FZZitE66aCH0AYtbxOA= 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=WYvCBZPW; arc=fail smtp.client-ip=40.107.117.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="WYvCBZPW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nMskmwxReQjq6eH4kS2mQWhLVmr3w09HVqsUUL3G9uH2CmWvMdGmj6kQe2o+PGh6XOxtcnb7doiHTEAo9smKC28+vkfs2iVa71TcGbf4W8KHqZlch1SmULbY8iibWNPs1w1EmucUnkCDu/NDlZMeX9xaXJOMbZtBr66wKM7vOYZlmS6shSlu/PBMEPmYXZr9lyjki8yG576AyNOtPu3rU9EWKL8f/7GMhzceLNfZKMmJddyzaMkVfRtrvWB1FL77hgZ9tejPICgjCWcatdJoR64OKt3BNPFhndombrMESR0RPQitLeV84IEF7TotOboB9ULrvODoV+oK9Y+F1pEc4w== 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=buLR+bwBpKj8AQjnOMP//ts+09UU6bqFaWxEYAiOT+o6qLkQO6KNjv1WT/BIzpl8y1WXfdn4s9kISmDBjNlarRA2jLAHPuQQb61iW3f4vEUbyfTu+DZtGPbYXakGtFTMulxsp4PfqciWYE5IDo0rnNteNSKIPyN4oExV9wUnpyWKmBpwhuRjFcTxbd6W6LZS21g2dX9IKNjyajyGmkzHedn0xkRJ85AXxqCBvF1hw7CmzlF98qjKosTaT43UcpA9299caitb1n6RpPMNdcz3E0mrgfaiYFp3ZN6MsK7EqeBuFBM8w+XmO9y3oI4zBk8BGJrWTWaDu2ZIeU76Om1/Zg== 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=WYvCBZPWvEjUg+Mg7AQCiFGjXcRJkNDwJYxFF4+qQs753QQ0oLQ0mtYlV6gUn/eYohLVnMFZwlgqSMt5geN10y13z7gzMapTuSV34kNyZGyttaff1/kvZyLuF5gBwyx/DA7IXS2ofURDZ0iAQukrFkvcPAgWQxyqXl0ls6m8BvBVUVCn8+0j2hj0/2wKxiZ8mZR3UeegtYBunCs/q7jzKDm8axpf91+NDoG3hyTNL6VxACY+vIB4JEgYMdTQsHOZMmIcSJTiah63euOb5Kq4vc5/vnSc6O9BQXVojWANV0H51lxIvVvjLYvY3I+jyVN2jLEUka9dRyeckES2AFpXiw== 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 TYZPR06MB5949.apcprd06.prod.outlook.com (2603:1096:400:337::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19; Fri, 23 Aug 2024 03:51:44 +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; Fri, 23 Aug 2024 03:51:44 +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 v3 3/4] i2c: jz4780: Use devm_clk_get_enabled() helpers Date: Fri, 23 Aug 2024 11:51:15 +0800 Message-Id: <20240823035116.21590-4-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20240823035116.21590-1-rongqianfeng@vivo.com> References: <20240823035116.21590-1-rongqianfeng@vivo.com> X-ClientProxiedBy: TY2PR02CA0061.apcprd02.prod.outlook.com (2603:1096:404:e2::25) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|TYZPR06MB5949:EE_ X-MS-Office365-Filtering-Correlation-Id: aad497a7-c2d3-4751-11bc-08dcc326e797 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 36MVoks0pco1Hw4qkiwvwefejuNvpPOmyCemGvdGLQxNYmu4ikTuAY8OzZEYgkMgDF6O14BbcTkPNgmipUeudyXyQPIW1CpUNnR3s2w/h9sBBF+gKiM7frkzqtD6cLSyxzjYhYxHaQvSlnPmOn79BlrqzO6u6gpsH7wvvAghalJbkN9GEru2UyrdIAoFF2OyzGNmS/7mnQcRvl51/wMX41yt3+3NbDq7fqb7vstLf7E5XmVRaUf3D8iyDNV0WZ3D+O75GXbklDhfK0KZWxL6MkArG9uwXekv/DizUWr0wh8Qtq/DA6kbCc79X+VHrlsfUupewvxZZJWz4KZGy1ZkQWRzd4MJOeFOmUV5aQUw67rFBHf3v/gdfiWlnUKsgwyKHm7dEzmGjeU3JGxf1sZe+8u2a+/9m4D5mA/mIn7PqD9JGGPvZ4lAv79nCdaPfD3wfrga+F9HR+yXRCgA7zEgn7hxrW4qXIKOon05DqB7tlTS0sxLRr9dS+rOHKcciYhP6HHpbLHB5E4l0zYtldPLESqO14eqESe6hh1h3DVWTCpahqFR7PKQaPXQtKXcJSFThfLxCrCkIN37M7sfKWbS7EeKENJhkK4DuSo7TIl2/4N5rQJG5NU3iUYUE9QKVyd9yHU2kqpJyl4GkSR4sZP53BG2Vhk5bGoBa1bTIUq/+4ElI11++S6mdu2aYPVvlq3lX+RbC9A4jcNplIydoSWApxsjl7WB8vQL81BZd2tRWO0pL9pR3VgW6YPW4IqxmLQI6NjxzcLCmkcg9scr8Fox3VAiMwLwiRF4UkXddTLhGMXyOOBKQMb5p+sXy2O5cpqONjoIkb70lU/VCmrG40u3R4HQaUzFM07q2bbEPj7A0/AjVToJr4ZDLy6F6G5WKm9U2WhkVULyApo7TVhGZdo8o0A+spKUtNzlyVKyw3fDx0weHOEwlSzkbPJ91vn0dXEBasEStlrLO6PeLQ1lY2kqUTcFYsLa3vroSNUI5SBPJI2mK/LW4XLM4uTykp11mbH9Rh/A2jzfCx3QYuXA3jNEPdyQjPP0DqvAY0H+k/6CkSTf0LoCtFfkgITfZ90t4von7tX8Y4ynbCmZjg1PtLTPxN7uQGQDG/t1qIx9uTWnezr4wjPBqUUufPECG9KmB8hohuzEoV/QURNi9egcjF+eJnSlz2hIi5HmyXgzdJ3lcVNtc9Qer3jU4utVddxiJLjp5ZEB6L7IIIn7DN/Gh7i/K3nd4nLDy5vPOUM+jYlHoO9U+mhaX6trJ0HGsDCm7vSQAZtl5Su1wTEj1MHeyw+a/YJw3+w0TnG90ZdARTnGkSSYzBHDuDQxwK/FRU+HDESDPyCSnH1PbMZDCDoPr5+fAWanl8pefyFkliell1bUY72BzjToZktXEJ2nywrqlSB5+I0jwh1Lf7xoPgF19XxIJw== 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)(376014)(1800799024)(366016)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: l7NaGeJTN8txYaCjXraFFgQ7dlnrdUFecRImuPiM9gmcAn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JeZWXYxMXZ/+IFvUfSeJhuHSRHxeXLrXyKH9bEsidjIdoMajj5nfeLjUVi8BUaSIMjyH26l5UdojKjvjBAcPZN0MYfRMDj4lJcLMe8yRoAN3NOUTrpGuNjbZCarwtDmCw9xlWysuh+mMSySB3s4ytepgKcTVFIYjKeXdKX0/UmilkCiMm5nkEXI0WvynQGT+IiHK/GufSCu2EXfI32CRfuCvEf2qhrLD+TY22TTpsCTsYuxAL4M0J+kDKTUK6GTq1iceN9PNVpUhR41FrDCOMFQZDnAC7PGlzET3Tiuoj9f2oP9b8iU2gWwe85fyi1tBGrOP70NwCy9gXKVUzqH+PEKllKOLSv+mX1M5ald4wUv8X5NSSM8dNzV+xDJ5m+/4mICX79NWcYaUMd+lJwMqgDtzPAU1127Sf7Avm147PYICFoFSZhIdJ53JPuGZGwnZ2B3iPv0ERunRh/9gQHQSjojRLmst/ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: aad497a7-c2d3-4751-11bc-08dcc326e797 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 03:51:44.3054 (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: DTUbGuMnDAQfEHrCbRHavOUIrRqSar9biArMErdMnAS6W34ftRX3WRsPi0WT4N6gempAo4tskWsF5S3h06gNrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5949 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); } From patchwork Fri Aug 23 03:51:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 821862 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2057.outbound.protection.outlook.com [40.107.215.57]) (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 642B96BFB5; Fri, 23 Aug 2024 03:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724385114; cv=fail; b=Nx/jvVFe6xToPb1uy0KowhT/5apssTfHR5u3PVB5ePb/0MKZCHyDxjnmCaDOu7nUxF/+/Ph91vLYDc98xgvSyG23Z+5RFRkgCsfLAdAN4fV6EdiKozEQV53moCUjcIYzaQx4UxRUVvaL86yqBojLlWsNk+/XPjwm4N8HpZiR0Aw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724385114; c=relaxed/simple; bh=e56qIJqbwOCTZn9ppef18ZoaON5sqKdeil9QshSltV4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=t+oj51nx4QkmGNEZqx1eNSgh91jg7nwsBBJb8Gn0sTZbmn+Z35ukSX/zydfEopchLWFofr6mNrbri6mtktpKM09w/YIy64JHNmDc8Ij13p2bmroL2iyHjO8UPtzlcBVNKSxH1xVwlQwKU9skzlMCV1/IqBH8CuUdFn1r4zDDF1Y= 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=JKiR1lsT; arc=fail smtp.client-ip=40.107.215.57 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="JKiR1lsT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EN0Z3lqOJFYL46yiwMXlSZdUcK+ID2/iW9r28x/Jkr8Vd6EKwZx1Ldj+z3JQLNWbsNo5rBuJ7TO005QoRXVu7aUy98p1ieU59WZffB/tHCoLSIBbGaxtvDEw0cyS+0Ky4yMKms8P7j9O1TWn4qfxNMqFuU2kJXG06TzbtAAjIU0X4v7sc36EoH1X7d6xP0iSF0ZIE6W7CUndBRyYAMqGnL19hDaUbHWjgvcApS6Lg4O7JBBmiW9IaDKHqaFNGDGm1Fkm3XRQCtulv/hywDE+YKVauVIe9Ixr/aWnx9ARe3FLstkthO77Smt48wQdtk9T/iiFoTXcj7dRLxPEvKGwaw== 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=OwKDZYmGKw9a3hNIv/FBwEXst76Lx9rzoYJLz6Z3k/Y=; b=prji6Z3pq+c6ncOgvKtBivzaB9dO5S/DCWTleAgcPk83YT7Ypmu0BgFE3FPNIe9tnloLNJO3PP8EehgBDBexqXOvodrWI16jaNIBPGOsU7RYB28NobWc5pEscVe19TDOevrZ+CGVEsOhpSzywDupBOhMnBlsZPhewiT89cnv6vz8yNcFAOuRLIZJXdQMcvtzcdAEySwzknTsIwYQEd7YYlLCKXDFpeb2+SXEzf+6xnyqw2ZPY4Z7quh4I87rBjKeXi3z3eCwolhrWgXTkyxueI9yII4kIktT8kVKclpKqrcshk/j6+t7rjrbEiVWP/p7dq35iCr8tXFiRGfvAZhrkA== 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=OwKDZYmGKw9a3hNIv/FBwEXst76Lx9rzoYJLz6Z3k/Y=; b=JKiR1lsTXX6l/FLQ7/PfOblEaZRnTnt9cKsnK5IdfMCD90dGn+7dZIvcWZR/Z5Tx+o1wpffqbhs1FDIBfOCo8ujms8x8S9+qZs1tJmwLKdohJLJjTTNSfinTJQrYLKN4Uxb6lLwAV/vBLt0uTPUMOY24Ksa1YrA1RzlW6eUVW37UPrtvfHqHYO9fyRLXy9L57CUjFuOMkAcSbJ8iMh4bt73NcEr0vKxVZfir8ibdFQWdljfKybnE/UF4o6SZ4FYDpYJoxO6BInXjqKPlMYLr+8UgbI9DWYBdCXghi+0bv1OO2yL4NN8CNWhANv2kymrGzlqRc1vFHWR9dlsE9LIkJw== 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 TYZPR06MB5949.apcprd06.prod.outlook.com (2603:1096:400:337::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19; Fri, 23 Aug 2024 03:51:49 +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; Fri, 23 Aug 2024 03:51:49 +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 v3 4/4] i2c: jz4780: Use dev_err_probe() Date: Fri, 23 Aug 2024 11:51:16 +0800 Message-Id: <20240823035116.21590-5-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20240823035116.21590-1-rongqianfeng@vivo.com> References: <20240823035116.21590-1-rongqianfeng@vivo.com> X-ClientProxiedBy: TY2PR02CA0061.apcprd02.prod.outlook.com (2603:1096:404:e2::25) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|TYZPR06MB5949:EE_ X-MS-Office365-Filtering-Correlation-Id: b5c33e95-2bd1-412e-009b-08dcc326ea78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 7/xM5XR2brAIxjwJ4/ztbQHCCnuZ60O5Rq3ydCHRjWA9ZB/dZeQvmsJV4kTGq9i46rguHokiQgZd8Gg1IRgwYSam7mrc4LAKEe8HD1n7O8yPf4H1BX1Z0ZWVWGQBlbSZ9BLHFAC0mV5npqr+G91ClfVQRhsS6RgeRkYmFJA3LzGyALVb1yNc0Tomn7M7CpGNRCJ2uULpxS92aHMkHPDz1bXCloLJUwyYjhuYXIbHyh2xTlzdU6ypfKtANHdSjqFoDucXsdPsmZjtCWt9weuJPkjAU6vxBuceGfd7MzEkPs1N+a5BF5L8kBaqvKUYKKqAs0ZxjwX+BnQG8HSnvoyQ9HjFXwO20KOjqm9JraQIIlHTh4+qvEQOluQafgvoeXYESVedmllLpES1KWa5IkG6qxsCFt9rYt0fPMr+bxGa9QtEUK7y4eYBi4iUq+vtqDsanOMfeVMvM48mMdh2gdDFJn5DfIEKOShQd4ghnz2526eZA3WJ5/UMl1LdImrc95V/mqv3rT9NubfIZOCiFFCPyJPQLkPWQzkJ9Gf9uDPh2ld54eX0xUo7+KLKNWLWFVfKZNp11H4wL+8KEpWb9A69oJsaxNeuLJMzI2ivPh0vjoUAohA1Ww5GYl4sitA5pTZzQYdYF+VQyQECVBg/6gbUJsK4aWFKfZzcA61Jy3qpMWB059q+OTKMZjzzZ+cNdHJHzPYhNEtMU4igmdzHp6kED0vFAtehwchi0+si4Gjoer49PWSaozo1cJJN0FTQslmIK3FsR7984YG8Vh8wm+hUTRtJ4azAGIpBixNJlVEjAYIrzITAntQr+Dy0P4h6mzqvGQNt7VoZfzh2lLLzt4/IVrwJk8gwjn9rLb4QomlNmi94MjPuIsRbZ7ThEgkqQ495orUYInSwyfNdN0coSDlA/KcZZAUKjmYNyknXvkrhKJF/GrYquVvdSTC8i81ZiUA/esprMlpqCXu+TiLyWTkoB/3La8Ru1FmfZQ8/r/jxZO3wFfFezSatRDkAjVD7MDYGHqRhF9uJWf3ncpStBnF/WlWP33YKF/NcXwV1bJapOK0pnn8tXYEyNpCwccqhV9D5aYJtnURr/79TTZaOXZaD5jdcFuIVDdij0QoHgNkTeHhv+fqdEYf0oBzY7nK4FYTp1KKoCxssujet0xnugWsJBqcJVR+iFrlrtWI59uJxTWHt249NCjO1Waz56kKwrNmZMMFHXnCEEO0489hcaN6V06Y8QIRaRLkBwMD6Xe/C0fis/HHEfQjeS1WWT4DtnBrjgA4dZ++qPny7P+6dil0DYS1Pl3cdW80W8wqLqNiGk+tvnHiJsqwzSTM/gRN7OEOwdjL/zyKk/+/hpcHi3+eYWCJB1JnmrocLJLNvkYtsa+FU7W15FAH4h2d5yBa+owoaZDKUlfySxCw2kxXV8aP6xA== 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)(376014)(1800799024)(366016)(52116014)(38350700014); DIR:OUT; SFP:1101; X-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SurH5k7j8eHLT3XsfVmmjg2OgdHg5xRvLR6OnuUwjem0kKzeqRg2bI3ub7QHafVCH6qtdEj4iwoIOSIyPXqO9NDdGaANy5LjOyDb/b1Q+ZcZR3VZz9ms2VibI0Xx/0JWDzxrb35FwK9oGaPxzMdCp6b03sQ+1CY6PEY199u1tz35x3T7R12tIjjjiFCE2CfaPWjj0XfoDIxo4rukrfJF3zFySMxT0BFr0AhzVp4Z+oE8PEX/CmgL4cqUTevomxpd4lQqjB5x+l6lwL0hQ23UTCuhuxMB5FtLIhfg+H00w8bYcdkFJCzTWsWCoC4iQELlBlVW0qFcCDMxgSu1Ix/t9Hv1IwmniAYzKQBdkCoaskyRcVqL29PtSAZlksriCs66x5fgMmVXgtSL36xULjuLeRJOEK1Y0LGrQGn1zM8A/jH/HeJ0aVzBIediS97iBJ5jkUPGAq9kTFHboj+GgeTUasdq4Je0HNRdClBagffj4iWnSbE6SRuaeWoGmIg9oL0i11XuPJH4otq9t7Wh2zZDDsdx8kV39V74H94pKtHvLm6yVAyMOXUuaMv X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5c33e95-2bd1-412e-009b-08dcc326ea78 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 03:51:49.1545 (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: tPojTmkI08xIe6hB2tf1q29IB4TbV1uL/YN8U3Tbda+U3BXJ8hqbRAjbPT5z2qwMqzMmAyx0GN1VJqnnD20WuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5949 No more special handling needed here, so use dev_err_probe() to simplify the code. Signed-off-by: Rong Qianfeng --- drivers/i2c/busses/i2c-jz4780.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index f5362c5dfb50..0cb52a6d05b5 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -798,17 +798,15 @@ static int jz4780_i2c_probe(struct platform_device *pdev) 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"); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, + "clock-frequency not specified in DT\n"); i2c->speed = clk_freq / 1000; - if (i2c->speed == 0) { - ret = -EINVAL; - dev_err(&pdev->dev, "clock-frequency minimum is 1000\n"); - return ret; - } + if (i2c->speed == 0) + return dev_err_probe(&pdev->dev, -EINVAL, + "clock-frequency minimum is 1000\n"); + jz4780_i2c_set_speed(i2c); dev_info(&pdev->dev, "Bus frequency is %d KHz\n", i2c->speed);