lkml.org 
[lkml]   [2021]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFCv1 1/8] phy: amlogic: meson8b-usb2: Use clock bulk to get clocks for phy
Hi Anand,

On Thu, Jun 17, 2021 at 9:42 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> + int num_clks;
> + struct clk_bulk_data *clks;
personally I'd get rid of the num_clks as this value is static
instead I would add a #define with the number of clocks and then...

> struct reset_control *reset;
... use something like:
struct clk_bulk_data clks[MESON8B_USB2_PHY_NUM_CLKS];

[...]
> + dev_err(&phy->dev, "Failed to enable USB clock\n");
clock -> clocks

[...]
> + priv->num_clks = ARRAY_SIZE(meson_phy_clks);
> + priv->clks = devm_kcalloc(&pdev->dev, priv->num_clks,
> + sizeof(*priv->clks), GFP_KERNEL);
> + if (!priv->clks)
> + return -ENOMEM;
by using a fixed-size array as suggested above you don't need to
dynamically allocate memory anymore


Best regards,
Martin

\
 
 \ /
  Last update: 2021-06-18 00:34    [W:0.539 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site