2014-09-19 04:25:23

by Alan Ott

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 3/3] ieee802154: mrf24j40: use pr_* / dev_*

On 09/18/2014 11:27 PM, Varka Bhadram wrote:
>>> @@ -482,12 +482,10 @@ static int mrf24j40_filter(struct
>>> ieee802154_dev *dev,
>>> for (i = 0; i < 8; i++)
>>> write_short_reg(devrec, REG_EADR0 + i, addr[i]);
>>> -#ifdef DEBUG
>>> - printk(KERN_DEBUG "Set long addr to: ");
>>> + pr_debug("Set long addr to: ");
>>> for (i = 0; i < 8; i++)
>>> - printk("%02hhx ", addr[7 - i]);
>>> - printk(KERN_DEBUG "\n");
>>> -#endif
>>> + pr_debug("%02hhx ", addr[7 - i]);
>>> + pr_debug("\n");
>>
>> Hmm... You took out the #ifdef DEBUG, but there's still a loop in
>> there that will execute (optimizer aside). The pr_debug is ok, but
>> leave it all inside the #ifdef DEBUG.
>>
> I think if we use the pr_debug(), no need to need put*#ifdef DEBUG*...?
>
> I didn't get your point here...
>

What I mean is, even though pr_debug() is taken out by the preprocessor
when DEBUG is not defined, the for-loop is not. Most likely, the empty
loop gets optimized out by the compiler, but either way it's better to
have the code be representative of what's going to execute. Therefore, I
think we should keep the #ifdef DEBUG.

Alan.