Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751202AbdIKI63 (ORCPT ); Mon, 11 Sep 2017 04:58:29 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:58015 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbdIKI61 (ORCPT ); Mon, 11 Sep 2017 04:58:27 -0400 X-AuditID: b6c32a46-f790d6d000003bf5-d7-59b65030f2c3 Subject: Re: [PATCH 1/1] clk: bulk: add of_clk_bulk_get() To: Dong Aisheng , linux-clk@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sboyd@codeaurora.org, mturquette@baylibre.com, shawnguo@kernel.org, Russell King From: Sylwester Nawrocki Message-id: Date: Mon, 11 Sep 2017 10:58:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-version: 1.0 In-reply-to: <1505115413-25483-1-git-send-email-aisheng.dong@nxp.com> Content-type: text/plain; charset="utf-8"; format="flowed" Content-language: en-GB Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNKsWRmVeSWpSXmKPExsWy7bCmua5hwLZIg59vWCy+TN3FbLHp8TVW i48991gtLu+aw2Zx+zKvxcVTrhY/znSzWLzYIu7A4dHS3MPm8f5GK7vH5b5eJo9NqzrZPDYv qffY+G4Hk8fnTXIB7FFcNimpOZllqUX6dglcGdO+X2Qt2MlXcWvVB5YGxtXcXYycHBICJhI/ nx5mhbDFJC7cW88GYgsJ7GCU6PlZ2cXIBWR/Z5RYdXgtK0zDvIOrGCESGxglzkzbwQTh3GeU 6Ny8hwmkSljAUmLHy3agDg4OEQEnie17REBqmAW2MkrcnLeBHaSGTcBQovdoHyOIzStgJ7Hp 4VuwXhYBVYmW1l1gNaICERLbvs9gg6gRlPgx+R4LiM0p4Cpx6cFesF5mASuJZ/9aWSFscYlj 929CxeUlNq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u8FnW6QQb0piZVVqUX58UWlOavEhRmkOFiVx3sy+ GZFCAumJJanZqakFqUUwWSYOTqkGRr5UqwydWj19liN28/nio/7cnCwbwbi1lk1gu+0aoVJL u3Mvk/i+fNp98ucfvq97Zhz65XO+3uSASUF0J+NpQ5+gQ7Eb1z1LX8vbK3W7MV7Fbm6OgKjt h7fB+Z9/zJE8e9RSQlj/8szkQPPn23kOflmTpsdmVDRvdtXa9ldndmRVsy6+d8dYXomlOCPR UIu5qDgRAF7UmTqKAgAA X-CMS-MailID: 20170911085824epcas2p16eb1f5d7dbf95343f050d885e9562d72 X-Msg-Generator: CA X-Sender-IP: 182.195.42.143 X-Local-Sender: =?UTF-8?B?U3lsd2VzdGVyIE5hd3JvY2tpG1NSUE9MLUtlcm5lbCAoVFAp?= =?UTF-8?B?G+yCvOyEseyghOyekBtTZW5pb3IgU29mdHdhcmUgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?U3lsd2VzdGVyIE5hd3JvY2tpG1NSUE9MLUtlcm5lbCAoVFAp?= =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIFNvZnR3YXJlIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 102P X-CMS-RootMailID: 20170911074100epcas2p15480963b2119f8954784f9b37ed8d26d X-RootMTR: 20170911074100epcas2p15480963b2119f8954784f9b37ed8d26d References: <1505115413-25483-1-git-send-email-aisheng.dong@nxp.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1784 Lines: 65 On 09/11/2017 09:36 AM, Dong Aisheng wrote: > 'clock-names' property is optinal in DT, so of_clk_bulk_get() is introduced > here to handle this for DT users without 'clock-names' specified. > > Cc: Stephen Boyd > Cc: Michael Turquette > Cc: Russell King > Reported-by: Shawn Guo > Signed-off-by: Dong Aisheng > --- > drivers/clk/clk-bulk.c | 31 +++++++++++++++++++++++++++++++ > include/linux/clk.h | 8 ++++++++ > 2 files changed, 39 insertions(+) > > diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c > index c834f5a..3179f28 100644 > --- a/drivers/clk/clk-bulk.c > +++ b/drivers/clk/clk-bulk.c > @@ -19,6 +19,37 @@ > #include > #include > #include > +#include > + > +#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) > +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("%s: Failed to get clk index: %d ret: %d\n", > + np->full_name, i, ret); AFAIU full_node is not supposed now to be dereferenced directly, since storing of the full path string for each node is going to be removed. %pOF needs to be used instead, e.g. pr_err("%pOF: failed to get clk %d: %d\n", np, i , ret); > + clks[i].clk = NULL; > + goto err; > + } > + } > + > + return 0; > + > +err: > + clk_bulk_put(i, clks); > + > + return ret; > +} > +#endif -- Regards, Sylwester