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] [thread-next>] [day] [month] [year] [list]
Message-ID: <44131080f148a472ed5dee901a66ffa7.sboyd@kernel.org>
Date: Thu, 11 Apr 2024 00:49:25 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Sia Jee Heng <jeeheng.sia@...rfivetech.com>, aou@...s.berkeley.edu, conor@...nel.org, emil.renner.berthing@...onical.com, hal.feng@...rfivetech.com, kernel@...il.dk, krzysztof.kozlowski+dt@...aro.org, mturquette@...libre.com, p.zabel@...gutronix.de, palmer@...belt.com, paul.walmsley@...ive.com, robh+dt@...nel.org, xingyu.wu@...rfivetech.com
Cc: linux-riscv@...ts.infradead.org, devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org, jeeheng.sia@...rfivetech.com, leyfoon.tan@...rfivetech.com
Subject: Re: [RFC v3 08/16] clk: starfive: Add JH8100 North-West clock generator driver

Quoting Sia Jee Heng (2024-01-10 05:31:20)
> diff --git a/drivers/clk/starfive/clk-starfive-jh8100-nw.c b/drivers/clk/starfive/clk-starfive-jh8100-nw.c
> new file mode 100644
> index 000000000000..018f5af6c777
> --- /dev/null
> +++ b/drivers/clk/starfive/clk-starfive-jh8100-nw.c
> @@ -0,0 +1,237 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * StarFive JH8100 North-West Clock Driver
> + *
> + * Copyright (C) 2023 StarFive Technology Co., Ltd.
[...]
> +
> +static int jh8100_nwcrg_probe(struct platform_device *pdev)
> +{
> +       struct starfive_clk_priv *priv;
> +       unsigned int idx;
> +       int ret;
> +
> +       priv = devm_kzalloc(&pdev->dev,
> +                           struct_size(priv, reg, JH8100_NWCLK_NUM_CLKS),
> +                           GFP_KERNEL);
> +       if (!priv)
> +               return -ENOMEM;
> +
> +       spin_lock_init(&priv->rmw_lock);
> +       priv->dev = &pdev->dev;
> +       priv->base = devm_platform_ioremap_resource(pdev, 0);
> +       if (IS_ERR(priv->base))
> +               return PTR_ERR(priv->base);
> +
> +       for (idx = 0; idx < JH8100_NWCLK_NUM_CLKS; idx++) {
> +               u32 max = jh8100_nwcrg_clk_data[idx].max;
> +               struct clk_parent_data parents[4] = {};
> +               struct clk_init_data init = {
> +                       .name = jh8100_nwcrg_clk_data[idx].name,
> +                       .ops = starfive_clk_ops(max),
> +                       .parent_data = parents,
> +                       .num_parents =
> +                               ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1,
> +                       .flags = jh8100_nwcrg_clk_data[idx].flags,
> +               };
> +               struct starfive_clk *clk = &priv->reg[idx];
> +               unsigned int i;
> +
> +               for (i = 0; i < init.num_parents; i++) {
> +                       unsigned int pidx = jh8100_nwcrg_clk_data[idx].parents[i];
> +
> +                       if (pidx < JH8100_NWCLK_NUM_CLKS)
> +                               parents[i].hw = &priv->reg[pidx].hw;
> +                       else if (pidx == JH8100_NWCLK_OSC)
> +                               parents[i].fw_name = "osc";

Please generate this one time with structures and use an index instead
of string names. This is faster in multiple ways, and the parent data is
copied anyway.

> +                       else if (pidx == JH8100_NWCLK_APB_BUS)
> +                               parents[i].fw_name = "apb_bus";
> +                       else if (pidx == JH8100_NWCLK_APB_BUS_PER4)
> +                               parents[i].fw_name = "apb_bus_per4";

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ