Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2206542pxb; Fri, 25 Mar 2022 13:02:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVqTe3cddSCP+qFVYhwLAUajR5l8TKjZIU2e21TM5NgBD+E9E4aEIHcRYPOT9Q2aO6NkUF X-Received: by 2002:aa7:8004:0:b0:4fa:c50c:1ffe with SMTP id j4-20020aa78004000000b004fac50c1ffemr11810586pfi.40.1648238571108; Fri, 25 Mar 2022 13:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648238571; cv=none; d=google.com; s=arc-20160816; b=uu3MdNUd7egyIMK4zAt0ayP4rhg3C2WoaQjzFc1BfpVCJk4yxVo8/GmF5ZDj0I7aRY uWQU+2SdTyTYgcmyNnPMiYDC3LdJcOtFGJYsRYjen2X3KQ/o/iURcIaRRLK5f+Rp+cqU PTgn3OVqOh/vlhhktfoZkJWMjz9RNi6gbRpXh/vMlU8AbQheBOZqDrKrDy5wduJBNz+r lx89y3mPum3glqpG8zsP7c1qrIWiw8eYuLzKAnnKi5FEdKCM0IwxL8GQl7S0XLWKanxw ep68wHnkIHILFMinkmHKxLCp4WXKhEpd31DbPTmIrTlH5TqqyqUnKH80YX8mHdjzk9Hm wtpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:date:to:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=GZblVsgo1N0oGB65QpRbqshVHuo4yPT0akFdd1WepwA=; b=IfL2NGNZi4oK2xSyiKgaDn48uYYpTERhTdSfft+O5zaS/1wzLu7v18fFstbxamx438 iGF2K1AWOlfO/TKTccDqFwlvwcIKuoYHHVb7HULDfTaBtpx1GoKc1vIcUzrJSiwwjqRi f1zQ4Jz0IP5GEeTvl9P9xB5JIU4VIGrkssTty6+W/J6oEbYA2Z9hpQ77Ad7nmVD0Eh2S HxMJS7BWEiO+dE4dma+Q8TdDd6pda18SPDsRddyuSTj5Ag37Yja7yOJWcuaza6TowsnA AdgiNI8bpp2iPIb2CZpoOl7xO3Cw4uE1K5aGOV7V62/O9XCuVG1SvmdhABTM3E4pLnjW sPYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QonB3hmY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id lp2-20020a17090b4a8200b001c5f7c491d4si3897270pjb.166.2022.03.25.13.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 13:02:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QonB3hmY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A5CD93A591D; Fri, 25 Mar 2022 11:53:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357249AbiCYBXi (ORCPT + 99 others); Thu, 24 Mar 2022 21:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbiCYBXg (ORCPT ); Thu, 24 Mar 2022 21:23:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 373B0BD8A5; Thu, 24 Mar 2022 18:22:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DEF9DB81DEA; Fri, 25 Mar 2022 01:22:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D1DEC340EC; Fri, 25 Mar 2022 01:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648171320; bh=uXVMqaZn8hStgjCN0pNM4hKld0mfIcbqMA3pJnIYPY4=; h=In-Reply-To:References:Subject:From:To:Date:From; b=QonB3hmYM9igmCj52LQMbcAefPCtAeeP62CioWJtLf2WCSIP7BFgpfglLUXgnvy0u mTDqb6Hk5pJakb9c6Vy2GiHm0RXtrNdhsBRnI2wvrrxkkAdg4RsRbNJXhLuce0z/SR fkr1qO4ORBMri6/liwSEVHHwZ4JaDnFI2y121eLAxhxUGmKIBYdhhCYlUMOmi/x7Ln 6i1f/NcmkZK6wJHijw/3y5HAXPbcxn19/vFOPNbvTSMhMjI+a7wd4+EzrtCu2c3MJc +7PafgAxGjkdpe/+jUG6Nwx90mj/VagvnHNxvRnJQd2OYK/CN4GRiuWPo+Y+f8Vm9X B+YaqFWHmyqGA== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220321231548.14276-2-ansuelsmth@gmail.com> References: <20220321231548.14276-1-ansuelsmth@gmail.com> <20220321231548.14276-2-ansuelsmth@gmail.com> Subject: Re: [PATCH v6 01/18] clk: introduce clk_hw_get_index_of_parent new API From: Stephen Boyd To: Andy Gross , Ansuel Smith , Bjorn Andersson , Michael Turquette , Rob Herring , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 24 Mar 2022 18:21:58 -0700 User-Agent: alot/0.10 Message-Id: <20220325012200.9D1DEC340EC@smtp.kernel.org> X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Ansuel Smith (2022-03-21 16:15:31) > Clk can have multiple parents. Some clk may require to get the cached > index of other parent that are not current associated with the clk. > We have clk_hw_get_parent_index() that returns the index of the current > parent but we can't get the index of other parents of the provided clk. > Introduce clk_hw_get_index_of_parent() to get the cached index of the > parent of the provided clk. This permits a direct access of the internal > clk_fetch_parent_index(). >=20 > Signed-off-by: Ansuel Smith > --- > drivers/clk/clk.c | 14 ++++++++++++++ > include/linux/clk-provider.h | 1 + > 2 files changed, 15 insertions(+) >=20 > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index 8de6a22498e7..bdd70a88394c 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -1726,6 +1726,20 @@ int clk_hw_get_parent_index(struct clk_hw *hw) > } > EXPORT_SYMBOL_GPL(clk_hw_get_parent_index); > =20 > +/** > + * clk_hw_get_index_of_parent - return the index of the parent clock s/return/get/ > + * @hw: clk_hw associated with the clk being consumed > + * @parent: clk_hw of the parent to be fetched the index of s/to be fetched/to fetch/ > + * > + * Fetches and returns the index of parent clock provided. > + * Returns -EINVAL if the given parent index can't be provided. I know this is copied from clk_hw_get_parent_index, but it can be improved. Return: The index corresponding to @parent for @hw or -EINVAL if @parent isn't a possible parent of @hw. > + */ > +int clk_hw_get_index_of_parent(struct clk_hw *hw, const struct clk_hw *p= arent) > +{ > + return clk_fetch_parent_index(hw->core, parent->core); > +} > +EXPORT_SYMBOL_GPL(clk_hw_get_index_of_parent); > + > /* > * Update the orphan status of @core and all its children. > */