Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp923782pxp; Wed, 16 Mar 2022 21:28:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZPWT9v3fNJIzHSDhjP3ZfqGMEiHKiaGRSzUKue+ip1wtH1OsYxz+rSA8pkurCFTeP2San X-Received: by 2002:a63:4602:0:b0:381:f916:9312 with SMTP id t2-20020a634602000000b00381f9169312mr2188487pga.473.1647491328963; Wed, 16 Mar 2022 21:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647491328; cv=none; d=google.com; s=arc-20160816; b=KQ7ifL8OfSecCsto2jml4aVB2VnQ0YkOnc65GAYRzByNf0n61dqtmk42o5UazwjhXL suJdoMWCH0dGg8NbpRFvLw590EqZB3L9Hm3vU/RJCYysCSW/LT6OcaslynYPo54vb7xk iuoiwkjiTExjw8LToRPRI5fMBQ2J/DJf06/0eZO/eXBinMe8rj9fRZ0n8mh0KpGGhbG5 NnhpJkgsH412ljIT80qD4WE8+L1AQq11kTGsldcfdP3JhCJpJKN2oVamXkTqARq08xyf OOHwClGuiklvDgHJab63pOI5CYqMAq0+BQRMm8QVRZQm4xBm4Ulf8xbXfiU8G0oN7jIf 8s5g== 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=SPc6U6DA+9gfsnQPm1I6XSJtQQPr7UbbNGfvlmdtkDw=; b=mmJI/KYNDOLzXFB7nHjJTIIj9Vw/g7GxGq4Vkuf9caWk1JDelgQtALwXrU1100sHBZ tQCbGn0m8r5XwXc3eBi4Ey04S32SzRyEHixggdIJsCZnEP7Wy8snjL6xOxuace4QBCrd ctJ/mx//WqQV+Oxk6ynvpUgaYzhp8/ucnbt2ZUc+r4ih2uuF7TupIZh70zSeqoTPT7DZ ABQ0gLnKiRqySkg9d6D4xaqge0jRkMXJWSkdgfqkdSECMtxacD7mQrhJi3lt9417Dxln ZKdpgsUp8DggZyjgs5qOuPbNWzTEXJdNobO++E+OMd7hMr4W/5t8o0eEmhGVXSEuYkYe +i4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CIHKi2eD; 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 q22-20020a170902789600b001533a407043si3170200pll.382.2022.03.16.21.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 21:28:48 -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=CIHKi2eD; 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 F0288F47F6; Wed, 16 Mar 2022 20:58:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350782AbiCOR4e (ORCPT + 99 others); Tue, 15 Mar 2022 13:56:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236713AbiCOR4d (ORCPT ); Tue, 15 Mar 2022 13:56:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44D9A522C5; Tue, 15 Mar 2022 10:55:21 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D7C8F61634; Tue, 15 Mar 2022 17:55:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E1AC340EE; Tue, 15 Mar 2022 17:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647366920; bh=DnJBRB69KPEnIPM6pi87Ym+S0PQ45uLanLNzMJWai8c=; h=In-Reply-To:References:Subject:From:To:Date:From; b=CIHKi2eDxeLTRpDkaifVYJP3UoodHCktIhnCjwUdmYcF+N50KnGjE2KdUfGQbabkY e9UmgBf5/TErJtxiLrCwuyf3sBZxFhIDoJ/Gg4TrXW/JXcpB7soflew1EDG0+WNJ75 e2kIqZ7EiURge5ibuELBkb9TBAwM5jSz8Dqtv7aVMz/Mag8+cbcW3m3N1vi+o98TrZ viLW4/VDukMZ+rjqCiH6IelYRlAzVqI+dQMoh1chXKwzGOTTc7VbJ0np+5SKcePbLh TyAcBDVIq5hBEVW0vsRzbFIJyPyz8znuH4fxPWH9F347Bk3yITn66aTvorKWgNMoM8 rSS5L1K24Tyfw== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220313190419.2207-2-ansuelsmth@gmail.com> References: <20220313190419.2207-1-ansuelsmth@gmail.com> <20220313190419.2207-2-ansuelsmth@gmail.com> Subject: Re: [PATCH 01/16] clk: permit to define a custom parent for clk_hw_get_parent_index From: Stephen Boyd To: Andy Gross , Ansuel Smith , Bjorn Andersson , Jonathan Hunter , Michael Turquette , Peter De Schrijver , Prashant Gaikwad , Rob Herring , Thierry Reding , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Date: Tue, 15 Mar 2022 10:55:18 -0700 User-Agent: alot/0.10 Message-Id: <20220315175520.32E1AC340EE@smtp.kernel.org> X-Spam-Status: No, score=-3.8 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-13 12:04:04) > 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. > Extend clk_hw_get_parent_index() with an optional parent to permit a > driver to get the cached index. If parent is NULL, the parent associated > with the provided hw clk is used. >=20 > Signed-off-by: Ansuel Smith > --- > drivers/clk/clk.c | 14 +++++++++----- > drivers/clk/tegra/clk-periph.c | 2 +- > drivers/clk/tegra/clk-sdmmc-mux.c | 2 +- > drivers/clk/tegra/clk-super.c | 4 ++-- > include/linux/clk-provider.h | 2 +- > 5 files changed, 14 insertions(+), 10 deletions(-) >=20 > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index 8de6a22498e7..fe42f56bfbdf 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -1711,15 +1711,19 @@ static int clk_fetch_parent_index(struct clk_core= *core, > /** > * clk_hw_get_parent_index - return the index of the parent clock > * @hw: clk_hw associated with the clk being consumed > + * @parent: optional clk_hw of the parent to be fetched > * > - * Fetches and returns the index of parent clock. Returns -EINVAL if the= given > - * clock does not have a current parent. > + * Fetches and returns the index of parent clock. If parent is not > + * provided the parent of hw is used. > + * Returns -EINVAL if the given clock does not have a current parent. > */ > -int clk_hw_get_parent_index(struct clk_hw *hw) > +int clk_hw_get_parent_index(struct clk_hw *hw, struct clk_hw *parent) Please introduce another API vs. tacking on an "output" argument to this API. That makes the patch less invasive. And it can also return a pointer instead of an integer in that case. > { > - struct clk_hw *parent =3D clk_hw_get_parent(hw); > + /* With parent NULL get the current parent of hw */ > + if (!parent) > + parent =3D clk_hw_get_parent(hw);