Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2165002rwb; Sat, 29 Jul 2023 00:54:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlF1QbaUkP/z8OjopdBP5WXS8udmiaccFHbpw6P57rimoOH0TvY/qKYcROuRnw7pXzb5jF+8 X-Received: by 2002:a17:902:f693:b0:1bb:7d2f:7c19 with SMTP id l19-20020a170902f69300b001bb7d2f7c19mr5110570plg.64.1690617246005; Sat, 29 Jul 2023 00:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690617245; cv=none; d=google.com; s=arc-20160816; b=letVc9Bp6ItX1D/lSCghZvfYzFuvr3mjlvvCLtB3Hxw1p0XbiA0RZy1lQyF+aG5D3Z HvqeG/irEDy6vXi7+Fk20jOkHZpwWEE7rTzOuGmuMm3JK73Rc9v3rgs1yr9YlMJp5lPI rZF3Kl0jBVh26B9MYqpKsU6M/5WEJGpqWHG7uXZo3/2MRuLfd/LkNBRq/nLAFWE/f2mu 84/KXiBqCY+Cc3pOVw2WEkFOyjp0u7mdaghV2O/Ss+fIkAGavKv0GrqA8M+KOpNJtWwG lDV7xzDJIIdDAPKk1aufrUJs1HjReV65pgchnEwsPSgFohxya4fHHXlBa3JeQ3i0oYf2 ce6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=PjXyj3NzrHBo8bKD1VyhpX48+i6qq5qwQXhzt11+WuA=; fh=ZR5S5xHL9QnIhD+ECYpkW+VspPfhDXGYRC2atX92Twk=; b=tQZwUsvEdk0fEgf5252SWQplVUBzlIir2GnchPPKBvLc6FPThgQFOyFUgG3IrlmZ49 snT7CFmsCx50HJ2UlNP+EEN+tFR9Af/Qq3/3EW+NbkG2ZmQR11VQE2geYDp+cPM03W8f sSmshykydnj5aNZDElv6pAwsarIeOj+ywSV14q3vv8uXIg0ywiMVa0KR4b3CRAT32v9v X+TXtKJ7/ofg93XlN5WH0ALpTCM80Jd7EOLjl/N7mAg3nqu8sbX8OgYTwjw75SNiAlI4 M5ATdIZCXjZ5k2ZsUgSBW8VDzOwOqH3JZBygPrixBo5vYk2pxyKisy8bc+UOm77mL++n QZ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sv55ecYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a17090ab00c00b0025c16614fa6si5851319pjq.145.2023.07.29.00.53.54; Sat, 29 Jul 2023 00:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sv55ecYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236028AbjG2D2n (ORCPT + 99 others); Fri, 28 Jul 2023 23:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230270AbjG2D2m (ORCPT ); Fri, 28 Jul 2023 23:28:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C63F7449F; Fri, 28 Jul 2023 20:28:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5983162234; Sat, 29 Jul 2023 03:28:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1ABEC433C8; Sat, 29 Jul 2023 03:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690601320; bh=2m1Eut3V0qwzdB9kA5ACQKdPTgm6ypjeYNp7GiP+N0A=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=Sv55ecYSaDyCG+6oBa28HU9UjgVb58HrI2EH6RwAv4IbTEz2oL9/nwcO0R0grPuuv M6b3xxOwZBRsxJjFQZQVrmlpPO5J9DzgT1IwWz3CGs3N7N+ptB7/FkhbkpwyIrTqiD TiwQCZNtfKQWZW/4sUcqfYIDwFMQ8gDU0S8qwxlacmpvHG+e+fJ8Hvp9Nmcg0tABVG UwlR2+Yas07CFvWYPicUcpVN5gLeqnhuhMKXCoa5sjNAyAVgGOydPR/aGlle2REwIh 4EeSo4HbpM89ganI9W59ufnM9PUMbWWWz54AJZmuvAUS3oobeuAVEmqHkVx+KDVOVD QQ3NJbINiH61g== Message-ID: <412f9209637e6eb861cd07e1d6dbc346.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230727053156.13587-4-claudiu.beznea@tuxon.dev> References: <20230727053156.13587-1-claudiu.beznea@tuxon.dev> <20230727053156.13587-4-claudiu.beznea@tuxon.dev> Subject: Re: [PATCH 03/42] clk: at91: sam9x60: switch to parent_hw and parent_data From: Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, varshini.rajendran@microchip.com, Claudiu Beznea To: Claudiu Beznea , alexandre.belloni@bootlin.com, mripard@kernel.org, mturquette@baylibre.com, nicolas.ferre@microchip.com Date: Fri, 28 Jul 2023 20:28:38 -0700 User-Agent: alot/0.10 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Claudiu Beznea (2023-07-26 22:31:17) > @@ -177,31 +178,34 @@ static const struct { > =20 > static void __init sam9x60_pmc_setup(struct device_node *np) > { > + struct clk_hw *td_slck_hw, *md_slck_hw, *main_xtal_hw, *main_rc_h= w, *main_osc_hw; > + struct clk_hw *parent_hws[6], *hw, *usbck_hw; > + static struct clk_parent_data parent_data; > struct clk_range range =3D CLK_RANGE(0, 0); > - const char *td_slck_name, *md_slck_name, *mainxtal_name; > + const char *main_xtal_name =3D "main_xtal"; > struct pmc_data *sam9x60_pmc; > - const char *parent_names[6]; > - struct clk_hw *main_osc_hw; > struct regmap *regmap; > - struct clk_hw *hw; > + struct clk *clk; > int i; > =20 > - i =3D of_property_match_string(np, "clock-names", "td_slck"); > - if (i < 0) > + clk =3D of_clk_get_by_name(np, "td_slck"); > + if (IS_ERR(clk)) > return; > - > - td_slck_name =3D of_clk_get_parent_name(np, i); > - > - i =3D of_property_match_string(np, "clock-names", "md_slck"); > - if (i < 0) > + td_slck_hw =3D __clk_get_hw(clk); Don't introduce more usage of __clk_get_hw(). The index for "td_slck" should be known, and it can be used as the index member in struct clk_parent_data. This allows the clk framework to lazily find the parent, instead of requiring the parent to be registered before this code runs. It also reduces the usage of __clk_get_hw().