Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1279644 > unrolled thread
| Started by | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| First post | 2015-11-30 08:40 +0100 |
| Last post | 2015-11-30 08:40 +0100 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 00/16] clk: a collection of various clean-ups and improvements Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-30 08:40 +0100
[PATCH 11/16] clk: simplify __clk_init_parent() Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-30 08:40 +0100
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2015-11-30 08:40 +0100 |
| Subject | [PATCH 00/16] clk: a collection of various clean-ups and improvements |
| Message-ID | <qAre2-Ay-7@gated-at.bofh.it> |
Many refactoring, with detection of circular parent looping. Masahiro Yamada (16): clk: remove unused first argument of __clk_init() clk: change the argument of __clk_init() into pointer to clk_core clk: rename __clk_init() into __clk_core_init() clk: remove unnecessary !core->parents conditional clk: change sizeof(struct clk *) to sizeof(*core->parents) clk: move core->parents allocation to clk_register() clk: simplify clk_core_get_parent_by_index() clk: drop the initial core->parents look-ups from __clk_core_init() clk: replace pr_warn() with pr_err() for fatal cases clk: move checking .git_parent to __clk_core_init() clk: simplify __clk_init_parent() clk: avoid circular clock topology clk: walk the orphan clock list more simply clk: make sure parent is not NULL in clk_fetch_parent_index() clk: simplify clk_fetch_parent_index() function clk: slightly optimize clk_core_set_parent() drivers/clk/clk.c | 214 ++++++++++++++++++++++-------------------------------- 1 file changed, 85 insertions(+), 129 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2015-11-30 08:40 +0100 |
| Subject | [PATCH 11/16] clk: simplify __clk_init_parent() |
| Message-ID | <qAre4-Ay-63@gated-at.bofh.it> |
| In reply to | #1279644 |
The translation from the index into clk_core is done by
clk_core_get_parent_by_index(). The if-block for num_parents == 1
case is duplicating the code in the clk_core_get_parent_by_index().
Drop the "if (num_parents == 1)" from the special case. Instead,
set the index to zero if .get_parent() is missing.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/clk/clk.c | 38 ++++----------------------------------
1 file changed, 4 insertions(+), 34 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 486f6d4..ef6fedb 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1651,44 +1651,14 @@ struct clk *clk_get_parent(struct clk *clk)
}
EXPORT_SYMBOL_GPL(clk_get_parent);
-/*
- * .get_parent is mandatory for clocks with multiple possible parents. It is
- * optional for single-parent clocks. Always call .get_parent if it is
- * available and WARN if it is missing for multi-parent clocks.
- *
- * For single-parent clocks without .get_parent, first check to see if the
- * .parents array exists, and if so use it to avoid an expensive tree
- * traversal. If .parents does not exist then walk the tree.
- */
static struct clk_core *__clk_init_parent(struct clk_core *core)
{
- struct clk_core *ret = NULL;
- u8 index;
-
- /* handle the trivial cases */
+ u8 index = 0;
- if (!core->num_parents)
- goto out;
-
- if (core->num_parents == 1) {
- if (IS_ERR_OR_NULL(core->parent))
- core->parent = clk_core_lookup(core->parent_names[0]);
- ret = core->parent;
- goto out;
- }
+ if (core->ops->get_parent)
+ index = core->ops->get_parent(core->hw);
- /*
- * Do our best to cache parent clocks in core->parents. This prevents
- * unnecessary and expensive lookups. We don't set core->parent here;
- * that is done by the calling function.
- */
-
- index = core->ops->get_parent(core->hw);
-
- ret = clk_core_get_parent_by_index(core, index);
-
-out:
- return ret;
+ return clk_core_get_parent_by_index(core, index);
}
static void clk_core_reparent(struct clk_core *core,
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web