From nobody Mon Feb 9 21:36:55 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 E400E38A72E; Wed, 14 Jan 2026 10:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768385140; cv=none; b=pYL9mC/6hHwKOpoQQIlOrA7UzeGBLkd26b0j4r4TxAEl6tfeq0UG6LUthiig8mWWaLZ1OXbDF1FbHN5sYs1YzVr5fe05XyWFQs43INRGxVd71xgLbEUvxczOwg0SrN8rYgcdmclX8k5Z/LimPoXcgMkBy9KrYYD4VNA2cd2wEkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768385140; c=relaxed/simple; bh=EKVg88+rOfU6IBSekC8pnT+bypbtFSFkwvN72GA69wY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YRUB5zuiJg70jTd91mJZnkaeYVdIQFTeC4k3FlNgb8AULNckHP6OIWFvBHf18XyglWpl6CAoIAt2FpYCnr0VqDlA59ptrJvc4PFouzy4ak6E6VIzGxohmItwXRb3MPRgPHbFOyqbpAF2bGJqwX5ER9IusyX+gZodbyBm5FPbMjU= 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=i1MoCC9w; arc=none smtp.client-ip=185.246.85.4 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="i1MoCC9w" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 926C14E420B6; Wed, 14 Jan 2026 10:05:37 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 65BD56074A; Wed, 14 Jan 2026 10:05:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0C775103C895C; Wed, 14 Jan 2026 11:05:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768385136; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=N7RyILljdMQfZkiQ7TRm3/JaE4XCEFcEURo9J0hqJe8=; b=i1MoCC9wXljtm5S02Ax+xfBD3bfZ4TrezEHmOvOLo9mfIuPMRqvz8iqGJpIH1J+z8DXMMJ hFyGiHG1raFGDTyLEe3bHL42a1xFXVaprDtkV1I4Wz5gTwQEZe9wr0kX3DrvHE/3IFqUc3 totiopnATIOMatGUZbCFi5b8Rp4iTWmxYXDkdoPfwAx1Xj94jK0IHSPu7wkC50ZSF1b5h7 kHVNNvywdEQzrDJEv/8eZNRv4oB/ge1PVAopvBq0OpfX0mUHvM52W5C0WLJzhjJyAlc+LW aPYQpKFggZFxBcopMhB4Bjo8gMg0p/y9r5HGLufvM47sMAdkHbZYZmrS8vEkRA== From: =?utf-8?q?Beno=C3=AEt_Monin?= Date: Wed, 14 Jan 2026 11:05:07 +0100 Subject: [PATCH v3 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: <20260114-clk-eyeq7-v3-3-8ebdba7b0133@bootlin.com> References: <20260114-clk-eyeq7-v3-0-8ebdba7b0133@bootlin.com> In-Reply-To: <20260114-clk-eyeq7-v3-0-8ebdba7b0133@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?= 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. 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 de658c9e4c53..63082115fd25 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.52.0