From patchwork Fri Aug 31 04:45:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10583133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BD3C1709 for ; Fri, 31 Aug 2018 04:50:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29FAA2BFEE for ; Fri, 31 Aug 2018 04:50:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E0402BFF8; Fri, 31 Aug 2018 04:50:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 311602BFF5 for ; Fri, 31 Aug 2018 04:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727426AbeHaIzN (ORCPT ); Fri, 31 Aug 2018 04:55:13 -0400 Received: from mail-eopbgr20078.outbound.protection.outlook.com ([40.107.2.78]:42982 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727211AbeHaIzM (ORCPT ); Fri, 31 Aug 2018 04:55:12 -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=/8lMrKi/+vt2xJ54YJ0QBIBy7vs8gaLUNa0N+REDGwI=; b=u+6NEH7Zr5SRGWO/XaG+8Pc/E0QQ63AsQolWsP2YzPoYSL+LCAzdkEhmaPXjlshRkL1QVZBPxqR5nyjq9pQcxBTpXTlxhNGoM8zX0k2jR/5hz9kS15pfsn40Ypm5C9b2D/hASz8MkbkHBsy5nHVt8B5pcYjIJ8RnGOiic1qztkQ= Received: from b29396-OptiPlex-7040.ap.freescale.net (119.31.174.66) by AM0PR04MB4212.eurprd04.prod.outlook.com (2603:10a6:208:66::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.18; Fri, 31 Aug 2018 04:49:29 +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, thor.thayer@linux.intel.com, linux-imx@nxp.com, hdegoede@redhat.com, Dong Aisheng , Stephen Boyd , Russell King Subject: [PATCH V6 1/4] clk: bulk: add of_clk_bulk_get() Date: Fri, 31 Aug 2018 12:45:53 +0800 Message-Id: <1535690756-22234-2-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535690756-22234-1-git-send-email-aisheng.dong@nxp.com> References: <1535690756-22234-1-git-send-email-aisheng.dong@nxp.com> MIME-Version: 1.0 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK0PR03CA0061.apcprd03.prod.outlook.com (2603:1096:203:52::25) To AM0PR04MB4212.eurprd04.prod.outlook.com (2603:10a6:208:66::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 210ac8fc-ed9a-4f06-50b4-08d60efd2537 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB4212; X-Microsoft-Exchange-Diagnostics: 1;AM0PR04MB4212;3:34JX+g54hAowwSSp6B2gWkZZdvsCiFTl++od2/nFqjZCAz9T/5F+xxA62vQ+u7DNciSWi9ILdAz1K3kLo+VqESxUJvBmGhaysTg9uR49pNIpSoi+ks+vqbhcbPvHMIyFLwNJruuO8GRAFYLTVkkKfhAUHrkYOulomB7e3IoVf3mADz3XNWC1QIz0yhyERr3PCp2OvSxAqleQ6DF8a2vHEfg/A41PjkZR26+Y0WXjycMW5mljMTb96X7Zk+dj04DB;25:So3a9E4g+fE5hGZx027Pq9TAFPJtBR21tK1iVWRgb2gfOnwWoSZQtXtQodJUYQax/HLZCnletYgVqvdwd5SmiLPDC1GEzXV6HNDNayM30i1QuAk1R6GYx9JiWiYVYs5jDmLbzZDFwKPYBkkuVPMZ0kL9P7XpIc44Djvzdu2MfCun6iiFbU8fKLI12ND6KA2epcpn6ht03cGwQqpjM5npsbhK2QvlhNzU2bTqgwseYPhtGpuL7djAk0BaSYnhK68fTQiSFGpkdQMAmLG4czobQUmCE6wI2W3hRP3Z1Hz/IUHJvU7iX2xzfsXVLYL8lLCiclV0/+gBSRzxm1whc7lpCQ==;31:jH8vk+VzlOJNep4/g2zRXhnZnQ25cnfASYVu1ftVdLZabdyaVkgJ0wUoWwDccqva1Lk6GpoWp2IihZ5IE4SHwRDxXgxpDperk2iHTMYWQIDJLTJF7Y3eOJU3q8RB725mQVv4UyVgKfpgvKtSiWOolcEWN1liUfy5vrQBTxC4K4jm/N0r9brKhu7G9t1ImyIwkDIl2kSmS26niWkrQBL1H0b2wn3tKjwHWqg+8JgMl34= X-MS-TrafficTypeDiagnostic: AM0PR04MB4212: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; X-Microsoft-Exchange-Diagnostics: 1;AM0PR04MB4212;20:mJFtbdPYRNEmDxvoxW8sIfsPncOLecA1YYsQ44jKNFrExpGIEPdp8U+X5iX4t0V60j/HZC61kmRrRy/x//dg+31nYx4lnBey9niWNx2+HxitOy+myWbZRfqfsZi0f9lYTYj/1xMBJ8vyugjGhg6yiAhXyXqEBKzrCWjS0FTC/yPJ0D9+WGGWdQZ2JbddkMKDmUUhzG/1tAfOu79HIXNDmkbmI90kEuGKPAWiI2b/QcdiiE+szq1d8DZC6ah6gk9BBrBdj99nFiwoXHKssQr7WcBPCcU2r73c6+3F2XBKcmmZ4zrydj5d3PGpiA50jVWC80STY+RxOvhZjMkHuY4uD90qIQB/6y+1r6Y7FAzD7mO/CYAdc402xS2zUMnGo2Dx6tzrX+/YerO8vku0xtKWpyBqmhk0IGBnaAod0xEQs8gS+BfBl7aCypHzVIPIOHag36Cqe7nYlZxVWWowwGzPaYvkWNxNmhHmof6VPit9iYcdZRgUO3SkqsxSWC9teqCx;4:PmW4f9pJwhOlQ0Ui2vD09qEjNURhm/2QlXY6S1KXX/wHq/HKy8tkCixFe4WBQDyXIsi4qlkNxcO/ZelV/5Oqetwxd4eLqO52HDIOFm3AaOxWvfJIBJrphOny+BiExzcka5Ow4t3pGtFMlEg5iz9qfMazvr5xRKBtNZgdeKYIK6WrBi2afivy4l98Gp2YOcI8p9sRvaFHMsjelgDF8rMqbJ5+Y7oFngPZdRuo1s2w2TkqkYWctqh+rl653Roqs9h0jCmwH3lzC+BFFABsxoUXC3tMmdrq/C8RG3/Ml5PjmSSN+KKnv9C0BKbGwn9Hxf63kKytSwU5OBXtdK8QtG7CD35QmLGZxg8a+/kNW6+fa6I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);SRVR:AM0PR04MB4212;BCL:0;PCL:0;RULEID:;SRVR:AM0PR04MB4212; X-Forefront-PRVS: 07817FCC2D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(346002)(396003)(366004)(39860400002)(136003)(376002)(199004)(189003)(5660300001)(26005)(52116002)(186003)(47776003)(16526019)(2351001)(2906002)(6666003)(386003)(6506007)(51416003)(76176011)(446003)(11346002)(53936002)(2616005)(105586002)(486006)(25786009)(4326008)(6512007)(476003)(956004)(36756003)(66066001)(478600001)(86362001)(6486002)(106356001)(316002)(16586007)(6116002)(3846002)(50466002)(54906003)(2361001)(81156014)(48376002)(7736002)(97736004)(305945005)(50226002)(7416002)(81166006)(6916009)(8936002)(68736007)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB4212;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: 1;AM0PR04MB4212;23:/0d+WHTBrNMP607HtM+xhJIcQnyPeARm32JCpF9OUVEjDlCa7pcSGPfcTqC/VS4Dz2+6Ps29oxLXWl4mCDu9GzoigtGhgz0v0f+DNmPNo7iOClCyXsykEL50D6gj91l/mZSEpEsk0wMl6Ifel7lqY8WCTXFMLaIUDkGQKgteFlilJiMTgoctmtK5WWQofRqNRzlqiPH3J5OXbdqF35KTQ0bcGDgaQBQCQgCUYyZTH2jjIzdy9eUJDqntTBO0KhMvauattKbl4L5LoFepChhee2UxBXy6O6R1MalbUBVE0udZyG9OoAb3LrV8Ml43Smd/K5KNP5/uoWWIVmCrD3hQBoMo0l21chdFFPHcWk6nLnmZwITrqDBoVnO1Gq578to9nP33LcOoJSIBgrFJ+3RYHt8Xgt1/s2ByQMeWF4ntJXKvxtA7HDCnDKX6TvNGMGzZFU56PEfipEFNzH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99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2018 04:49:29.7150 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 210ac8fc-ed9a-4f06-50b4-08d60efd2537 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4212 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP '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 Tested-by: Thor Thayer Signed-off-by: Dong Aisheng --- v3->v4: * no changes 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) {