Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1298568
| Path | csiph.com!goblin2!goblin.stu.neva.ru!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 07/16] clk: simplify clk_core_get_parent_by_index() |
| Date | Mon, 28 Dec 2015 11:20:02 +0100 |
| Message-ID | <qKD4e-sS-15@gated-at.bofh.it> (permalink) |
| References | <qKD4d-sS-5@gated-at.bofh.it> |
| X-Original-To | linux-mtd@lists.infradead.org |
| X-Nifty-Srcip | [153.142.97.90] |
| X-Mailer | git-send-email 1.9.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 45 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Masahiro Yamada <yamada.masahiro@socionext.com>, Stephen Boyd <sboyd@codeaurora.org>, Michael Turquette <mturquette@baylibre.com>, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Mon, 28 Dec 2015 19:10:20 +0900 |
| X-Original-Message-ID | <1451297429-21689-8-git-send-email-yamada.masahiro@socionext.com> |
| X-Original-References | <1451297429-21689-1-git-send-email-yamada.masahiro@socionext.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1298568 |
Show key headers only | View raw
Drop the "if (!core->parents)" case and refactor the function a bit
because core->parents is always allocated. (Strictly speaking, it is
ZERO_SIZE_PTR if core->num_parents == 0, but such a case is omitted
by the if-conditional above.)
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Changes in v2: None
drivers/clk/clk.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index b5be02a..ca7849a 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -350,13 +350,12 @@ static struct clk_core *clk_core_get_parent_by_index(struct clk_core *core,
{
if (!core || index >= core->num_parents)
return NULL;
- else if (!core->parents)
- return clk_core_lookup(core->parent_names[index]);
- else if (!core->parents[index])
- return core->parents[index] =
- clk_core_lookup(core->parent_names[index]);
- else
- return core->parents[index];
+
+ if (!core->parents[index])
+ core->parents[index] =
+ clk_core_lookup(core->parent_names[index]);
+
+ return core->parents[index];
}
struct clk_hw *
--
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/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v2 07/16] clk: simplify clk_core_get_parent_by_index() Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-12-28 11:20 +0100
csiph-web