Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp793947ybz; Fri, 1 May 2020 08:39:31 -0700 (PDT) X-Google-Smtp-Source: APiQypIYf4XOUdtPW8BIpQ2GLi772L2/++7l45RuO61ROpYCYOMVioFEOmTD6uhwaL4xBYny0hVS X-Received: by 2002:aa7:d7d8:: with SMTP id e24mr4175339eds.215.1588347570887; Fri, 01 May 2020 08:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588347570; cv=none; d=google.com; s=arc-20160816; b=E1V4fo8JGHdOeIUhbObrZ++5O+pbptX14a8bNpe2jnrOd03/6s0RXsJpHuW6PshZRG bQzoYzcwR3V5rsIgbnxGfE/kK1OXlu51USID7OBa+eMyGFFIf28XT8abdSUfE2xa5N1R c+32/URJHHb32bbjh/PmWk7mlptbs0hV3kgmqoyVcWohCyzkZiUREgHq+RJIssGaQdsy ckHIvgPBILbChDQVLf2b86/bfNGKVpr5kgwmKL1NOh3H8UZZCqucV2v3QJsTzRvrVxB4 E/Uxm7p3Xz4J7/I8wFuRWxqYivvrB9hsUa4SDkDnW6AmfLkV0oHDfE1oVSWmDbgbSWQq V+mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=CCW9t2Lcf3ESlVkJ4RGqmi6BmFZgD63tWCVuekoIumU=; b=vgz1oyt8ZhbctF4YfLkwlFb/tqgYiDVcqxUmUwk/f+g1dixB4Sxp4wc37uKgL3zJ1a O5r7/6JneTShleO3qt7dGEoHHNH3T8vMQ2+4gjxnyyLIL2Eh51+EdQI2HkhXmxhDohNp U5gp7P9IEzZA4pZHUSaNkj5wySguzbqCD04DzOSCUB3yXsxFjklaJrDfH5OR2YCtpGR7 9FMsLPdZWZuysF4mRL2pKYo/PFYZe4YmCs72yYCTxY3xGgCHkByUZjKq7ZREQMzQ6FbZ F+NbXIBXD3kAkX4na69surT+kNDXuIvC1iA0/2CW0BIsKVV6VoFF2aHMc0B0vpGYKon2 Zi/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=TtzgkSzr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rv23si1912632ejb.330.2020.05.01.08.39.07; Fri, 01 May 2020 08:39:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=TtzgkSzr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729827AbgEAPhc (ORCPT + 99 others); Fri, 1 May 2020 11:37:32 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:36520 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728865AbgEAPhc (ORCPT ); Fri, 1 May 2020 11:37:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CCW9t2Lcf3ESlVkJ4RGqmi6BmFZgD63tWCVuekoIumU=; b=TtzgkSzrEtfblR+H1wVwLbiwig C8qarQ6oBZtfxDOULpsjFye+/KFqIcIkpqUOeMILNA//s3bR50E1daGGhbT5ptwh1DDApdNwbcOo5 sBLN/MpQUJSTzfYQgIEc4qimo/sF9UbZcCWJ9oL3Pg0y09HfCU4f0DqqOiHsHPtyZEJU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jUXjB-000YJL-8M; Fri, 01 May 2020 17:37:25 +0200 Date: Fri, 1 May 2020 17:37:25 +0200 From: Andrew Lunn To: Martin Blumenstingl Cc: robh+dt@kernel.org, f.fainelli@gmail.com, linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org, jianxin.pan@amlogic.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH RFC v2 07/11] net: stmmac: dwmac-meson8b: Make the clock enabling code re-usable Message-ID: <20200501153725.GG128733@lunn.ch> References: <20200429201644.1144546-1-martin.blumenstingl@googlemail.com> <20200429201644.1144546-8-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200429201644.1144546-8-martin.blumenstingl@googlemail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 10:16:40PM +0200, Martin Blumenstingl wrote: > The timing adjustment clock will need similar logic as the RGMII clock: > It has to be enabled in the driver conditionally and when the driver is > unloaded it should be disabled again. Extract the existing code for the > RGMII clock into a new function so it can be re-used. > > Signed-off-by: Martin Blumenstingl > --- > .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 23 +++++++++++++++---- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > index 41f3ef6bea66..d31f79c455de 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > @@ -266,6 +266,22 @@ static int meson_axg_set_phy_mode(struct meson8b_dwmac *dwmac) > return 0; > } > > +static int meson8b_devm_clk_prepare_enable(struct meson8b_dwmac *dwmac, > + struct clk *clk) > +{ > + int ret; > + > + ret = clk_prepare_enable(clk); > + if (ret) > + return ret; > + > + devm_add_action_or_reset(dwmac->dev, > + (void(*)(void *))clk_disable_unprepare, > + dwmac->rgmii_tx_clk); > + > + return 0; > +} I'm surprised this does not exist in the core. It looks like there was some discussion about this, but nothing merged. Reviewed-by: Andrew Lunn Andrew