Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp933994pxb; Fri, 22 Apr 2022 14:43:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq3BPZWUoUV/2SoYQz3eeDOnyoHWNCSz68D+NG9+i4ziq5UAGUsQg/DAvEEVmpdr79OHXS X-Received: by 2002:a17:90b:1d84:b0:1d0:6472:e0a3 with SMTP id pf4-20020a17090b1d8400b001d06472e0a3mr18357436pjb.207.1650663831971; Fri, 22 Apr 2022 14:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650663831; cv=none; d=google.com; s=arc-20160816; b=XtJ6g6OsTdwmdO30IQQ7c015QSVwDUZalylfMyloE7ydzvpsP2mK/bmnoPqSUK0DaP E2z6XE1XDPUu3qubE8ME7tGOx13xcGMAk+PlZHtvDpr8oxwoPK35wTmR+IVBWISoo6Gf lZIeUUpHSNqkwO4Ov9OcJ7RGWIsUZBhAeMAetaToTOQQnzALKkiwMpcD+xUOx8LT0iH0 hjUgOWnGX31lgQLhoxjpdrwDeRNWCd/N7ybRECusZeK1xgRfLtnFJFZCY4+vGW4hUelS aiOSekf/vvjpoJbvlTHanSS94Q/MVO/zBIUZ77A+69Ph0/gLtfUvWcynNpALny8zYNV7 kfTQ== 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:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=PN0Dbl0tCtO+d9enDO/FcwR6UUzbzzTffYPDriLO3tc=; b=gXdEWlVXyiuGUZBKLxhvg6QWPimYoFZGZfQNqxogGe5zioqEPRpO2mb1WR83WN14yQ ks5ncAojXF1Bp1uCRDaRqjHw8/SWwlEKguDX7yPqX5D7cNSFCbznW764EP16ycLdgxJC 0wOKcZJ2LNscsRZujrN1Z0dR6X//xycMubwEAaNqI4oh03B2zQnp5tENU81giJDtYppW 4XDYJN1fATIclb3+pdbboL9wRDh+WHxvg9gvolrhpODOwjlNR3+u7gUzj8kZvAX19f/3 8y8sLk+pDtc+vAapgXaNzHccsswXxTA5smqtCMP9G/Y1KXzK3fIJUbVg2N9EUItMFkjo 1FZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m0XkKPNl; 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 m24-20020a634c58000000b003820d821f00si1710349pgl.473.2022.04.22.14.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:43: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=m0XkKPNl; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E93EA322FC8; Fri, 22 Apr 2022 12:51:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443135AbiDVBnk (ORCPT + 99 others); Thu, 21 Apr 2022 21:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443125AbiDVBni (ORCPT ); Thu, 21 Apr 2022 21:43:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3326D49C9E; Thu, 21 Apr 2022 18:40:46 -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 8C836B821CA; Fri, 22 Apr 2022 01:40:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16530C385A7; Fri, 22 Apr 2022 01:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650591644; bh=84SSLoGtlEVQaRfEjpYyO2p8fJDHeUxLXOIa3sUjotE=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=m0XkKPNl8K7JR+f5fsbqjqiWh8SAu1HAp1/nxMkmWCOPNIetM2rqmlFauWr4gZOYw GGovyd5wEEhKxEcsb4EUxugGFwQleEX17IMpWLlmoZv1ybuNo+T5q+p28+IkFr5YT9 1FfWZ6sGbl1tdOO2oAoyHt4nVObY7Rn/noYEderABHAP3RMKkz6Zp4SgNdb10UI6ug P8ANMklg/ayhENT5ChqyJDZkOi5x0MqS5HVp32/7+0CbaCPMmCgwIFHL4oLhfmqlzC 2SgDFiI49v7XAsRRwf21N5PecBu4ik/lxox+VROAoN0nBttQZEHNdywDB4Qdg1ecOi 6I7IcfWeiuYdA== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20220419081246.2546159-1-wenst@chromium.org> <3591fcc1-d34a-b40a-4e78-edcf9d2ddf08@collabora.com> Subject: Re: [RFC PATCH 0/7] clk: mediatek: Move to struct clk_hw provider APIs From: Stephen Boyd Cc: Michael Turquette , Chun-Jie Chen , Miles Chen , Rex-BC Chen , Matthias Brugger , linux-clk@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org To: AngeloGioacchino Del Regno , Chen-Yu Tsai Date: Thu, 21 Apr 2022 18:40:42 -0700 User-Agent: alot/0.10 Message-Id: <20220422014044.16530C385A7@smtp.kernel.org> X-Spam-Status: No, score=-2.9 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 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 Chen-Yu Tsai (2022-04-20 23:05:10) >=20 > Not exactly. All the clocks in the MTK drivers are allocated at runtime, > so we can't use clk_parent_data to point to not-yet-allocated clk_hw-s. > Instead we'll need to have >=20 > struct mtk_clk_parent_data { > unsigned int clk_id; /* Match CLK_XXX_YYY from dt-binding headers= */ > ... /* remaining fields same as mtk_clk_parent_data */ > }; >=20 > and create the actual clk_parent_data at runtime by looking up clk_id in > the set of already registered clks: >=20 > int mtk_clk_register_XXX(..., struct mtk_clk_parent_data *pdata, > struct clk_hw_onecell_data *clk_data) { > struct clk_parent_data data =3D { > .hw =3D clk_data[pdata->clk_id], > /* copy other fields verbatim */ > }; > ... > } >=20 > Obviously this forces some ordering of how the clks are registered. > I believe the order is already correct, and if it isn't, it would be > easy to detect, and we can reorder things to fix it. If this is a common problem, we may need to come up with a generic solution that either adds a new clk registration API that fills in the clk_parent_data hw pointer or add another member to struct clk_parent_data that says "index into this other array of clk_hw pointers".