Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp869710ybm; Wed, 27 May 2020 09:56:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzZ73q+6qAf/PodGBhezUBZAQXPYhBMr61Fl9qKWcsQchBbCa9Mtke/YYm+LU7I8AqDZgv X-Received: by 2002:a50:cdd8:: with SMTP id h24mr24546242edj.260.1590598584611; Wed, 27 May 2020 09:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590598584; cv=none; d=google.com; s=arc-20160816; b=RTEDZgTIMcLMyi6DU6OdTpdmef8GiHhcBb5pMx5yLu/EMeItghUl56xBRP3x4g3XHb FQM9uTGjUHYbnA9mG/Cp/X+/kPIGhR/JSguces7e3EspGEJ3JlJ9K4coducDC1xOMeLc iD099t93F5hjKXtW7mEnwq6XfbIM5TMSGYpTudQw2pmBFJVj0vC+w5AoOkNLN/SAAEwM 2lrotmdfNhxssU/j8WPVqeoxpQNvUrnRp6iS0gCDMYa07k2Zdto8zDKr5mov8Ia30jk9 8bkeK4o0ssY6+VJAsH9rauBSsR3mxoOD3j5bgmFQfZAe79AK5HrzF0/A/qoMWLDEzt+J 8mnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:date:to:cc:from :subject:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=NWu7CH2bezTG85KBlNHwvY//zMyutvvOoRy4XhRO5JQ=; b=iWckM6bCKd39Q854atp1j74OmzWXRMtpt8mUFIBUaaak8yh/NB1IsUL8Vwu2OQQ5QG yX7sWLaL/DO87JrSqSFlx85MSpYZVgOZzPbB+3CEVBzg5fHr73zHR7OQRVHEwfQnI0U9 86xv0dRq52XOil+gc0MZtxfIcoYvUUROycvQi0UoJPRdUjY3wqDrpTsWrnkaUuObCcsN EzjbtxefsmVAVccBgY/ZMZUAkTr/Pvn4D7WJhpaNY28zmIF3julx/QS8/7ulrAIXmXuc KvM6v9WJjLUCs55xt9AvryDDtiKfAqkXwIkPaKltvuxYCD5s4Z9tGCogT/XSCwKhsrau BV0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=APTlp4+G; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g4si1906804eds.542.2020.05.27.09.55.59; Wed, 27 May 2020 09:56:24 -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=pass header.i=@kernel.org header.s=default header.b=APTlp4+G; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726482AbgE0JRk (ORCPT + 99 others); Wed, 27 May 2020 05:17:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:40534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgE0JRk (ORCPT ); Wed, 27 May 2020 05:17:40 -0400 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5BFA02084C; Wed, 27 May 2020 09:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590571059; bh=uj+VcJwxkpklmPgy3gadF9fMpUuRFAx2IxDyKKwUYjQ=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=APTlp4+GzRdPiU2yOYmZla3pudgN/B7c+J6/X75D1qd8Y/R8dazrJCYwgjfc29RRX n/kNkqW0mclE5s4i6PemxBK+65EqkcikWSRdofb7GJHWTyQVrW7/qgMzYD1tZQdxYL EUUla8ViZtwvYMfirc04GcjZN7Oq7idq3JplCI+k= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200519170440.294601-1-jbrunet@baylibre.com> References: <20200519170440.294601-1-jbrunet@baylibre.com> Subject: Re: [PATCH] clk: add api to get clk consummer from clk_hw From: Stephen Boyd Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org To: Jerome Brunet , Martin Blumenstingl Date: Wed, 27 May 2020 02:17:38 -0700 Message-ID: <159057105860.88029.17177553048016076314@swboyd.mtv.corp.google.com> User-Agent: alot/0.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Jerome Brunet (2020-05-19 10:04:40) > clk_register() is deprecated. Using 'clk' member of struct clk_hw is > discouraged. With this constrainst, it is difficult for driver to s/constrainst/constraint/ > register clocks using the clk_hw API and then use the clock with > the consummer API s/consummer/consumer/ >=20 > This add a simple helper, clk_hw_get_clk(), to get a struct clk from > a struct clk_hw. Like other clk_get() variant, each call to this helper > must be balanced with a call to clk_put(). >=20 > Cc: Martin Blumenstingl > Signed-off-by: Jerome Brunet I like it! > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index 6fd23ce3cb03..d9946e192cbc 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -3625,6 +3625,23 @@ struct clk *clk_hw_create_clk(struct device *dev, = struct clk_hw *hw, > return clk; > } > =20 > +/** > + * clk_hw_get_clk: get clk consummer given an clk_hw s/consummer/consumer/ > + * @hw: clk_hw associated with the clk being consumed > + * > + * Returns: new clk consummer > + * This is the function to be used by providers which need > + * to get a consummer clk and act on the clock element s/consummer/consumer/ > + * Calls to this function must be balanced with calls clk_put() calls to clk_put() > + */ > +struct clk *clk_hw_get_clk(struct clk_hw *hw) Can it also take a const char *id argument? That will let us "name" the clk structure for situations where we want to keep track of who is using the clk pointer for things. If that doesn't seem useful then I suppose we can pass a string like "clk_hw_get_clk" for con_id below and hope it doesn't become useful later. > +{ > + struct device *dev =3D hw->core->dev; > + > + return clk_hw_create_clk(dev, hw, dev_name(dev), NULL); > +} > +EXPORT_SYMBOL(clk_hw_get_clk); > + > static int clk_cpy_name(const char **dst_p, const char *src, bool must_e= xist) > { > const char *dst;