aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-16 23:40:32 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-17 15:11:22 +0200
commit20ea6adbf199097c4f5f591ffee088340630dae4 (patch)
treed6719d95e136611a1c25bbf7789652d6d402779d /target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch
parentbca05bd072180dc38ef740b37ded9572a6db1981 (diff)
downloadupstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.gz
upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.bz2
upstream-20ea6adbf199097c4f5f591ffee088340630dae4.zip
bcm27xx: add support for linux v5.15
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch b/target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch
new file mode 100644
index 0000000000..9b82144216
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch
@@ -0,0 +1,69 @@
+From daba7e69a412a6b55b77818904ae53e2a9a6d91c Mon Sep 17 00:00:00 2001
+From: Maxime Ripard <maxime@cerno.tech>
+Date: Fri, 1 Apr 2022 11:09:29 +0200
+Subject: [PATCH] clk: Fix clk_get_parent() documentation
+
+The clk_get_parent() documentation in the header states that it will
+return a valid pointer, or an error pointer on failure.
+
+However, the documentation in the source file, and the code itself, will
+return also return NULL if there isn't any parent for that clock. Let's
+mention it.
+
+An orphan clock should return NULL too, so let's add a test for it.
+
+Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # imx8mp
+Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> # exynos4210, meson g12b
+Signed-off-by: Maxime Ripard <maxime@cerno.tech>
+---
+ drivers/clk/clk_test.c | 17 +++++++++++++++++
+ include/linux/clk.h | 5 +++--
+ 2 files changed, 20 insertions(+), 2 deletions(-)
+
+--- a/drivers/clk/clk_test.c
++++ b/drivers/clk/clk_test.c
+@@ -534,6 +534,22 @@ clk_orphan_transparent_multiple_parent_m
+
+ /*
+ * Test that, for a mux whose current parent hasn't been registered yet,
++ * clk_get_parent() will return NULL.
++ */
++static void
++clk_test_orphan_transparent_multiple_parent_mux_get_parent(struct kunit *test)
++{
++ struct clk_multiple_parent_ctx *ctx = test->priv;
++ struct clk_hw *hw = &ctx->hw;
++ struct clk *clk = hw->clk;
++ struct clk *parent;
++
++ parent = clk_get_parent(clk);
++ KUNIT_EXPECT_PTR_EQ(test, parent, NULL);
++}
++
++/*
++ * Test that, for a mux whose current parent hasn't been registered yet,
+ * calling clk_set_parent() to a valid parent will properly update the
+ * mux parent and its orphan status.
+ */
+@@ -642,6 +658,7 @@ clk_test_orphan_transparent_multiple_par
+ }
+
+ static struct kunit_case clk_orphan_transparent_multiple_parent_mux_test_cases[] = {
++ KUNIT_CASE(clk_test_orphan_transparent_multiple_parent_mux_get_parent),
+ KUNIT_CASE(clk_test_orphan_transparent_multiple_parent_mux_set_parent),
+ KUNIT_CASE(clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate),
+ KUNIT_CASE(clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified),
+--- a/include/linux/clk.h
++++ b/include/linux/clk.h
+@@ -744,8 +744,9 @@ int clk_set_parent(struct clk *clk, stru
+ * clk_get_parent - get the parent clock source for this clock
+ * @clk: clock source
+ *
+- * Returns struct clk corresponding to parent clock source, or
+- * valid IS_ERR() condition containing errno.
++ * Returns struct clk corresponding to parent clock source, a NULL
++ * pointer if it doesn't have a parent, or a valid IS_ERR() condition
++ * containing errno.
+ */
+ struct clk *clk_get_parent(struct clk *clk);
+