From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754791AbZBOSsP (ORCPT ); Sun, 15 Feb 2009 13:48:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751262AbZBOSr6 (ORCPT ); Sun, 15 Feb 2009 13:47:58 -0500 Received: from ti-out-0910.google.com ([209.85.142.186]:34313 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbZBOSr5 (ORCPT ); Sun, 15 Feb 2009 13:47:57 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=rZm+qtm1G3SNjej9x/fzRXpMA6o7owjVVhIDts/NqtjofB2CxvC7m1pF84AT9DtnqB QQ34JXJmjzUD13BwgCvI0B+EgYK03wk4NI+VkudF0vKpF1j2E+LJLzFfrGGxqyhB+plT svH1gu5NqRJUXMaLrIPtzCkZiI5WtT7aM/4Z4= MIME-Version: 1.0 In-Reply-To: <20090215184752.GA4970@uranus.ravnborg.org> References: <20090215184752.GA4970@uranus.ravnborg.org> Date: Mon, 16 Feb 2009 00:17:54 +0530 Message-ID: Subject: Re: [PATCH] Remove errors caught by checkpatch.pl in kernel/kallsyms.c From: Manish Katiyar To: Sam Ravnborg Cc: mingo@elte.hu, LKML , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 16, 2009 at 12:17 AM, Sam Ravnborg wrote: > On Mon, Feb 16, 2009 at 12:04:36AM +0530, Manish Katiyar wrote: >> Hi Ingo, >> >> I used your code-quality script to do cleanup in kernel/kallsyms.c. >> Below patch removes errors generated by checkpatch.pl. > When doing so use checkpatch only as a hint generator and do > not concentrate only on the warnings/errors generated by checkpatch. > > Your patch is an improvement but please fix the remaining issues. > > Sam Thanks Sam, will address these and resend this patch. Thanks - Manish > > For example.. >> - return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ]; >> + return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off+1]]]; > > Add spaces around [off+1] so it looks like this: [off + 1] > > >> } >> >> >> @@ -133,13 +133,13 @@ static unsigned int get_symbol_offset(unsigned long pos) >> >> /* use the closest marker we have. We have markers every 256 positions, >> * so that should be close enough */ >> - name = &kallsyms_names[ kallsyms_markers[pos>>8] ]; >> + name = &kallsyms_names[kallsyms_markers[pos>>8]]; > > Same here: [pos >> 8] > > >> >> /* sequentially scan all the symbols up to the point we're searching for. >> * Every symbol is stored in a [][ bytes of data] format, so we >> * just need to add the len to the current pointer for every symbol we >> * wish to skip */ >> - for(i = 0; i < (pos&0xFF); i++) >> + for (i = 0; i < (pos&0xFF); i++) > And here: (pos & 0xFF) > >> name = name + (*name) + 1; >> >> return name - kallsyms_names; >> @@ -323,6 +323,7 @@ int sprint_symbol(char *buffer, unsigned long address) >> >> return len; >> } >> +EXPORT_SYMBOL_GPL(sprint_symbol); >> >> /* Look up a kernel symbol and print it to the kernel messages. */ >> void __print_symbol(const char *fmt, unsigned long address) >> @@ -333,10 +334,10 @@ void __print_symbol(const char *fmt, unsigned >> long address) >> >> printk(fmt, buffer); >> } >> +EXPORT_SYMBOL(__print_symbol); >> >> /* To avoid using get_symbol_offset for every symbol, we carry prefix along. */ >> -struct kallsym_iter >> -{ >> +struct kallsym_iter { >> loff_t pos; >> unsigned long value; >> unsigned int nameoff; /* If iterating in core kernel symbols */ >> @@ -385,7 +386,7 @@ static int update_iter(struct kallsym_iter *iter, >> loff_t pos) >> iter->pos = pos; >> return get_ksymbol_mod(iter); >> } >> - >> + >> /* If we're not on the desired position, reset to new position. */ >> if (pos != iter->pos) >> reset_iter(iter, pos); >> @@ -420,7 +421,7 @@ static int s_show(struct seq_file *m, void *p) >> { >> struct kallsym_iter *iter = m->private; >> >> - /* Some debugging symbols have no name. Ignore them. */ >> + /* Some debugging symbols have no name. Ignore them. */ >> if (!iter->name[0]) >> return 0; >> >> @@ -432,11 +433,11 @@ static int s_show(struct seq_file *m, void *p) >> type = iter->exported ? toupper(iter->type) : >> tolower(iter->type); >> seq_printf(m, "%0*lx %c %s\t[%s]\n", >> - (int)(2*sizeof(void*)), >> + (int)(2*sizeof(void *)), > (2 * sizeof(void *)) > > >> iter->value, type, iter->name, iter->module_name); >> } else >> seq_printf(m, "%0*lx %c %s\n", >> - (int)(2*sizeof(void*)), >> + (int)(2*sizeof(void *)), > and here again. > >> iter->value, iter->type, iter->name); >> return 0; >> } >> @@ -481,7 +482,5 @@ static int __init kallsyms_init(void) >> proc_create("kallsyms", 0444, NULL, &kallsyms_operations); >> return 0; >> } >> -__initcall(kallsyms_init); >> +device_initcall(kallsyms_init); >> >> -EXPORT_SYMBOL(__print_symbol); >> -EXPORT_SYMBOL_GPL(sprint_symbol); > >