Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3315492imm; Fri, 25 May 2018 03:40:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo8VNicEJUmbEvryGmGBJU66U4vNxM2lqvreRWQExW65iKNsRRFp4+TSiyeMsHC/7FwB6yE X-Received: by 2002:a17:902:704c:: with SMTP id h12-v6mr2002236plt.269.1527244843626; Fri, 25 May 2018 03:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527244843; cv=none; d=google.com; s=arc-20160816; b=m9Ht3+QX8DDgwQeIJaPF70f75ZqlOCuWtDQLCjUs/Mu57NAqTF5PUooOYMBvCtShG9 1ovHlmeXxj/Y4sqvvJpAJXRiib9BaeZwByVXgTBC9umLTPju3WTTe7ZQSKO5ZHcW2YTi R/ujaF/LeCQhn6uFwzrQhcqgnRitCWHTZqY46lXT9F9m2ps7obXHnO7BBG26yLgZ1meu eljHTptakB1l5G0LbUVLp7JitENZ1/9M9u83Ppt1qVqFdHbnQVwK4bv6dqCQFksyEwPH Ifqdb3H13hqAdbS/fGzRSHqTJbxnV0xmZLFwMcv7lG0CHn8gzZfYGAznf2XoFi3Iukn9 p/+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=JKMmXmS41IVys8YUS6gBqGMw0NAwTeVgSb4Z+HtzZJc=; b=D0beKO9GaHz+82VNMAjGo1sd0QPzv9InsyMZ9Ni/hTL8jxrCHbRtse755tPaJy6tkG 3hYUPvbbnfimHzlDEPXxnxNvAcxV0gY3hXfaGPoAKohniuscRj2DGawgKMLJ0oo5DSJR TAhxWuK8eQFi2RidRUOCbW7+e2AVgEZbLWzXAlK2RaCNKHAH1ujoxq38ymmntPXfI3bv wj2bGZK2NCxOONuVBaLo5v0OsZJA0J1rD4NoANyfzd7EpLWsNRk1NJ2kVtWuGUjMXCfA HLiultHU2ppDznCvlZUuBhjJI+7/0WGvO8gCaVA/YtpVcK/zdmfx2atvCRDfFVEw3uae DvWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=Xj/yoSUg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70-v6si24617573pfu.274.2018.05.25.03.40.29; Fri, 25 May 2018 03:40:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=Xj/yoSUg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965906AbeEYKiu (ORCPT + 99 others); Fri, 25 May 2018 06:38:50 -0400 Received: from mail-eopbgr10099.outbound.protection.outlook.com ([40.107.1.99]:9952 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965532AbeEYKip (ORCPT ); Fri, 25 May 2018 06:38:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JKMmXmS41IVys8YUS6gBqGMw0NAwTeVgSb4Z+HtzZJc=; b=Xj/yoSUg0Z2a8/17pusxWl3N7qkBL35cURtthmJyla3Kbd8DotCCtTOxYLjHcRxtxkLBCbzwnMU0NTBI3ll1CuCqkWE40TuA6mowJUgiodLyS1UBjYjKWmZelSYDnNYtdEFsim0b9HksxsRkTj6wlbn150EGf8iiUNHrv7LcZuc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; Received: from b29396-OptiPlex-7040.ap.freescale.net (119.31.174.66) by VI1PR04MB4224.eurprd04.prod.outlook.com (2603:10a6:803:3e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Fri, 25 May 2018 10:38:39 +0000 From: Dong Aisheng To: linux-clk@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sboyd@kernel.org, mturquette@baylibre.com, shawnguo@kernel.org, linux-imx@nxp.com, Dong Aisheng , Stephen Boyd , Russell King Subject: [PATCH V3 1/4] clk: bulk: add of_clk_bulk_get() Date: Fri, 25 May 2018 18:37:20 +0800 Message-Id: <1527244643-10736-2-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527244643-10736-1-git-send-email-aisheng.dong@nxp.com> References: <1527244643-10736-1-git-send-email-aisheng.dong@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK0PR03CA0069.apcprd03.prod.outlook.com (2603:1096:203:52::33) To VI1PR04MB4224.eurprd04.prod.outlook.com (2603:10a6:803:3e::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB4224; X-Microsoft-Exchange-Diagnostics: 1;VI1PR04MB4224;3:d+7WJguJEfk1joBVR3aYM733HU6TD9NahSwRMCEz/P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MZEEbg9ZSXOjTtlo7CkpdoLNweeUw++dvv4rdOpkLvQ083Y718clnsIDKFNa5SCzThFEVqZxZc2ruSG8raNdBoooIXjoq/0eATgSoUQgXJkWhm1b3N8+WsmxYkcDw9kssPtNcZRBCcRbT3LcrZg33Wr6my75tzzkW+2rbaVDxwykHQ6vRCf2KutdEzupBc/abdrl5ECZpCt+0uPZZPvlIwGCRO4aTpSSfg3hHfzpt164SA51VFuezbtdApEvlNGwHTT1m1SvoQGY1y4bVs9HzSKJKgpJbmY65CM71G;4:MxZ2cN1Hj6y7K7nmUAR1u5H6e6htyOmHpyOk0kaxX1CFBnB2xj6ss4fQR5REv9jA+I8WQSzN/eW8A1aJFTne8ygoPKrMRXNGlaA5KhjIl8LT9kMLoOEQmi8Y6y7NSlw1hfac8WmpPM4P1vW2gOHKWRjXHujXIKC/m6ytJTJvHtNM8KoOEFBLMNFMpt41AdQC85MYlzt3HJefLxOsPQ8zJ0xf/GIpuqhAd1zQ5U+lLmwFmzqCdh7rsigc3YLTnxIHFWvG4vj6zICXSBfRZ0EdvKaiAGYZ/kYbZrOUYgnObJmTBcNhH02Qn2/UFdB0fgMn X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:VI1PR04MB4224;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB4224; X-Forefront-PRVS: 06833C6A67 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019001)(6009001)(428001)(199002)(189002)(20776003)(69226001)(63696002)(47776003)(74876001)(62966002)(74706001)(36756003)(77096001)(77156001)(76786001)(76796001)(81542001)(42186004)(93136001)(92566001)(46102001)(64706001)(81342001)(92726001)(48376002)(77982001)(59766001)(56816005)(33646001)(80022001)(66066001)(76482001)(90146001)(89996001)(65816001)(87936001)(56776001)(88136002)(54316002)(74366001)(44376005)(87286001)(87266001)(50226001)(4396001)(47976001)(50986001)(95666003)(49866001)(47736001)(51856001)(50466002)(85306002)(79102001)(85852003)(83072002)(21056001)(97336001)(94946001)(93516002)(95416001)(94316002)(86362001)(97186001)(80976001)(93916002)(81686001)(83322001)(19580405001)(81816001)(31966008)(74662001)(19580395003)(53806001)(74502001)(47446002);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR04MB4224;H:b29396-OptiPlex-7040.ap.freescale.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR04MB4224;23:6gaeaXK7Enj+utZL+yygqv3WLoChUxxieXXsSn9CD?= =?us-ascii?Q?n/gkq2FDzbuPEBrWYT+Dn+56RLwBTa6eC/8pyD1Drs7vi0C9TpWR++QWSDxp?= =?us-ascii?Q?RVraotA4QsjOvCc2j5IQD6Y9RI7jN6PMXvGQ80Q8+zRGwxcxaPbbEYkIBBdj?= =?us-ascii?Q?xxWOcY9b4Mx6/Wi/GB9xT1JXki3E5gzleP/YGobL3srjh8dZeERiKaeg7Bx0?= =?us-ascii?Q?0At8DWxMPjtBHIytAF+KHARLEJWCtUMO2fTmdSFV6CEAZrTQploOfuoqFN65?= =?us-ascii?Q?oHml/GigoE0MVgGXUk9Y31sX7mrKn6p4HJc+bdC47P8fRB3mipXN6ET2mqzj?= =?us-ascii?Q?5pNjcSpdGiy1KgcG7byc9nPy7HxwPeSbxjowrJNAwYGkeCmTtqis6qAWopH2?= =?us-ascii?Q?khjRcGNGbFfgPcvcX2dVglzlK3eX5m7ZuSEGDw9jm6fmtYlnRlq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+1nxo0Dkw9JjSwWjyw1gKOrIaFY5jbfPWrphf2ZJOp42OeiaigYfLVBX0iPxKaXw1sytOsxRK9aC3Yi/EybVUCjapnuC+LYQ3rUnHVDNfLm2gDCRAtF6M3U4UvST6qkC1Rur/mQtAYVJX1Gjx4rxMoLFBNFvi+CgTnpXQfByu08bDjmt+m4dJHwA==;5:+vmuYn41qcn0b6/zNCXVlG9X21MGjM+I8gZShq2j+WVThdXpgY4AriRZHOnTSBNKcvz0fFkxSkgLrJTU7iB75tw9hjVvfchHTL8OW6B1O8Fejy/BGUyXjlhM51qnCZJKM4RXxRlJs7iPbKeOC/4TkFiGevGQThW3kCqJjMOSinQ=;24:syeYZOJxNT60AvvjDzW3GK7dac6gNV+MRMgmT6RE2Kda2JYmccu1SitdSDQAdpQbcsK8/sx1BwVoejymF3TwcuDN14MmGXhEjdjI120ThKU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR04MB4224;7:G/F17pYqVI2Lij31zFRV7ynufUjMvY+FfAoflkcw0w6Hdb9Ib+dokdk847rBYYXwPwNldTKqx9VAu7n9GFAYwQsGTd5VmpPwK8hAG01F7N1n+kr+OGqMKBWYCBxZkYOIp5HCP7JN2+SELXublzL3bF3jLcDFOzxDgrv8ozERF6noCJ0nKbzvMJ1MnHFRtpx0d2twVE87mITxMafgWHrxb8n6KoSsZHMcoeSmngzDsl2RGc5HRCZCYOH+AJCfmEkM X-MS-Office365-Filtering-Correlation-Id: 0e44c906-8c06-445e-ca45-08d5c22bafcd X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2018 10:38:39.9799 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e44c906-8c06-445e-ca45-08d5c22bafcd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4224 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'clock-names' property is optional in DT, so of_clk_bulk_get() is introduced here to handle this for DT users without 'clock-names' specified. Later clk_bulk_get_all() will be implemented on top of it and this API will be kept private until someone proves they need it because they don't have a struct device pointer. Cc: Stephen Boyd Cc: Michael Turquette Cc: Russell King Reported-by: Shawn Guo Signed-off-by: Dong Aisheng --- v2->v3: * remove #if define condition * remove EXPORT_SYMBOL --- drivers/clk/clk-bulk.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index 6904ed6..4460ac5 100644 --- a/drivers/clk/clk-bulk.c +++ b/drivers/clk/clk-bulk.c @@ -19,6 +19,35 @@ #include #include #include +#include + +static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, + struct clk_bulk_data *clks) +{ + int ret; + int i; + + for (i = 0; i < num_clks; i++) + clks[i].clk = NULL; + + for (i = 0; i < num_clks; i++) { + clks[i].clk = of_clk_get(np, i); + if (IS_ERR(clks[i].clk)) { + ret = PTR_ERR(clks[i].clk); + pr_err("%pOF: Failed to get clk index: %d ret: %d\n", + np, i, ret); + clks[i].clk = NULL; + goto err; + } + } + + return 0; + +err: + clk_bulk_put(i, clks); + + return ret; +} void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) { -- 2.7.4