lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1234a0176de236abb603f96ab9a1d6a1.sboyd@kernel.org>
Date: Mon, 12 Aug 2024 11:10:55 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: "Simek, Michal" <michal.simek@....com>, "Thangaraj, Senthil Nathan" <SenthilNathan.Thangaraj@....com>, "Trivedi Manojbhai, Naman" <Naman.TrivediManojbhai@....com>, linux-arm-kernel@...ts.infradead.org, linux-clk@...r.kernel.org, mturquette@...libre.com
Cc: linux-kernel@...r.kernel.org <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH V2] drivers: clk: zynqmp: remove clock name dependency

Quoting Trivedi Manojbhai, Naman (2024-08-12 05:57:13)
> >> diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
> >> index a91d98e238c2..b791a459280e 100644
> >> --- a/drivers/clk/zynqmp/clkc.c
> >> +++ b/drivers/clk/zynqmp/clkc.c
> >> @@ -543,7 +554,7 @@ static int zynqmp_clock_get_parents(u32 clk_id,
> >struct clock_parent *parents,
> >>   * Return: 0 on success else error+reason
> >>   */
> >>  static int zynqmp_get_parent_list(struct device_node *np, u32 clk_id,
> >> -                                 const char **parent_list, u32 *num_parents)
> >> +                                 struct clk_parent_data *parent_list,
> >> + u32 *num_parents)
> >>  {
> >>         int i = 0, ret;
> >>         u32 total_parents = clock[clk_id].num_parents; @@ -555,18
> >> +566,30 @@ static int zynqmp_get_parent_list(struct device_node *np,
> >> u32 clk_id,
> >>
> >>         for (i = 0; i < total_parents; i++) {
> >>                 if (!parents[i].flag) {
> >> -                       parent_list[i] = parents[i].name;
> >> +                       ret = of_property_match_string(np, "clock-names",
> >> +
> >> + parents[i].name);
> >
> >You shouldn't need to match 'clock-names'. The order of that property is fixed
> >in the binding, which means you can simply use the index that the name is at
> >in the binding in 'struct parent_data'.
> 
> This driver is common across multiple device families, and each device has different set of clock names in device tree/binding.  This implementation seemed to be generic for all devices. 
> To use index directly, I have to add if..else for matching compatible strings and more if..else inside each of them for matching clock names to find index. Please let me know if this is preferred approach.

It is preferred to not use clock-names and use the index directly. This
avoids a bunch of string comparisons and makes for smaller and faster
code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ