Re: [PATCH][mmtom] clean up once printk routine

From: Minchan Kim
Date: Tue May 26 2009 - 05:40:47 EST


Hi, Pavel.

On Tue, May 26, 2009 at 5:35 PM, Pavel Machek <pavel@xxxxxx> wrote:
> Hi!
>
>> Yes. There are also some places to be able to use printk_once().
>> Are there any place I missed ?
>>
>> == CUT HERE ==
>>
>> There are some places to be able to use printk_once instead of hard coding.
>>
>> It will help code readability and maintenance.
>> This patch doesn't change function's behavior.
>>
>> Signed-off-by: Minchan Kim <minchan.kim@xxxxxxxxx>
>> CC: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
>> CC: David S. Miller <davem@xxxxxxxxxxxxx>
>> CC: Ingo Molnar <mingo@xxxxxxx>
>> ---
>> Âarch/x86/kernel/cpu/common.c Â| Â Â8 ++------
>> Âdrivers/net/3c515.c      |  Â7 ++-----
>> Âdrivers/pcmcia/pcmcia_ioctl.c | Â Â9 +++------
>> Â3 files changed, 7 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
>> index 82bec86..dc0f694 100644
>> --- a/arch/x86/kernel/cpu/common.c
>> +++ b/arch/x86/kernel/cpu/common.c
>> @@ -496,13 +496,9 @@ static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
>> Â Â Â Â Â Â Â }
>> Â Â Â }
>>
>> - Â Â if (!printed) {
>> - Â Â Â Â Â Â printed++;
>> - Â Â Â Â Â Â printk(KERN_ERR
>> + Â Â printk_once(KERN_ERR
>> Â Â Â Â Â Â Â Â Â "CPU: vendor_id '%s' unknown, using generic init.\n", v);
>> -
>> - Â Â Â Â Â Â printk(KERN_ERR "CPU: Your system may be unstable.\n");
>> - Â Â }
>> + Â Â printk_once(KERN_ERR "CPU: Your system may be unstable.\n");
>>
>
> You should delete the variable, right?

Yes. you're right.

> Plus, the code now uses two variables instead of one.
>
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂPavel

Thanks for pointing me out.
I will repost the patch with your advise.


> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
>



--
Thanks,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/