From patchwork Mon Aug 26 08:22:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 823027 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2087.outbound.protection.outlook.com [40.107.117.87]) (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 684D213B792; Mon, 26 Aug 2024 08:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724660555; cv=fail; b=blVre+nl19WG8Y9oA1pRz8zPAZlzKiY+UoLrwWVSYFHc/nRLU1MIr4SWqTB06QIgs0Ic1KH3Ck7HneiwL3L0L7hzog/eSqGrl+e3uWxqLQD2Xv7P7rIuWw9RVYdOsFmT/yPdiGh+XdTKi5w7MIryIVs5IlN01YsIy8q76LkGIyU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724660555; c=relaxed/simple; bh=SSmG5Bem7qyikRpOoPuSLc1AvczZr1/Eeugsj3e5GVM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tEy0hxrSHJIOIgX/Co3hfWO+ApiFhKB+73dHfQDpMZoN+CMvjEq8DuawuKMTLhXm2kPxg1u7QLFsXgScTRKKO2qZJEa8n2Q7hQMNVJfJHnPpYjQ8UM2RHzH/KqobR3pGEsMJ/dYhurHHs/8/guUx7NGmEb2KGyeiW3fyxUHwFGQ= 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=f2VpBji0; arc=fail smtp.client-ip=40.107.117.87 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="f2VpBji0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NI7GoHlW1Lhve8MWkpPNn3S3hzqfAaN2vbpxD/X1sFq5z3XTWGawtJifOSSuoXW5GAju3IGAoGq6JOtHDWa862kHrRZ7jIBpmTNGZ4yI03hOLNJt+Ird/hL8zpxRFlJxF2zspaaKEV62X8/WAaOEPzmLh/AZjwMyHKcKgGC+ueUSH6EHSlRKYneOvfileORU46pTlfGwWmNW5O4zBP1eYDrhb7UoWWzr12VbVU9NJsWwdwehE3nJOzq9f4IdCIJvQ6S0tEcWznVD82Oza+SDNC/LyN0OSsZuP4hGjCpnIYrRiCoMB7/kDIbcmHQjeIWYpZAfrVsD4IVEPD16PofxYA== 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=8qz03x8h02qC6gDrmqTA01oA9enpmey7Xz0yBtUzGqA=; b=UN8CmoGK8T/xBYYom+fP0H+iVXM+DmvJ39L925JepGuH9PsTiaitQxao8lOzLxAcpXXXWu7mdSn2so8HNt9XkIbDWuEH4NaNCd/vHWTScLfwu7mRCaHi3I7IdKzpRtC7/S6rzMwaGUI25+3ZDy65/5ESuSFqlYrS64hhFZfCkdeST8G4UyS8MOAAHnR9uCMYr5/KtWx5c93H5SApFjSyfQv4Ajh+c55r/KnPHmZKBNBGkVIpeG1BUsr5so9Io8gIPmEC5u1lFtz1QHmnwLjZ7mTyKXbZof9g3Q+r2qfDdVyHHtHT1VZC6gM4/lIztwowU8xQj/sL2hlpoFMVG8Px/w== 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=8qz03x8h02qC6gDrmqTA01oA9enpmey7Xz0yBtUzGqA=; b=f2VpBji0oG7TWdE2h5zEBfx05DoinIQWuA2sfmZdc/JRLzbxNH+AYgzM/j4xh2ea/X8upa1QLskLS8goCXfVIqmDpNfq8N/Cgdn/R8Kj4IBUGvYbv8b2rgXOeDU9C06ibqDe44eborIdZt+60U39r/6XCxNunrRtGyNdrScGsGC6umK7UyKjYpbdvUVd0Vx3K+GJiVl8/G6IDvMM1Y6M2kAfOptHEz1DjqZyIpuK73NPz0Inex+Qu6NdUy0iOXev4ZaQyg0ZMayK1zo0aL7d+yePNey30M2Nkth8FAvKVi8dAIlQ+I7BSTfRqdqNwvDpDuqTiUKYfyhJ+1yPWqe55A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) by PUZPR06MB6054.apcprd06.prod.outlook.com (2603:1096:301:104::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 08:22:30 +0000 Received: from SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd]) by SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd%5]) with mapi id 15.20.7897.021; Mon, 26 Aug 2024 08:22:30 +0000 From: Lei Liu To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH v3 2/5] usb: pxa27x_udc: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 16:22:18 +0800 Message-Id: <20240826082218.2331-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826081900.2284-1-liulei.rjpt@vivo.com> References: <20240826081900.2284-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: TYCP286CA0240.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c7::16) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|PUZPR06MB6054:EE_ X-MS-Office365-Filtering-Correlation-Id: 481591dc-2705-4383-723b-08dcc5a83a55 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|52116014|366016|38350700014|41080700001; X-Microsoft-Antispam-Message-Info: I67nQJVehKDnOjTiIl/EFCT1FKS0TQ9vJwdvE6RiKO2ctSWpvMwNr859IRWmPgLi8ur93Qd1OJawbzyYfFlGE7dV/9WVUsuXHSYwQB04iHQ/H35k63Nr5Rb9qeHmGDLu75zMvV4XZaHSLvMOblS9N7A7NawYhXBnYP+1MjwC9XNiAlXhHSYmMLREPdNpUMFu32pFPGavPIrLssbwaw0ngwMVOkTLQHTkr4m1vfkawtOnyAFpqVQrKtjnp6MbOo/GLj3JTsunZhaVBJXO9fUC5U18EOJU8RL6Ajc7wb9N4V+rHkLOPe5bTPSRuxIeY49giRn1JGd/M8tmwBbH4IRmBHfwWMJTRRJpXAlOpxQQXK0IY8moouItxH8GkNfq8rAIAkWFhNlng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IP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5624.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014)(41080700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GAyjYmQjrW0DVXATSB3Q+H6v6mmutoiMzAis5Q8bGTlvf5IFfYB5C8tdaX1uDh8hS7Hek2ts6pOs0+34OyPOGBjZ8zy1EuZoU3vKmlKG4bxl0rooZuCRQOwFBo92wHhUM+IiE6Iq9OxCapHZtzIsgsiZ5rWHFBBQp5z6djlmsR2abW3tnaS7nRrXmhahP29iqSrZi2Hywj1GDkZndZAMCTe/p7on4GgwwAlND9v9h2ic9sCM+jsNpxcRfbgVskuDj2uR9ckf6ZhOIOX0kupKgJRT/CEzjlZ3kkDmxwlCintDBZ2yJKIpDsMvNbDTZyrMuIVfcUrkccFaRu+y/ZEM6RUYYwTo5CgzwKQeyCQmtKoPqSYPiSTNsfbBxrXcSpjMXPklEnp5QoGZ2vk08frn9m6YVsOvuT7kZ0l5hpU5Z3Ws8+X1Q5Y5DBlxRhE8wdIrxXKjtPrJlpOsuNp9nrLoB3hlbcRtthjGTF5Wqipumlfyj85oHRe0fiFuerolknsPu+cPlpMnqsqdzKNoKTzT/Zs7gVtuEf7yJaKEhY2wXE0q0MPUu3GfDGmnOy0tg+GyKjjvmC9oRy2zAYUwZnEVpyk2QrArA9/3fyBXLhLkxWbA5j9wefIsGm2u9On5wvyQGtj3NZ5cTqccnQZZJwACI2FS05V7J85bbTW+iqJkmB3Ev5U9daouvZcsHdBKi4SjlYhLMnCTxnbhHheGomrab16Qe3rK+iTRoPZnWpnSs3dDPLlbDRpZdtl28MufOciRyYSIcg0u36dPbFXEle5lQTbApTdmkUIo/GcR88BTtgAFgufrxoKNau9E8+qZ9RdD8/QStWQ2WzvZCpwOV3bIDLqNo1i/jZzoQM5SGxWxlddw6dwZVbSbuRAnU8pggNoaB/U77cMf/kMLBpjv3O5uYj1ugLKb/k5DFCAK2vvgwFpWi1pyul1epJFqE/uJ/DtVh4f8LdYq456RI11PvSL2f8GGOjdFadKAEAR7PZNho6SgfW/bBWaf0m5/5DspxjY+sTtrCFnC9yZmHX+C0QIzrL9iPI87tkAdoxPqLHD+XoV3yIN1gjmaG+OYLiGP6kppz30v8zjppVkaZtU155Qffit8gNdjYG2dn4+0BHVi5I48xrrbhPSIM+je2xWq4iKROWJI856MQE0WXhOqcO/Ljgo8LRKtRv+AytjRbFsKUD8E+NhQLIJAFtAnM3VBFW/mjhw+BaMOIQDxu85RwH3ro/b2nY7AbtaTZv19V78HzjWyfGxXWEyQNaCv+2Nw6WVg8jIjqUhrt4IwMPu0q9glMy/4AdDnYuzODa/PJzqmgtBzdV9oxtJL6MobZTWdN1ILXM1zu5nkrmPkzJfHW6B/7p+/9Qg72j/L+Ijxk0ikMu1yB9KFSZf2WLOGqbKgHfCd4BddZ5E42w1tHdVN9fxm1wEmk+NK095iq8uMA0/7N88fu28BAOSPYjDMijWMxBN7eEsaJ9S+QJcvXmzt2UiG2MKeX30h6r9drduXuyJhOEiVpF5DrSkib4kESXr0xsqJbPSzce6p7u0qstOZJQ3SPcaHCIiN8hos8Esl4M4c7p9Zk3uCNCI1efyAfgJ+rgwV X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 481591dc-2705-4383-723b-08dcc5a83a55 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 08:22:30.6209 (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: Vfm6OgEXHV3gciNhj/fK5ALuSEJCDuPodueYxcXvbn3DZYnKhmewt3D2aZU2IUkzyfuZywvtRZ1/s8VT49/Y9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6054 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 calls to clk_disable_unprepare(). --- v2 -> v3 Fix the email thread. --- v1 -> v2 Incorrect usage of clk_prepare_enable() should be corrected to devm_clk_get_enabled(). Signed-off-by: Lei Liu --- drivers/usb/gadget/udc/pxa27x_udc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 1a6317e4b2a3..0619507d187e 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -2398,14 +2398,10 @@ static int pxa_udc_probe(struct platform_device *pdev) if (udc->gpiod) gpiod_direction_output(udc->gpiod, 0); - udc->clk = devm_clk_get(&pdev->dev, NULL); + udc->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(udc->clk)) return PTR_ERR(udc->clk); - retval = clk_prepare(udc->clk); - if (retval) - return retval; - udc->vbus_sensed = 0; the_controller = udc;