From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 191F1C43460 for ; Tue, 13 Apr 2021 07:33:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEB106135C for ; Tue, 13 Apr 2021 07:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239963AbhDMHd7 (ORCPT ); Tue, 13 Apr 2021 03:33:59 -0400 Received: from mail-ua1-f44.google.com ([209.85.222.44]:45913 "EHLO mail-ua1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237567AbhDMHdy (ORCPT ); Tue, 13 Apr 2021 03:33:54 -0400 Received: by mail-ua1-f44.google.com with SMTP id f4so5020807uad.12; Tue, 13 Apr 2021 00:33:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u6UFjwuyKnQpqmhtaDp8WV1qw1jwfIy1yUFgiKaV5UY=; b=tAh9slfyuOEcT93M35aK8CW7kqkE59vjDhsIWtgA16D7CtT7P64dq42H+tG2P6RyBv UbWmiVAkgT9HfXmVMBDCDQthz2yOXZXegr9ooDPF5i3koP4STM/G31DPf/MUpmmJbNpa G5Q4JlctLMKHQSjgjsxFkkTH22TbHzkNZZcAofHDxpYDnpG6XeAMsNMR+oZDcw2cNxs+ ZphSk7dqlcgBWoir0UvduT9Oc6LePr0CmcGF6iAH6D20gVc9u0kbG23DWlwgQTsCEpTh e1vrjSPekmkMjfOvQ2GH05WPY/NgXUGkFagme4PPB/57Vq2JkCVQjljmX/HHEGsXJNWO kJVg== X-Gm-Message-State: AOAM5306Y7SccntUKGCEAryVOc5FxmjKuxs4wpzvvGWzhJyVsJ4V1ZPW 7Ub/e5s7ofiKL53fB5V3XRo9B2c5CuPUtU6eCLfcsktoX4I= X-Google-Smtp-Source: ABdhPJzftKnn6TOjbesfeLhixPr7pqyQbLq0YkT7ZLi3DpLJBP2roway01ukDACwhunwhZgE9cRvfVZzumXQp/dxKLA= X-Received: by 2002:ab0:3157:: with SMTP id e23mr21121382uam.106.1618299215073; Tue, 13 Apr 2021 00:33:35 -0700 (PDT) MIME-Version: 1.0 References: <20210412132619.7896-1-aford173@gmail.com> <20210412132619.7896-2-aford173@gmail.com> In-Reply-To: <20210412132619.7896-2-aford173@gmail.com> From: Geert Uytterhoeven Date: Tue, 13 Apr 2021 09:33:23 +0200 Message-ID: Subject: Re: [PATCH V4 2/2] net: ethernet: ravb: Enable optional refclk To: Adam Ford Cc: netdev , Adam Ford-BE , Sergei Shtylyov , "David S. Miller" , Jakub Kicinski , Rob Herring , Linux-Renesas , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Adam, On Mon, Apr 12, 2021 at 3:27 PM Adam Ford wrote: > For devices that use a programmable clock for the AVB reference clock, > the driver may need to enable them. Add code to find the optional clock > and enable it when available. > > Signed-off-by: Adam Ford > Reviewed-by: Andrew Lunn > > --- > V4: Eliminate the NULL check when disabling refclk, and add a line > to disable the refclk if there is a failure after it's been > initialized. Thanks for the update! > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c > @@ -2148,6 +2148,13 @@ static int ravb_probe(struct platform_device *pdev) > goto out_release; > } > > + priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); > + if (IS_ERR(priv->refclk)) { > + error = PTR_ERR(priv->refclk); > + goto out_release; Note that this will call clk_disable_unprepare() in case of failure, which is fine, as that function is a no-op in case of a failed clock. > + } > + clk_prepare_enable(priv->refclk); > + > ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); > ndev->min_mtu = ETH_MIN_MTU; > > @@ -2244,6 +2251,7 @@ static int ravb_probe(struct platform_device *pdev) > if (chip_id != RCAR_GEN2) > ravb_ptp_stop(ndev); > out_release: > + clk_disable_unprepare(priv->refclk); > free_netdev(ndev); > > pm_runtime_put(&pdev->dev); Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-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