[PATCH] CLKDEV: Add helper routines to allocate and add clkdevs for given struct clk *

Viresh Kumar viresh.kumar at st.com
Mon Apr 16 06:30:53 EDT 2012


On 4/16/2012 3:55 PM, Domenico Andreoli wrote:
> On Mon, Apr 16, 2012 at 10:49:37AM +0530, Viresh Kumar wrote:
>> From: Russell King <rmk+kernel at arm.linux.org.uk>
>> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
>> +int clk_register_single_clkdev(struct clk *clk, const char *dev_id,
>> +		const char *con_id)
>> +{
>> +	struct clk_lookup *cl;
>> +
>> +	if (!clk || (!dev_id && !con_id))
>> +		return -ENOMEM;
> 
> I would return -EINVAL here.

Will fix it.

>> +
>> +	cl = clkdev_alloc(clk, con_id, "%s", dev_id);
> 
> clkdev_alloc() allows you to specify dev_fmt and possibly other arguments
> to build the dev_id on the fly, could clk_register_single_clkdev()
> preserve this ability?

Can be done. Maybe we can create two versions here: with and without dev_fmt.

>> +	if (!cl)
>> +		return -ENOMEM;
>> +
>> +	clkdev_add(cl);
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL(clk_register_single_clkdev);
>> +
>> +int clk_register_clkdevs(struct clk *clk, struct clk_lookup *cl, size_t num)
>> +{
>> +	unsigned i;
>> +
>> +	if (!clk || !cl || !num)
>> +		return -ENOMEM;
> 
> I would return -EINVAL here as well.

Will fix this too.

-- 
viresh



More information about the linux-arm-kernel mailing list