Skip to content

Commit 4a4472f

Browse files
geertubebarino
authored andcommitted
of: clk: Make of_clk_get_parent_{count,name}() parameter const
of_clk_get_parent_count() and of_clk_get_parent_name() never modify the device nodes passed, so they can be const. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent bb6d3fb commit 4a4472f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/clk/clk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4713,7 +4713,7 @@ EXPORT_SYMBOL(of_clk_get_by_name);
47134713
*
47144714
* Returns: The number of clocks that are possible parents of this node
47154715
*/
4716-
unsigned int of_clk_get_parent_count(struct device_node *np)
4716+
unsigned int of_clk_get_parent_count(const struct device_node *np)
47174717
{
47184718
int count;
47194719

@@ -4725,7 +4725,7 @@ unsigned int of_clk_get_parent_count(struct device_node *np)
47254725
}
47264726
EXPORT_SYMBOL_GPL(of_clk_get_parent_count);
47274727

4728-
const char *of_clk_get_parent_name(struct device_node *np, int index)
4728+
const char *of_clk_get_parent_name(const struct device_node *np, int index)
47294729
{
47304730
struct of_phandle_args clkspec;
47314731
struct property *prop;

include/linux/of_clk.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ struct of_device_id;
1111

1212
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF)
1313

14-
unsigned int of_clk_get_parent_count(struct device_node *np);
15-
const char *of_clk_get_parent_name(struct device_node *np, int index);
14+
unsigned int of_clk_get_parent_count(const struct device_node *np);
15+
const char *of_clk_get_parent_name(const struct device_node *np, int index);
1616
void of_clk_init(const struct of_device_id *matches);
1717

1818
#else /* !CONFIG_COMMON_CLK || !CONFIG_OF */
1919

20-
static inline unsigned int of_clk_get_parent_count(struct device_node *np)
20+
static inline unsigned int of_clk_get_parent_count(const struct device_node *np)
2121
{
2222
return 0;
2323
}
24-
static inline const char *of_clk_get_parent_name(struct device_node *np,
24+
static inline const char *of_clk_get_parent_name(const struct device_node *np,
2525
int index)
2626
{
2727
return NULL;

0 commit comments

Comments
 (0)