public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* clk dereference in arch/sh/kernel/cpufreq.c
@ 2013-01-03  9:40 Julia Lawall
  2013-01-10  8:59 ` Paul Mundt
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2013-01-03  9:40 UTC (permalink / raw)
  To: lethal, linux-sh, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clk dereference in arch/sh/kernel/cpufreq.c
  2013-01-03  9:40 clk dereference in arch/sh/kernel/cpufreq.c Julia Lawall
@ 2013-01-10  8:59 ` Paul Mundt
  2013-01-10  9:31   ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mundt @ 2013-01-10  8:59 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-sh, linux-kernel

On Thu, Jan 03, 2013 at 10:40:20AM +0100, Julia Lawall wrote:
> 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.
> 
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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clk dereference in arch/sh/kernel/cpufreq.c
  2013-01-10  8:59 ` Paul Mundt
@ 2013-01-10  9:31   ` Julia Lawall
  2013-01-10 13:18     ` Paul Mundt
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2013-01-10  9:31 UTC (permalink / raw)
  To: Paul Mundt; +Cc: linux-sh, linux-kernel

On Thu, 10 Jan 2013, Paul Mundt wrote:

> On Thu, Jan 03, 2013 at 10:40:20AM +0100, Julia Lawall wrote:
> > 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.
> > 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clk dereference in arch/sh/kernel/cpufreq.c
  2013-01-10  9:31   ` Julia Lawall
@ 2013-01-10 13:18     ` Paul Mundt
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Mundt @ 2013-01-10 13:18 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-sh, linux-kernel

On Thu, Jan 10, 2013 at 10:31:46AM +0100, Julia Lawall wrote:
> On Thu, 10 Jan 2013, Paul Mundt wrote:
> 
> > On Thu, Jan 03, 2013 at 10:40:20AM +0100, Julia Lawall wrote:
> > > 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.
> > > 
> > 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-10 13:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03  9:40 clk dereference in arch/sh/kernel/cpufreq.c Julia Lawall
2013-01-10  8:59 ` Paul Mundt
2013-01-10  9:31   ` Julia Lawall
2013-01-10 13:18     ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox