Skip to contentSkip to conversation

clk dereference in arch/sh/kernel/cpufreq.c

DISCUSSION Julia Lawall 2 participants 4 messages Jan 3, 2013 – Jan 10, 2013 SuperH

lore
Share & tools
lore
#0 lore raw

There has been a discussion recently about how the result of get_clk should be an opaque handle, not a value that can be dereferenced:

https://lkml.org/lkml/2012/12/20/105

There is such a dereference in arch/sh/kernel/cpufreq.c, in the function sh_cpufreq_cpu_init:

freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;

It was not obvious to me, however, what API function should be used instead, so I am just reporting the (potential) problem.

thanks,
julia

#1 lore raw
Quoted 5 lines · Julia Lawall

There has been a discussion recently about how the result of get_clk should be an opaque handle, not a value that can be dereferenced:

https://lkml.org/lkml/2012/12/20/105

Quoted 8 lines

There is such a dereference in arch/sh/kernel/cpufreq.c, in the function sh_cpufreq_cpu_init:

freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;

It was not obvious to me, however, what API function should be used instead, so I am just reporting the (potential) problem.

In this case we would have to add some new API for fetching the frequency table associated with the struct clk, which is reasonably straightforward. It's not obvious how a private API vs deref of a type we have a private definition for is any better or worse, though. This code is not aimed at the common struct clk in any event.

#2 lore raw
Quoted 11 lines · Paul Mundt
Quoted 10 lines · Julia Lawall

There has been a discussion recently about how the result of get_clk should be an opaque handle, not a value that can be dereferenced:

https://lkml.org/lkml/2012/12/20/105

There is such a dereference in arch/sh/kernel/cpufreq.c, in the function sh_cpufreq_cpu_init:

freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;

Quoted 8 lines
Quoted 3 lines

It was not obvious to me, however, what API function should be used instead, so I am just reporting the (potential) problem.

In this case we would have to add some new API for fetching the frequency table associated with the struct clk, which is reasonably straightforward. It's not obvious how a private API vs deref of a type we have a private definition for is any better or worse, though. This code is not aimed at the common struct clk in any event.

OK, maybe it should just be left as is?

julia

#3 lore raw
Quoted 16 lines · Julia Lawall
Quoted 14 lines · Paul Mundt
Quoted 13 lines · Julia Lawall

There has been a discussion recently about how the result of get_clk should be an opaque handle, not a value that can be dereferenced:

https://lkml.org/lkml/2012/12/20/105

There is such a dereference in arch/sh/kernel/cpufreq.c, in the function sh_cpufreq_cpu_init:

freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;

It was not obvious to me, however, what API function should be used instead, so I am just reporting the (potential) problem.

Quoted 8 lines
Quoted 5 lines

In this case we would have to add some new API for fetching the frequency table associated with the struct clk, which is reasonably straightforward. It's not obvious how a private API vs deref of a type we have a private definition for is any better or worse, though. This code is not aimed at the common struct clk in any event.

OK, maybe it should just be left as is?

That would be in line with my intentions.