From nobody Tue Apr 7 00:45:50 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A88728D83E; Tue, 17 Mar 2026 13:33:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773754419; cv=none; b=HfFHL/VLYrTUKCA6PLwCFwD4Ye9jzUM7ZE5wSZ/GTOm5DPBtn+bOY4hysqIFF501RhCQ/Du58mikhRcj8YTfAbiGodKlybD2W96E2Kt0j8hOzqUiCN/MaVdXUrDVrQ4re7IFm01siuaTdd6xaAu4ZsAJYFMfPRiKaHcHIuyNP9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773754419; c=relaxed/simple; bh=2ea1iWY3G2WJoVz9abrqzxtZaJ7JSndBztOUmPTmdaw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Kfhpp/7+AfRo9RTZtkoy6271peoSfLqlY52788I+8wnjTzQRPzauZw6nYysboJojXPAp3Cmg+54VaMXLHIPygPi64ywh3k8sxTpJGHDNgwPXWaW3yXGKGI/1WPf69QayFFiVsXYo4qI3kKDmISGgqSRwZMr0IXrLKlF1vFW1bAo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=1BnL00zW; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="1BnL00zW" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 5FC07C5505A; Tue, 17 Mar 2026 13:34:00 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 547305FC9A; Tue, 17 Mar 2026 13:33:36 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7464A104505E9; Tue, 17 Mar 2026 14:33:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773754415; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ntIkyf4BHjj62Dc7A+L7YEXGw0IsZTA15rJunwpStEs=; b=1BnL00zWwyVJ2Ahl+rY1ma+pyiHmUkWeuMpRJTebQCfIJnv/qyPxILXpRF/LmFkw0sKghF o4rj2GtpUB1JN2U0zj07i5iDluv2pfGykBbp+UERlaPQcwt+aIKs6/XdHh0JmZdj4hvdyI tFlztnwP1YrA56E/i2549Y0/Dh9nbFnobrxLZ5GQzuzhOBtB7YgrUzDKHQSuTXrtm3sZ5B AMGnpYfdJW62j7qKhKmwQxtAahjTrmzf30k5IxATz2XjiMkOIBUpKjrxLR/P0zsz20xyhQ 1GOWnG8dNY9/bxSn6rb4ZoiXI9LGsUjyzls71ZO7yWa2M1f0G9sZZ3+o565wLQ== From: =?utf-8?q?Beno=C3=AEt_Monin?= Date: Tue, 17 Mar 2026 14:33:05 +0100 Subject: [PATCH v5 03/10] clk: fixed-factor: Rework initialization with parent clocks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-clk-eyeq7-v5-3-6f6daa2c2367@bootlin.com> References: <20260317-clk-eyeq7-v5-0-6f6daa2c2367@bootlin.com> In-Reply-To: <20260317-clk-eyeq7-v5-0-6f6daa2c2367@bootlin.com> To: Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?q?Th=C3=A9o_Lebrun?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd , Philipp Zabel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti Cc: Thomas Petazzoni , Tawfik Bayouk , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-mips@vger.kernel.org, =?utf-8?q?Beno=C3=AEt_Monin?= , Brian Masney X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Use the same sequence as clk-divider, clk-gate and other to set the parent_names, parent_hws and parent_data in the init struct when registering a fixed-factor clock. The number of parent clocks is now only set to one if a parent clock is provided. Previously the number of parent clocks was always one, forcing callers of __clk_hw_register_fixed_factor() to provide a dummy parent_data struct with an invalid clock index in case they were not provided with a non-NULL parent_name or parent_hw. Drop this dummy parent_data as is not necessary anymore. This change only has a small impact on mis-configured fixed-factor. Now a call to clk_hw_register_fixed_factor() with a NULL parent will register a fixed-factor with zero parent while previously it was registered with one invalid parent. In both cases the rate of the fixed-factor is 0Hz but it is no longer shown as orphaned. This has no impact on properly configured fixed-factors clocks. Reviewed-by: Brian Masney Signed-off-by: Beno=C3=AEt Monin --- drivers/clk/clk-fixed-factor.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index 850e8b95f352..359e91441c74 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -124,13 +124,13 @@ __clk_hw_register_fixed_factor(struct device *dev, st= ruct device_node *np, init.name =3D name; init.ops =3D &clk_fixed_factor_ops; init.flags =3D flags; - if (parent_name) - init.parent_names =3D &parent_name; - else if (parent_hw) - init.parent_hws =3D &parent_hw; + init.parent_names =3D parent_name ? &parent_name : NULL; + init.parent_hws =3D parent_hw ? &parent_hw : NULL; + init.parent_data =3D pdata; + if (parent_name || parent_hw || pdata) + init.num_parents =3D 1; else - init.parent_data =3D pdata; - init.num_parents =3D 1; + init.num_parents =3D 0; =20 hw =3D &fix->hw; if (dev) @@ -190,10 +190,8 @@ struct clk_hw *devm_clk_hw_register_fixed_factor_paren= t_hw(struct device *dev, const char *name, const struct clk_hw *parent_hw, unsigned long flags, unsigned int mult, unsigned int div) { - const struct clk_parent_data pdata =3D { .index =3D -1 }; - return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, parent_hw, - &pdata, flags, mult, div, 0, 0, true); + NULL, flags, mult, div, 0, 0, true); } EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor_parent_hw); =20 @@ -201,10 +199,8 @@ struct clk_hw *clk_hw_register_fixed_factor_parent_hw(= struct device *dev, const char *name, const struct clk_hw *parent_hw, unsigned long flags, unsigned int mult, unsigned int div) { - const struct clk_parent_data pdata =3D { .index =3D -1 }; - return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, parent_hw, - &pdata, flags, mult, div, 0, 0, false); + NULL, flags, mult, div, 0, 0, false); } EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor_parent_hw); =20 @@ -212,10 +208,8 @@ struct clk_hw *clk_hw_register_fixed_factor(struct dev= ice *dev, const char *name, const char *parent_name, unsigned long flags, unsigned int mult, unsigned int div) { - const struct clk_parent_data pdata =3D { .index =3D -1 }; - return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, - &pdata, flags, mult, div, 0, 0, false); + NULL, flags, mult, div, 0, 0, false); } EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor); =20 @@ -296,10 +290,8 @@ struct clk_hw *devm_clk_hw_register_fixed_factor(struc= t device *dev, const char *name, const char *parent_name, unsigned long flags, unsigned int mult, unsigned int div) { - const struct clk_parent_data pdata =3D { .index =3D -1 }; - return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, - &pdata, flags, mult, div, 0, 0, true); + NULL, flags, mult, div, 0, 0, true); } EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor); =20 --=20 2.53.0