Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423571AbbFEPgY (ORCPT ); Fri, 5 Jun 2015 11:36:24 -0400 Received: from mail-bl2on0061.outbound.protection.outlook.com ([65.55.169.61]:44448 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1423552AbbFEPgT (ORCPT ); Fri, 5 Jun 2015 11:36:19 -0400 Authentication-Results: spf=fail (sender IP is 66.35.236.236) smtp.mailfrom=opensource.altera.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; Message-ID: <5571C1CC.7060404@opensource.altera.com> Date: Fri, 5 Jun 2015 10:35:40 -0500 From: Dinh Nguyen User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Stephen Boyd CC: , , , , Subject: Re: [RFC/PATCHv2 1/2] clk: of: helper for filling parent clock array and return num of parents References: <1433445153-25320-1-git-send-email-dinguyen@opensource.altera.com> <1433445153-25320-2-git-send-email-dinguyen@opensource.altera.com> <20150604212447.GP676@codeaurora.org> In-Reply-To: <20150604212447.GP676@codeaurora.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [99.103.66.154] X-ClientProxiedBy: BLUPR07CA0034.namprd07.prod.outlook.com (10.255.223.147) To CY1PR03MB1375.namprd03.prod.outlook.com (25.163.16.29) X-Microsoft-Exchange-Diagnostics-untrusted: 1;CY1PR03MB1375;2:a2fbYE0QUqXbNmK9M+IK8ArD7S06Og307nvY48mqkvdTSmboE+ZPvdr62UCsP2mK;2:bh1GpvPxQ5RW3w662gqIOnNUHS3BbzrWF7AB4y6m2gDq4pe1ImgDzvPEBRYmOBnDYIZ8LkvMO9Ogtsc9zPwD/IStcML16MI2RwlY4V13s2hCDJIc2Qhv6mBK+JFle7G29xKt/kUzeV+6woqM9DmeXA==;6:3UmLZd9CGKgMCCFxsaWdY+kLoSZqJpqb9hlXjeK8ky9Go1/IXF1JGarQutJIPLks/yNthiPnhMLi/ZyhCIwVDfujA5cxOtFH97X72vyx7fM4LZFRT42KMRIuNscQpbVZ2Az2spqGA/DGqVxOCuvjSg==;3:S3l3GGowRdlNaDjRRV7ME8ZTLrOJDBD3pHCaJaheZBm6g/jZevPCralhy2z9wI6fuHK9dAFXVaDuOxcyOR5PyhTtIAtvKZB9KmiVzHtLPrJemOA5uwYTJ4S7JBYC4a6ICq+7emirtCtL/4oJYEmIfbEu5h5ftQV+q/Frn0lwZLJW7CxsQB1OzKEemy0nL1jhwCB8WvfEFXHajf80TcDa6hmQTl+oD8Van/B921cAPzqj6se+TirJ8da7gig/5tJ7ESXpdNgAJm3WBmEZ1pwgwuY48G01XPDHpdDGFMTnKrbaF2r/5xcsPFeg9m7SHNhp X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1375;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB125; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:;UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(520003)(5005006)(3002001);SRVR:CY1PR03MB1375;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1375;BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:BY2PR03MB125;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB125; X-Forefront-PRVS: 05986C03E0 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(6009001)(479174004)(377454003)(51704005)(164054003)(24454002)(33656002)(83506001)(110136002)(5001960100002)(2950100001)(50466002)(87976001)(62966003)(77156002)(59896002)(23746002)(86362001)(189998001)(40100003)(19580405001)(19580395003)(122386002)(77096005)(76176999)(54356999)(50986999)(65816999)(42186005)(47776003)(92566002)(4001350100001)(65956001)(87266999)(66066001)(46102003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR03MB1375;H:Dinhs-MacBook-Pro.local;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics-untrusted: =?Windows-1252?Q?1;CY1PR03MB1375;9:+lP40Pa4wQkhvZiY7adoP8hmD4oAWmVLKRZvR3?= =?Windows-1252?Q?8deYVPKDCvXCF9a0Ry1BCBWPbRRFrK8iYoC32T+AMv87YGwu9RgZcUFC?= =?Windows-1252?Q?0ILRxwAvmYy+dARIdGZfs7eKsh6f1nrOYqXqXXEXOHy+PJuG28Utan36?= =?Windows-1252?Q?DRfBM8EGE7hTJKX5DNhxCAIuT8iChXcC83w53egYeu7V0BiRrB8BwZ5k?= =?Windows-1252?Q?mbkMElNukFwaPRry8EKLt2hEzfvZGulyMMY0mfhtATt15pYUaUgoy86E?= =?Windows-1252?Q?g/rr9PegouNjCi0ax5BHjAsaVNovzrwpFKmdrX46Bdy+dxxpGRPeFGXY?= =?Windows-1252?Q?iCIqzK6iAoUyvodGgsJNnwozhXP0BG7048csGi62YUdY7fmp5mlvZrMW?= =?Windows-1252?Q?iydYmpp1JOTAoWAYCNwiOqW96thsztJvcIc6FEBd4Y4j4weZHifPoL+E?= =?Windows-1252?Q?ZSDZtOZn/m1maHDofiVE9WAEZNw70j/+lRL/+XMvhJfJYqBrzg1gjz/s?= =?Windows-1252?Q?UYwJMb6AZS0NMFGnmVmVuXQSrZwyINV6G1kcptGicUTre1q+w0qNhjy4?= =?Windows-1252?Q?iLdjp5nYa8oBK/H7cSlFGIPm1cTnbQbGUifhyuMAsoAMHTcywed9RaSr?= =?Windows-1252?Q?4HhXwuRgaG8CEfpEnVV9HGjC+eye3ooD/3Hj9ZZrfZzdoc9PGMK1jV7b?= =?Windows-1252?Q?VyZjrI88XKK+RVM7ZUigGUmD3ycvqBgw+UbUY11ZkllqkTC0V1M2Y/ei?= =?Windows-1252?Q?Qj7RvBfo8ZgyKaKVq5JsVifuZYILVyAgHArihpBQz9cSJHZQWZHv4lEo?= =?Windows-1252?Q?8Jz+hdrNThVYTqdMQOGGbsKYs1NKXpLTasmJfMQbqAYUZA22j8AjTv9u?= =?Windows-1252?Q?oMnvsLfu2l4HB258iU06PLVdVCZui1NY5SkBz2SzLsNQKK4DlIoQI9E3?= =?Windows-1252?Q?HB6fezAAFT/xUfd5dpC69RmX7QAbDuGItE77vUrgizM6EO1Go1BLMLqD?= =?Windows-1252?Q?V/wul6unVZO1588GEU4dSjXXVNnaJ2Mnua8A1FDBPpI1n3hA=3D=3D?= X-Microsoft-Exchange-Diagnostics-untrusted: 1;CY1PR03MB1375;3:XPUCKZ7KRoCWs1Ntz0xU5++/GQyXyeZtJgsVCR/9R7mBFrm4BHTLN1munxX3tTIdssrw1t/UeiV+PVHGjhszqteuoLvOOdCrYVIfmr5SEsnN67E0VFkZqbvkbIHLTri6SIXiSqvMIGqyTma1XP98XQ==;10:1THhKFzjLAF5UC+OXHrmjR1mPFtIAPp4n4Sa2MQF0LkNluyp5hij55kV9o5vqnPGdZ55oYzjd97aIEEXgZrIeL0ZLiZFRMhm9+Rl47TGnS0=;6:NEMjYeZ28zBdsld12f7RfTYyXE1WQmypJ6xR4ll4uoV8gV0tOckQhvfBvKkEoqYF1oUqo9rkQcIYmUJHcSutMW/I81mvbJySYcC6NfuPrYCC+UVqlHaH0noUgn9dQGz98YGh5RXITqlECevLQPKtwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1375 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: BN1AFFO11FD016.protection.gbl X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD016;1:WE3yNmOU9KyNaiaKEhmNH5kw4Z6gCIpSvGQKj5ukGorvX5L1PeDBSJc4ahltAJVcNZax/Vn09kuwjStQoJqa0mfyYnrwe/H866WeZkheYrcAg0NYjEa3rkCu5GFwPJOMVY19kSQknA7e+dvMiDqE3VUj9VlYFUN5V+6kMGI5hB8CHbvEIXVJNel0aJA3sJLIKa9jGkmvRmI8f5cLscwVj2qYLepdPw9mHSv89lyAGABIYZHpVajekjV70ECUncTEuZaPlPOafJ5TpoDGjt0kp+92hTXVuco1COLPvefHnx0ZTolVDsCy6qOdaltH+MvQSrNqrPjVYnFQu+KrjshXJw== X-Forefront-Antispam-Report: CIP:66.35.236.236;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(339900001)(51704005)(377454003)(189002)(479174004)(24454002)(164054003)(199003)(80316001)(59896002)(46102003)(33656002)(106466001)(54356999)(87266999)(64126003)(65816999)(50986999)(76176999)(16796002)(86362001)(65956001)(66066001)(65806001)(47776003)(50466002)(189998001)(19580395003)(19580405001)(85426001)(23746002)(6806004)(87936001)(83506001)(2950100001)(92566002)(77096005)(4001350100001)(62966003)(77156002)(40100003)(110136002)(122386002)(5001960100002)(105606002)(5001920100001)(7099028);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR03MB125;H:sj-itexedge04.altera.priv.altera.com;FPR:;SPF:Fail;MLV:ovrnspm;PTR:InfoDomainNonexistent;MX:1;A:0;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB125;2:JraE8ate/86cBwGNoIpcon6MqGCQ5jYhhqsRzDTuVgszrHlTP1VIhn2DP6z3Rr5J;2:Eqw1J85CCQQY6n+po/+1H/3RSS1CygRCW3uVmpk61sBbohHIfHNP7UTNTYeljrt+rxETY9P9y1NK3iwPAE9VzKHsk8WaAslUMCLwsmE7VpXlqkisz8noeTlR+9FxAGnON/PmCRzLUVReh1DuS/KWIbc7PpDIAoTXJb9aCAtLS+vSVZEfevm9ZS0BtpouXW9C9MxF4OW7XO01PHM0ovSbFUET9JZOUcdHx9J8CYLSMFw=;6:YI4w5u0yHRJGrd1Z84NgbQ4l3z2kDs67aGXTwj1opbZCHNnYmRxKzCTDISn+nkU9s+CtDSPofs199tnxUky1t/fb+2nRxmYFTD4EGULA3KlG0qMh2Hsxl1Hk5hOvM9fSpd/MUo1JssDKMpykiHjJ9Q==;3:d1Fw6heBahXwDOTP2US84xopYgN/+Aa/ELYCfabkZKSqJMd0aBdDKVaViGsJINIqz2sZVBggHLe7WF+a1kQWxov+Ftm8TILk5XXpGpWkLrpKd4Q+uBp/IuwyulyuJtRbEdhBDPb8LFUX6zCwNzU44y5xXHs2mtLAqVGD4jI6e8nQlzC/IMeZjpZIBAAWpqyK07lK/aDjfiloZ9dMBPH34OP3Y/5fu6hU4L5OAMoYDUDMaVBgMMN+N5Yl34dMKnw56uBP4IORYCs6athppHgYI7qeK94RUxCwNiVfzY2Qb2cw1/1rUp/8KeRh7oqa+3Yj X-Forefront-PRVS: 05986C03E0 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BY2PR03MB125;9:WTjXergB1OUAiBgwDK7AhTyDjlNSqkNZVzmlvqh?= =?Windows-1252?Q?ookqRiA0AYvXfV1lV/w/gp0zeghNFssVXsKM78EfcyotaZQyMYqzoeVX?= =?Windows-1252?Q?w56YNDXr1aaxRKKaIuI9Nlons4P7z+rTNwNJA2ge/X0kC1V8nKLMPROT?= =?Windows-1252?Q?/0K/Di83ocATYsYbm1zQUdTjeTim1bRvYPgFzHy8+aoSOfkn0uCgn4WQ?= =?Windows-1252?Q?ufKD73i454lzg9o4BiVrqcsClFMvvxpwcbwzj2+aP4TylPBtq9ZOE7P/?= =?Windows-1252?Q?BPHwOxooqlAeY/+omBbC8SzkTr3oRDd+lvNohA8XTGloqpP46exYiE8R?= =?Windows-1252?Q?Q5jBBK8GA+15ccTg1eX8s3ARNGkqt1FmEP4o5HYwAa3RZRdVr99flCaH?= =?Windows-1252?Q?7YEoOODr6H2JDBl3MlAmGHkGzQfTWK6tdSrXQoV/KtldwQWqQ2GFsQxB?= =?Windows-1252?Q?Fx1N9QFXIou0qLPNMDO26h1lrfofrz448yZMyWCtmLR1s/mrQRoS/3d7?= =?Windows-1252?Q?wVJpWVKMGKSr3PhWsEITutmtMFBdkctlSJsg5lL6joBuV9gugjK3I9y8?= =?Windows-1252?Q?zV2cZmTT15zlUdc3Ckb9vARNCQ/IXHiuE+wAjdnEB2+kJLWTPgMhnTXL?= =?Windows-1252?Q?vxSHhGb5dN0+4zP4C/irTj0QTX2tJt15dQFRWBwVQUmTy0/EwyPwjNbx?= =?Windows-1252?Q?zRCcH2k/CzyENQyDYMT0rtQ88UHRYX5FyO8RIJFTKtI0JYWnpezstuqg?= =?Windows-1252?Q?vy8Bx2Wy32nCdCJ45actJnPTo45+N7G91NRuanUi0kwcHH7Ld6ZV9NGf?= =?Windows-1252?Q?oSF9RAXO0VsPU51a24Wc0y0tnxq31UkUMe07L5htKxPyJ6XIz4eRlNuj?= =?Windows-1252?Q?XPMOR5qoyZ/jum58bB9jSewarvxb5AAfL6DwHBdRaJ/02/o+5PIR6aiz?= =?Windows-1252?Q?78/zDdqO4QIISGzlsoQ7N1Fv79Wwlpde7HV+SzczjnwW9IcrKhD7WKhC?= =?Windows-1252?Q?cNK5nEltXxgWFu/rxrnSreuuj0LvyPzPh7c6sDlsC6zHbq2TeefBHDZl?= =?Windows-1252?Q?9/Feetr4Gjlx0guu62aK/qmK+GiJxeAUQBpBgIAK9u8wD6RofocW+UGf?= =?Windows-1252?Q?qjSmKrL/S5ee6uRcPBKh8AUwyHWLFgyHg6gTyuwzMLU3LFwOmSqFy4Ka?= =?Windows-1252?Q?ghu8V88WILiCRpbeLQvdO1FrorjD7Xa2u0uJQVBQd4OR7tu2CRTgbdM4?= =?Windows-1252?Q?wcrP1IIFJG7EBov6kR3b4z1nlCmr1abLawzmd/iaecWM+Y8VDpbf/PZd?= =?Windows-1252?Q?+fv1dsZ00nD4QgyqxX1hYrg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB125;3:0GmoW/25TjAR7/RxlpD24ZjiL3vA2DTRSH5XBI+B0/KBRCNsA3PGmuPzFcCHNVfONqlOQdVn50tyNY/4DAqMkWZsSY5mvDurXCQ1jys0/JNWk0pnUd8SItuSaEIJNSULQb3T0NF8NMDrSS8rG5ZSYA==;10:iQN6PSN188j8hZB3rmG2cHpLxgWi8kspeEMQ5mse3Id29BNx6JdCBEig8/B98G1YhmEBqq3P+JYP/eceummwz4zHiLqxFyuV5KCoBOjqOTk=;6:NMJrsQuDLIbkHcVGnKFr8zoLx+EQ5qBJPSCa9cdxnllbzUsH9cN0Nb7Dm4y948phgDaKOg5vYb9Y5K0P+jQMtVqj2xjPWfp0QL8pdVXFGfnbL1fWel914/9q78pvukiflTywybyYy8jExk9beJ90HQ== X-OriginatorOrg: opensource.altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2015 15:36:15.6667 (UTC) X-MS-Exchange-CrossTenant-Id: fbd72e03-d4a5-4110-adce-614d51f2077a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fbd72e03-d4a5-4110-adce-614d51f2077a;Ip=[66.35.236.236];Helo=[sj-itexedge04.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB125 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2306 Lines: 81 On 6/4/15 4:24 PM, Stephen Boyd wrote: > On 06/04, dinguyen@opensource.altera.com wrote: >> From: Dinh Nguyen >> >> Sprinkled all through the platform clock drivers are code like this to >> fill the clock parent array: >> >> for (i = 0; i < num_parents; ++i) >> parent_names[i] = of_clk_get_parent_name(np, i); >> >> The of_clk_parent_fill() will do the same as the code above, and while >> at it, return the number of parents as well since the logic of the >> function is to the walk the clock node to look for the parent. >> >> Signed-off-by: Dinh Nguyen >> --- >> v2: use unsigned int for size >> --- >> drivers/clk/clk.c | 20 ++++++++++++++++++++ >> include/linux/clk-provider.h | 1 + >> 2 files changed, 21 insertions(+) >> >> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c >> index 459ce9d..778bebd 100644 >> --- a/drivers/clk/clk.c >> +++ b/drivers/clk/clk.c >> @@ -3060,6 +3060,26 @@ const char *of_clk_get_parent_name(struct device_node *np, int index) >> } >> EXPORT_SYMBOL_GPL(of_clk_get_parent_name); >> >> +/* > > Need a double ** here for kernel doc. > Ok... >> + * of_clk_parent_fill(): Helper clock function that will fill the parent >> + * clock's array and return the number of parents it found. > > Please try to shorten this sentence. > > Fill @parents with names of @np's parents and return number of parents > >> + * @np: Device node pointer associated with clock provider >> + * @parents: pointer to char array that hold the parent's name > > s/parent's name/parents' names/ ? > Will address in v3. >> + * @size: size of the parents array >> + * >> + * Returns number of parents for the clock node. >> + */ >> +int of_clk_parent_fill(struct device_node *np, const char **parents, unsigned int size) >> +{ >> + unsigned int i = 0; >> + >> + while (i < size && (parents[i] = of_clk_get_parent_name(np, i)) != NULL) >> + i++; >> + >> + return i; >> +} >> +EXPORT_SYMBOL(of_clk_parent_fill); > > Can this be GPL? > Yes. Thanks, Dinh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/