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]
Date:   Mon, 14 Dec 2020 11:05:40 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Adam Ford <aford173@...il.com>
Cc:     Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Adam Ford-BE <aford@...conembedded.com>,
        charles.stevens@...icpd.com,
        Sergei Shtylyov <sergei.shtylyov@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        netdev <netdev@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] ravb: Add support for optional txc_refclk

Hi Adam,

On Sun, Dec 13, 2020 at 5:18 PM Adam Ford <aford173@...il.com> wrote:
> The SoC expects the txv_refclk is provided, but if it is provided
> by a programmable clock, there needs to be a way to get and enable
> this clock to operate.  It needs to be optional since it's only
> necessary for those with programmable clocks.
>
> Signed-off-by: Adam Ford <aford173@...il.com>

Thanks for your patch!

> --- a/drivers/net/ethernet/renesas/ravb.h
> +++ b/drivers/net/ethernet/renesas/ravb.h
> @@ -994,6 +994,7 @@ struct ravb_private {
>         struct platform_device *pdev;
>         void __iomem *addr;
>         struct clk *clk;
> +       struct clk *ref_clk;
>         struct mdiobb_ctrl mdiobb;
>         u32 num_rx_ring[NUM_RX_QUEUE];
>         u32 num_tx_ring[NUM_TX_QUEUE];
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index bd30505fbc57..4c3f95923ef2 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2148,6 +2148,18 @@ static int ravb_probe(struct platform_device *pdev)
>                 goto out_release;
>         }
>
> +       priv->ref_clk = devm_clk_get(&pdev->dev, "txc_refclk");

Please also update the DT bindings[1], to document the optional
presence of the clock.

> +       if (IS_ERR(priv->ref_clk)) {
> +               if (PTR_ERR(priv->ref_clk) == -EPROBE_DEFER) {
> +                       /* for Probe defer return error */
> +                       error = PTR_ERR(priv->ref_clk);
> +                       goto out_release;
> +               }
> +               /* Ignore other errors since it's optional */
> +       } else {
> +               (void)clk_prepare_enable(priv->ref_clk);

This can fail.
Does this clock need to be enabled all the time?
At least it should be disabled in the probe failure path, and in
ravb_remove().

[1] Documentation/devicetree/bindings/net/renesas,etheravb.yaml

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ