[PATCH v6 1/3] MTD : add the common code for GPMI controller driver

Huang Shijie b32955 at freescale.com
Thu Apr 28 21:42:20 EDT 2011


hi:
> On Wed, Apr 20, 2011 at 10:45:47AM +0800, Huang Shijie wrote:
>> +static inline int acquire_clock(struct gpmi_nfc_data *this, struct clk **clock)
>> +{
>> +	struct clk *c;
>> +
>> +	c = clk_get(&this->pdev->dev, NULL);
>> +	if (IS_ERR(c)) {
>> +		log("Can't own clock");
>> +		return PTR_ERR(c);
>> +	}
>> +	*clock = c;
>> +	return 0;
>> +}
>> +
>> +static void release_clock(struct gpmi_nfc_data *this, struct clk *clock)
>> +{
>> +	clk_put(clock);
>> +}
> Do you really need to abstract like this?  It appears to just complicate
> the code unnecessarily.
>
ok, I can remove the two functions.
>> +#define log(a, ...) printk(KERN_INFO "[ %s : %.3d ] "a"\n", \
>> +			__func__, __LINE__,  ## __VA_ARGS__)
> Also, I don't like this log() function.  You can do the same with:
>
> #define pr_fmt(fmt) "[ %s : %.3d ] " fmt, __func__, __LINE__
>
> and use pr_info() instead.  Note that it's generally frowned upon to
> hide the \n inside the pr_fmt().
>
ok, I will change it.

Thanks .


Best Regards
Huang Shijie





More information about the linux-mtd mailing list