linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What's the proper use of con_id in clkdev
@ 2015-10-05 19:51 York Sun
  2015-10-06 19:44 ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: York Sun @ 2015-10-05 19:51 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, linux-clk

Michael and Stephen,

Can you help me to understand "#define MAX_CON_ID 16" in clkdev.c? I am trying
to use clk_get() to acquire the clock with its name. This fails when the clock
name is more than 15 characters. I traced it to this macro.

The reason of using clk_get() is I don't have device tree for my platform until
device tree overlay is officially supported. So I use clkdev_add() in the clock
driver.

So my issue is with the MAX_CON_ID. Is there a reason to limit it to 16?
Wouldn't it be better to use kstrdup() in vclkdev_alloc()?

York

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

* Re: What's the proper use of con_id in clkdev
  2015-10-05 19:51 What's the proper use of con_id in clkdev York Sun
@ 2015-10-06 19:44 ` Stephen Boyd
  2015-10-06 19:50   ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2015-10-06 19:44 UTC (permalink / raw)
  To: York Sun; +Cc: Michael Turquette, linux-clk, Russell King

On 10/05, York Sun wrote:
> Michael and Stephen,
> 
> Can you help me to understand "#define MAX_CON_ID 16" in clkdev.c? I am trying
> to use clk_get() to acquire the clock with its name. This fails when the clock
> name is more than 15 characters. I traced it to this macro.
> 
> The reason of using clk_get() is I don't have device tree for my platform until
> device tree overlay is officially supported. So I use clkdev_add() in the clock
> driver.
> 
> So my issue is with the MAX_CON_ID. Is there a reason to limit it to 16?
> Wouldn't it be better to use kstrdup() in vclkdev_alloc()?
> 

Mike and I are not the maintainers of clkdev. The maintainer of
clkdev is Russell King.

I believe we can't use kstrdup() in vclkdev_alloc() because we
don't know if vclkdev_alloc() is called before the slab
allocators are up and running (this is why we have a
__clkdev_alloc() function). The simplest solution is to use
shorter names, can you do that?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: What's the proper use of con_id in clkdev
  2015-10-06 19:44 ` Stephen Boyd
@ 2015-10-06 19:50   ` Russell King - ARM Linux
  2015-10-06 19:53     ` York Sun
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2015-10-06 19:50 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: York Sun, Michael Turquette, linux-clk

On Tue, Oct 06, 2015 at 12:44:30PM -0700, Stephen Boyd wrote:
> On 10/05, York Sun wrote:
> > Michael and Stephen,
> > 
> > Can you help me to understand "#define MAX_CON_ID 16" in clkdev.c? I am trying
> > to use clk_get() to acquire the clock with its name. This fails when the clock
> > name is more than 15 characters. I traced it to this macro.
> > 
> > The reason of using clk_get() is I don't have device tree for my platform until
> > device tree overlay is officially supported. So I use clkdev_add() in the clock
> > driver.
> > 
> > So my issue is with the MAX_CON_ID. Is there a reason to limit it to 16?
> > Wouldn't it be better to use kstrdup() in vclkdev_alloc()?
> > 
> 
> Mike and I are not the maintainers of clkdev. The maintainer of
> clkdev is Russell King.
> 
> I believe we can't use kstrdup() in vclkdev_alloc() because we
> don't know if vclkdev_alloc() is called before the slab
> allocators are up and running (this is why we have a
> __clkdev_alloc() function). The simplest solution is to use
> shorter names, can you do that?

Why does anyone need a _connection_ _id_ longer than 15 characters
anyway?

It's not a system clock name - it's supposed to be a device _specific_
clock _input_ name.  This statement comes from many years experience,
where people have repeatedly passed clk_get(NULL, "global clock name")
and eventually run into great problems, ending up having to pass clk
connection names through platform data, or clk pointers through
platform data.  Both are abhorrent.

Use the API as it was designed to be used: always use
clk_get(device, "device-input-name") or clk_get_sys("device-name",
"device-input-name") and not clk_get(NULL, "global-clock-name").

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

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

* Re: What's the proper use of con_id in clkdev
  2015-10-06 19:50   ` Russell King - ARM Linux
@ 2015-10-06 19:53     ` York Sun
  0 siblings, 0 replies; 4+ messages in thread
From: York Sun @ 2015-10-06 19:53 UTC (permalink / raw)
  To: Russell King - ARM Linux, Stephen Boyd; +Cc: Michael Turquette, linux-clk

On 10/06/2015 12:50 PM, Russell King - ARM Linux wrote:
> On Tue, Oct 06, 2015 at 12:44:30PM -0700, Stephen Boyd wrote:
>> On 10/05, York Sun wrote:
>>> Michael and Stephen,
>>>
>>> Can you help me to understand "#define MAX_CON_ID 16" in clkdev.c? I am trying
>>> to use clk_get() to acquire the clock with its name. This fails when the clock
>>> name is more than 15 characters. I traced it to this macro.
>>>
>>> The reason of using clk_get() is I don't have device tree for my platform until
>>> device tree overlay is officially supported. So I use clkdev_add() in the clock
>>> driver.
>>>
>>> So my issue is with the MAX_CON_ID. Is there a reason to limit it to 16?
>>> Wouldn't it be better to use kstrdup() in vclkdev_alloc()?
>>>
>>
>> Mike and I are not the maintainers of clkdev. The maintainer of
>> clkdev is Russell King.
>>
>> I believe we can't use kstrdup() in vclkdev_alloc() because we
>> don't know if vclkdev_alloc() is called before the slab
>> allocators are up and running (this is why we have a
>> __clkdev_alloc() function). The simplest solution is to use
>> shorter names, can you do that?
> 
> Why does anyone need a _connection_ _id_ longer than 15 characters
> anyway?
> 
> It's not a system clock name - it's supposed to be a device _specific_
> clock _input_ name.  This statement comes from many years experience,
> where people have repeatedly passed clk_get(NULL, "global clock name")
> and eventually run into great problems, ending up having to pass clk
> connection names through platform data, or clk pointers through
> platform data.  Both are abhorrent.
> 
> Use the API as it was designed to be used: always use
> clk_get(device, "device-input-name") or clk_get_sys("device-name",
> "device-input-name") and not clk_get(NULL, "global-clock-name").
> 

Thanks to all for the guidance.

York

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

end of thread, other threads:[~2015-10-06 19:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 19:51 What's the proper use of con_id in clkdev York Sun
2015-10-06 19:44 ` Stephen Boyd
2015-10-06 19:50   ` Russell King - ARM Linux
2015-10-06 19:53     ` York Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).