Replace deprecated __initcall with device_initcall and fix whitespaces in kernel/kallsyms.c
PATCH 1/1 Replace deprecated __initcall with device_initcall and fix whitespaces in kernel/kallsyms.c
Patch to fix coding style whitespace issues and replace __initcall with device_initcall
Errors as reported by checkpatch.pl :-
Before:
total: 14 errors, 14 warnings, 487 lines checked
After :
total: 0 errors, 11 warnings, 486 lines checked
Compile tested binary verified as :-
Before:
text data bss dec hex filename
2405 4 0 2409 969 kernel/kallsyms.o
After :
text data bss dec hex filename
2405 4 0 2409 969 kernel/kallsyms.o
--- kernel/kallsyms.c | 29 ++++++++++++++--------------- 1 files changed, 14 insertions(+), 15 deletions(-)
kernel/kallsyms.c +0 -0
@@ -93,13 +93,13 @@ static unsigned int
kallsyms_expand_symbol(unsigned int off, char *result)
/* for every byte on the compressed symbol data, copy the table
entry for that byte */
- while(len) {
- tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ];
+ while (len) {
+ tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
data++;
len--;
while (*tptr) {
- if(skipped_first) {
+ if (skipped_first) {
*result = *tptr;
result++;
} else
@@ -120,7 +120,7 @@ static char kallsyms_get_symbol_type(unsigned int off)
{
/* get just the first code, look it up in the token table, and return the
* first char from this token */
- return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ];
+ return kallsyms_token_table[kallsyms_token_index[kallsyms_names[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]];
/* sequentially scan all the symbols up to the point we're searching for.
* Every symbol is stored in a [<len>][<len> 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++)
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 *)),
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 *)),
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);
Signature · 5 lines
1.5.4.3 Thanks - Manish
Quoted 135 lines · Manish Katiyar
Patch to fix coding style whitespace issues and replace
__initcallwithdevice_initcallErrors as reported by checkpatch.pl :-
Before:
total: 14 errors, 14 warnings, 487 lines checked
After :
total: 0 errors, 11 warnings, 486 lines checkedCompile tested binary verified as :-
Before:
text data bss dec hex filename
2405 4 0 2409 969kernel/kallsyms.o
After :
text data bss dec hex filename
2405 4 0 2409 969kernel/kallsyms.oSigned-off-by Manish Katiyar <[email protected]>--- kernel/kallsyms.c | 29 ++++++++++++++--------------- 1 files changed, 14 insertions(+), 15 deletions(-)kernel/kallsyms.c +3
-3@@ -93,13 +93,13 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)/* for every byte on the compressed symbol data, copy the table entry for that byte */ -while (len) { - tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ]; +while (len) { + tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; data++; len--;while (*tptr) { -if (skipped_first) { +if (skipped_first) { *result = *tptr; result++;} elsekernel/kallsyms.c +6
-5@@ -120,7 +120,7 @@ static char kallsyms_get_symbol_type(unsigned int off) {/* get just the first code, look it up in the token table, and return the * first char from this token */ -return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1 ] ] ]; +return kallsyms_token_table[kallsyms_token_index[kallsyms_names[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 ]];/* sequentially scan all the symbols up to the point we're searching for. * Every symbol is stored in a [<len>][<len> 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++) 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 */
kernel/kallsyms.c +1
-1@@ -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);kernel/kallsyms.c +4
-7@@ -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 *)), 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 *)), 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); --
Quoted 1 line
1.5.4.3
Hi,
You may also want to add the md5sum of the "befor" and "after" object file, as Paolo pointed out, as the size alone is not a strong evidence that the object files are the same.
Quoted 2 lines · Paolo Ciarrocchi
...
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h211e4d344729f4d4c93da37a590fc1c3a1fd9b
from the above URL:
paolo@paolo-desktop:~/linux.trees.git$ size /tmp/op_model_p4.o.* text data bss dec hex filename 2691 968 32 3691 e6b /tmp/op_model_p4.o.after 2691 968 32 3691 e6b /tmp/op_model_p4.o.before
paolo@paolo-desktop:~/linux.trees.git$ md5sum /tmp/op_model_p4.o.* 8c1c9823bab33333e1f7f76574e62561 /tmp/op_model_p4.o.after 8c1c9823bab33333e1f7f76574e62561 /tmp/op_model_p4.o.before
-Hannes
Quoted 18 lines · Manish Katiyar
Patch to fix coding style whitespace issues and replace
__initcallwithdevice_initcallErrors as reported by checkpatch.pl :-
Before:
total: 14 errors, 14 warnings, 487 lines checked
After :
total: 0 errors, 11 warnings, 486 lines checkedCompile tested binary verified as :-
Before:
text data bss dec hex filename
2405 4 0 2409 969kernel/kallsyms.o
After :
text data bss dec hex filename
2405 4 0 2409 969kernel/kallsyms.o
Quoted 1 line
Signed-off-by Manish Katiyar <[email protected]>
You did not fix the "spaces around operators" issue I showed you. And you have not done an intellegent conding-style cleanup as described in another mail by Ingo(*).
(*) As your changelog does not say so I assume you did no do it.
So please try again and be more critical this time and try to address the issues raised.
Thanks,
Sam
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 146 lines · Manish Katiyar
Quoted 141 lines · Hannes Eder
Quoted 135 lines · Manish Katiyar
Patch to fix coding style whitespace issues and replace
__initcallwithdevice_initcallErrors as reported by checkpatch.pl :-
Before:
total: 14 errors, 14 warnings, 487 lines checked
After :
total: 0 errors, 11 warnings, 486 lines checkedCompile tested binary verified as :-
Before:
text data bss dec hex filename
2405 4 0 2409 969kernel/kallsyms.o
After :
text data bss dec hex filename
2405 4 0 2409 969kernel/kallsyms.oSigned-off-by Manish Katiyar <[email protected]>--- kernel/kallsyms.c | 29 ++++++++++++++--------------- 1 files changed, 14 insertions(+), 15 deletions(-)kernel/kallsyms.c +3
-3@@ -93,13 +93,13 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)/* for every byte on the compressed symbol data, copy the table entry for that byte */ -while (len) { - tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ]; +while (len) { + tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; data++; len--;while (*tptr) { -if (skipped_first) { +if (skipped_first) { *result = *tptr; result++;} elsekernel/kallsyms.c +6
-5@@ -120,7 +120,7 @@ static char kallsyms_get_symbol_type(unsigned int off) {/* get just the first code, look it up in the token table, and return the * first char from this token */ -return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1 ] ] ]; +return kallsyms_token_table[kallsyms_token_index[kallsyms_names[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 ]];/* sequentially scan all the symbols up to the point we're searching for. * Every symbol is stored in a [<len>][<len> 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++) 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 */
kernel/kallsyms.c +1
-1@@ -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);kernel/kallsyms.c +4
-7@@ -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 *)), 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 *)), 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); --Quoted 1 line
1.5.4.3
Hi,
Quoted 3 lines
You may also want to add the md5sum of the "befor" and "after" object file, as Paolo pointed out, as the size alone is not a strong evidence that the object files are the same.
Quoted 7 lines
Hi Hannes,
Hmm.....after doing the changes when I saw the md5sum they are different :-( . Considering that I have done only whitespace fixes, few comments which exceeded 80 cols and replacing
__initcallwithdevice_initcall(). The sizes of object files are same. How should I go about finding why is the difference ?
it's the device_initcall() most likely that changes the signature. I generally split such patches into two parts:
the first, larger part does the invariant changes that provably do not change the md5.
the second, smaller part does changes that change the signature.
Ingo
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 141 lines · Hannes Eder
Quoted 135 lines · Manish Katiyar
Patch to fix coding style whitespace issues and replace
__initcallwithdevice_initcallErrors as reported by checkpatch.pl :-
Before:
total: 14 errors, 14 warnings, 487 lines checked
After :
total: 0 errors, 11 warnings, 486 lines checkedCompile tested binary verified as :-
Before:
text data bss dec hex filename
2405 4 0 2409 969kernel/kallsyms.o
After :
text data bss dec hex filename
2405 4 0 2409 969kernel/kallsyms.oSigned-off-by Manish Katiyar <[email protected]>--- kernel/kallsyms.c | 29 ++++++++++++++--------------- 1 files changed, 14 insertions(+), 15 deletions(-)kernel/kallsyms.c +3
-3@@ -93,13 +93,13 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)/* for every byte on the compressed symbol data, copy the table entry for that byte */ -while (len) { - tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ]; +while (len) { + tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; data++; len--;while (*tptr) { -if (skipped_first) { +if (skipped_first) { *result = *tptr; result++;} elsekernel/kallsyms.c +6
-5@@ -120,7 +120,7 @@ static char kallsyms_get_symbol_type(unsigned int off) {/* get just the first code, look it up in the token table, and return the * first char from this token */ -return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1 ] ] ]; +return kallsyms_token_table[kallsyms_token_index[kallsyms_names[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 ]];/* sequentially scan all the symbols up to the point we're searching for. * Every symbol is stored in a [<len>][<len> 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++) 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 */
kernel/kallsyms.c +1
-1@@ -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);kernel/kallsyms.c +4
-7@@ -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 *)), 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 *)), 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); --Quoted 1 line
1.5.4.3
Hi,
Quoted 3 lines
You may also want to add the md5sum of the "befor" and "after" object file, as Paolo pointed out, as the size alone is not a strong evidence that the object files are the same.
Hi Hannes,
Hmm.....after doing the changes when I saw the md5sum they are different :-( . Considering that I have done only whitespace fixes, few comments which exceeded 80 cols and replacing __initcall with device_initcall(). The sizes of object files are same. How should I go about finding why is the difference ?
[ removing LKML from cc, since this is probably a newbie question and not suitable for list.]
Thanks -
Manish
Quoted 19 lines
Quoted 2 lines · Paolo Ciarrocchi
...
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h211e4d344729f4d4c93da37a590fc1c3a1fd9bfrom the above URL:
paolo@paolo-desktop:~/linux.trees.git$ size /tmp/op_model_p4.o.* text data bss dec hex filename 2691 968 32 3691 e6b /tmp/op_model_p4.o.after 2691 968 32 3691 e6b /tmp/op_model_p4.o.beforepaolo@paolo-desktop:~/linux.trees.git$ md5sum /tmp/op_model_p4.o.* 8c1c9823bab33333e1f7f76574e62561 /tmp/op_model_p4.o.after 8c1c9823bab33333e1f7f76574e62561 /tmp/op_model_p4.o.before-Hannes
Re: [PATCH] Replace deprecated __initcall with device_initcall and fix whitespaces in kernel/kallsym
In reply to Manish KatiyarQuoted 6 lines
Hmm.....after doing the changes when I saw the md5sum they are different :-( . Considering that I have done only whitespace fixes, few comments which exceeded 80 cols and replacing
__initcallwithdevice_initcall(). The sizes of object files are same. How should I go about finding why is the difference ?
Binary search undoing your changes one-by-one.
My bet is that it is either:
1) Move of EXPORT_SYMBOL
2) Delete one line where you moved an opening brace
The approch here is simple.
Split the patch is two parts.
One that keep the md5 sum, and a second much smaller patch that impact the md5 sum. In this way you make it easier to review the changes that impact the md5 sum.
Sam
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 13 lines · Sam Ravnborg
Quoted 6 lines
Hmm.....after doing the changes when I saw the md5sum they are different :-( . Considering that I have done only whitespace fixes, few comments which exceeded 80 cols and replacing
__initcallwithdevice_initcall(). The sizes of object files are same. How should I go about finding why is the difference ?Binary search undoing your changes one-by-one.
My bet is that it is either:
1) Move ofEXPORT_SYMBOL
2) Delete one line where you moved an opening brace
Quoted 5 lines
The approch here is simple.
Split the patch is two parts.
One that keep the md5 sum, and a second much smaller patch that impact the md5 sum. In this way you make it easier to review the changes that impact the md5 sum.
Hi Sam,
I am bit confused, apparently it looks like change in comments is causing md5sum to change. See the output below.
/home/mkatiyar/linux-2.6> md5sum kernel/kallsyms.o f84966466d48e0b2db0c5e40ff47d0fa kernel/kallsyms.o /home/mkatiyar/linux-2.6> git diff /home/mkatiyar/linux-2.6> vi kernel/kallsyms.c /home/mkatiyar/linux-2.6> make kernel
CHK include/linux/version.h CHK include/linux/utsrelease.h UPD include/linux/utsrelease.h SYMLINK include/asm -> include/asm-x86 CALL scripts/checksyscalls.sh CC kernel/trace/trace.o LD kernel/trace/built-in.o CC kernel/module.o CC kernel/kallsyms.o LD kernel/built-in.o
/home/mkatiyar/linux-2.6> md5sum kernel/kallsyms.o 18cf3589698b8b00faa635d2d5ffab31 kernel/kallsyms.o /home/mkatiyar/linux-2.6> git diff
kernel/kallsyms.c +0 -1
@@ -30,7 +30,8 @@#define all_var 0#endif -/* These will be re-linked against their real values during the
second link stage */
+/* These will be re-linked against their real values
+ * during the second link stage */
extern const unsigned long kallsyms_addresses[] __attribute__((weak)); extern const u8 kallsyms_names[] __attribute__((weak));
Thanks -
Manish
Quoted 3 lines
Sam
Re: [PATCH] Replace deprecated __initcall with device_initcall and fix whitespaces in kernel/kallsym
In reply to Manish KatiyarQuoted 20 lines · Manish Katiyar
Quoted 13 lines · Sam Ravnborg
Quoted 6 lines
Hmm.....after doing the changes when I saw the md5sum they are different :-( . Considering that I have done only whitespace fixes, few comments which exceeded 80 cols and replacing
__initcallwithdevice_initcall(). The sizes of object files are same. How should I go about finding why is the difference ?Binary search undoing your changes one-by-one.
My bet is that it is either:
1) Move ofEXPORT_SYMBOL
2) Delete one line where you moved an opening braceQuoted 5 lines
The approch here is simple.
Split the patch is two parts.
One that keep the md5 sum, and a second much smaller patch that impact the md5 sum. In this way you make it easier to review the changes that impact the md5 sum.
Quoted 4 lines
Hi Sam,
I am bit confused, apparently it looks like change in comments is causing md5sum to change. See the output below.
Thats because your change add an extra line. And __LINE__ is used by BUG_ON later in the file - so now it sees a new line numbers and thus md5 sum changes.
Sam
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 21 lines · Sam Ravnborg
Quoted 20 lines · Manish Katiyar
Quoted 18 lines · Sam Ravnborg
Quoted 6 lines
Hmm.....after doing the changes when I saw the md5sum they are different :-( . Considering that I have done only whitespace fixes, few comments which exceeded 80 cols and replacing
__initcallwithdevice_initcall(). The sizes of object files are same. How should I go about finding why is the difference ?Binary search undoing your changes one-by-one.
My bet is that it is either:
1) Move ofEXPORT_SYMBOL
2) Delete one line where you moved an opening braceThe approch here is simple.
Split the patch is two parts.
One that keep the md5 sum, and a second much smaller patch that impact the md5 sum. In this way you make it easier to review the changes that impact the md5 sum.
Quoted 8 lines
Quoted 4 lines
Hi Sam,
I am bit confused, apparently it looks like change in comments is causing md5sum to change. See the output below.
Thats because your change add an extra line. And
__LINE__is used byBUG_ONlater in the file - so now it sees a new line numbers and thus md5 sum changes.
Ohhh.......thanks a lot Sam, I would have never guessed that. Till now I always felt comments are harmless. In that case should I split them in a separate patch even if they are just simple changes in comments ?
Thanks -
Manish
Quoted 3 lines
Sam
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 11 lines · Manish Katiyar
Quoted 6 lines · Sam Ravnborg
Quoted 2 lines · Manish Katiyar
I am bit confused, apparently it looks like change in comments is causing md5sum to change. See the output below.
Thats because your change add an extra line. And
__LINE__is used byBUG_ONlater in the file - so now it sees a new line numbers and thus md5 sum changes.Ohhh.......thanks a lot Sam, I would have never guessed that. Till now I always felt comments are harmless. In that case should I split them in a separate patch even if they are just simple changes in comments ?
Such a split makes only sense in larger patches where the md5sum check helps easing the mind of reviewers. A flood of trivial patches is not very welcome either.
BTW, if you start adjusting the style of comments in this file, then I suggest you change all multi-line comments to the canonical style in one go. Replacing one style deviation by another deviation like in <[email protected]> doesn't make sense.
Signature · 3 lines
Stefan Richter -===-=--= --=- =--=- http://arcgraph.de/sr/
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 17 lines · Stefan Richter
Quoted 11 lines · Manish Katiyar
Quoted 6 lines · Sam Ravnborg
Quoted 2 lines · Manish Katiyar
I am bit confused, apparently it looks like change in comments is causing md5sum to change. See the output below.
Thats because your change add an extra line. And
__LINE__is used byBUG_ONlater in the file - so now it sees a new line numbers and thus md5 sum changes.Ohhh.......thanks a lot Sam, I would have never guessed that. Till now I always felt comments are harmless. In that case should I split them in a separate patch even if they are just simple changes in comments ?
Such a split makes only sense in larger patches where the md5sum check helps easing the mind of reviewers. A flood of trivial patches is not very welcome either.
Quoted 5 lines
BTW, if you start adjusting the style of comments in this file, then I suggest you change all multi-line comments to the canonical style in one go. Replacing one style deviation by another deviation like in <[email protected]> doesn't make sense.
Resending the patch :
Patch to fix coding style whitespace issues and replace __initcall with device_initcall. Fixed multi-line comments as per coding style.
Errors as reported by checkpatch.pl :-
Before:
total: 14 errors, 14 warnings, 487 lines checked
After :
total: 0 errors, 8 warnings, 507 lines checked
Compile tested binary verified as :-
Before:
text data bss dec hex filename
2405 4 0 2409 969 kernel/kallsyms.o
After :
text data bss dec hex filename
2405 4 0 2409 969 kernel/kallsyms.o
--- kernel/kallsyms.c | 96 ++++++++++++++++++++++++++++++++--------------------- 1 files changed, 58 insertions(+), 38 deletions(-)
kernel/kallsyms.c +0 -1
@@ -30,11 +30,15 @@#define all_var 0#endif -/* These will be re-linked against their real values during the
second link stage */
+/*
+ * These will be re-linked against their real values
+ * during the second link stage
+ */
extern const unsigned long kallsyms_addresses[] __attribute__((weak)); extern const u8 kallsyms_names[] __attribute__((weak));
-/* tell the compiler that the count isn't in the small data section if the arch +/*
+ * tell the compiler that the count isn't in the small data section if the arch
* has one (eg: FRV)
*/
extern const unsigned long kallsyms_num_syms
@@ -75,8 +79,10 @@ static int is_ksym_addr(unsigned long addr)
return is_kernel_text(addr) || is_kernel_inittext(addr);
}
-/* expand a compressed symbol data into the resulting uncompressed string,
- given the offset to where the symbol is in the compressed stream */
+/*
+ * expand a compressed symbol data into the resulting uncompressed string,
+ * given the offset to where the symbol is in the compressed stream
+ */
static unsigned int kallsyms_expand_symbol(unsigned int off, char *result) {
int len, skipped_first = 0;
@@ -87,19 +93,23 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)
len = *data;
data++;
- /* update the offset to return the offset for the next symbol on
- * the compressed stream */
+ /*
+ * update the offset to return the offset for the next symbol on
+ * the compressed stream
+ */
off += len + 1;
- /* for every byte on the compressed symbol data, copy the table
- entry for that byte */
- while(len) {
- tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ];
+ /*
+ * for every byte on the compressed symbol data, copy the table
+ * entry for that byte
+ */
+ while (len) {
+ tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
data++;
len--;
while (*tptr) {
- if(skipped_first) {
+ if (skipped_first) {
*result = *tptr; result++;
} else
@@ -114,32 +124,42 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)
return off;
}
-/* get symbol type information. This is encoded as a single char at the
- * begining of the symbol name */
+/*
+ * get symbol type information. This is encoded as a single char at the
+ * begining of the symbol name
+ */
static char kallsyms_get_symbol_type(unsigned int off)
{
- /* get just the first code, look it up in the token table, and return the
- * first char from this token */
- return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ];
+ /*
+ * get just the first code, look it up in the token table,
+ * and return the first char from this token
+ */
+ return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off + 1]]];
}
-/* find the offset on the compressed stream given and index in the
- * kallsyms array */
+/*
+ * find the offset on the compressed stream given and index in the
+ * kallsyms array
+ */
static unsigned int get_symbol_offset(unsigned long pos) {
const u8 *name;
int i;
- /* 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] ];
+ /*
+ * 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]];
- /* sequentially scan all the symbols up to the point we're searching for.
- * Every symbol is stored in a [<len>][<len> 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++)
+ /*
+ * sequentially scan all the symbols up to the point we're searching for
+ * Every symbol is stored in a [<len>][<len> 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++)
name = name + (*name) + 1;
return name - kallsyms_names;
@@ -323,6 +343,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 +354,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 +406,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 +441,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 +453,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 *)),
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 *)),
iter->value, iter->type, iter->name);
return 0;
}
@@ -450,9 +471,11 @@ static const struct seq_operations kallsyms_op = {
static int kallsyms_open(struct inode *inode, struct file *file) {
- /* We keep iterator in m->private, since normal case is to
+ /*
+ * We keep iterator in m->private, since normal case is to
* s_start from where we left off, so we avoid doing
- * using get_symbol_offset for every symbol */
+ * using get_symbol_offset for every symbol
+ */
struct kallsym_iter *iter;
int ret;
@@ -481,7 +504,4 @@ static int __init kallsyms_init(void)
proc_create("kallsyms", 0444, NULL, &kallsyms_operations); return 0;
}
-__initcall(kallsyms_init);
-
-EXPORT_SYMBOL(__print_symbol); -EXPORT_SYMBOL_GPL(sprint_symbol); +device_initcall(kallsyms_init);
Signature · 8 lines
1.5.4.3 I have not included the md5sum output, since that has changed because of comments and isn't much useful for changelog. Thanks - Manish
Quoted 5 lines
--
Stefan Richter
-===-=--= --=- =--=-
http://arcgraph.de/sr/
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 2 lines · Manish Katiyar
kernel/kallsyms.c +0
-0
[...]
kernel/kallsyms.c
Quoted 6 lines
kernel/kallsyms.c +4
-2-/* get symbol type information. This is encoded as a single char at the -* begining of the symbol name */ +/* +* get symbol type information. This is encoded as a single char at the +* begining of the symbol name +*/
Typo: beginning
Besides, several sentences in comments of this file start lower-case but end with a full stop, while other sentences start upper-case but don't end with a full stop. The author(s) of the comments obviously didn't care for consistency and good readability. If you like you could fix this as well. :-)
Signature · 3 lines
Stefan Richter -===-=--= --=- =--= http://arcgraph.de/sr/
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 13 lines · Stefan Richter
Quoted 2 lines · Manish Katiyar
kernel/kallsyms.c +0
-0[...]
kernel/kallsyms.c
Quoted 6 lines
kernel/kallsyms.c +4
-2-/* get symbol type information. This is encoded as a single char at the -* begining of the symbol name */ +/* +* get symbol type information. This is encoded as a single char at the +* begining of the symbol name +*/ Typo: beginning
Quoted 5 lines
Besides, several sentences in comments of this file start lower-case but end with a full stop, while other sentences start upper-case but don't end with a full stop. The author(s) of the comments obviously didn't care for consistency and good readability. If you like you could fix this as well. :-)
Hi Stefan,
Below is the updated patch
Patch to fix coding style whitespace issues and replace __initcall with device_initcall. Fixed multi-line comments as per coding style.
Errors as reported by checkpatch.pl :-
Before:
total: 14 errors, 14 warnings, 487 lines checked
After :
total: 0 errors, 8 warnings, 509 lines checked
Compile tested binary verified as :-
Before:
text data bss dec hex filename
2405 4 0 2409 969 kernel/kallsyms.o
After :
text data bss dec hex filename
2405 4 0 2409 969 kernel/kallsyms.o
--- kernel/kallsyms.c | 134 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 78 insertions(+), 56 deletions(-)
kernel/kallsyms.c +0 -1
@@ -30,12 +30,16 @@#define all_var 0#endif -/* These will be re-linked against their real values during the
second link stage */
+/*
+ * These will be re-linked against their real values
+ * during the second link stage.
+ */
extern const unsigned long kallsyms_addresses[] __attribute__((weak)); extern const u8 kallsyms_names[] __attribute__((weak));
-/* tell the compiler that the count isn't in the small data section if the arch
- * has one (eg: FRV)
+/*
+ * Tell the compiler that the count isn't in the small data section if the arch
+ * has one (eg: FRV).
*/
extern const unsigned long kallsyms_num_syms
__attribute__((weak, section(".rodata")));
@@ -75,31 +79,37 @@ static int is_ksym_addr(unsigned long addr)
return is_kernel_text(addr) || is_kernel_inittext(addr);
}
-/* expand a compressed symbol data into the resulting uncompressed string,
- given the offset to where the symbol is in the compressed stream */
+/*
+ * Expand a compressed symbol data into the resulting uncompressed string,
+ * given the offset to where the symbol is in the compressed stream.
+ */
static unsigned int kallsyms_expand_symbol(unsigned int off, char *result) {
int len, skipped_first = 0;
const u8 *tptr, *data;
- /* get the compressed symbol length from the first symbol byte */
+ /* Get the compressed symbol length from the first symbol byte. */
data = &kallsyms_names[off];
len = *data;
data++;
- /* update the offset to return the offset for the next symbol on
- * the compressed stream */
+ /*
+ * Update the offset to return the offset for the next symbol on
+ * the compressed stream.
+ */
off += len + 1;
- /* for every byte on the compressed symbol data, copy the table
- entry for that byte */
- while(len) {
- tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ];
+ /*
+ * For every byte on the compressed symbol data, copy the table
+ * entry for that byte.
+ */
+ while (len) {
+ tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
data++;
len--;
while (*tptr) {
- if(skipped_first) {
+ if (skipped_first) {
*result = *tptr; result++;
} else
@@ -110,36 +120,46 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)
*result = '\0';
- /* return to offset to the next symbol */
+ /* Return to offset to the next symbol. */
return off;
}
-/* get symbol type information. This is encoded as a single char at the
- * begining of the symbol name */
+/*
+ * Get symbol type information. This is encoded as a single char at the
+ * beginning of the symbol name.
+ */
static char kallsyms_get_symbol_type(unsigned int off)
{
- /* get just the first code, look it up in the token table, and return the
- * first char from this token */
- return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ];
+ /*
+ * Get just the first code, look it up in the token table,
+ * and return the first char from this token.
+ */
+ return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off + 1]]];
}
-/* find the offset on the compressed stream given and index in the
- * kallsyms array */
+/*
+ * Find the offset on the compressed stream given and index in the
+ * kallsyms array.
+ */
static unsigned int get_symbol_offset(unsigned long pos) {
const u8 *name;
int i;
- /* 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] ];
+ /*
+ * 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]];
- /* sequentially scan all the symbols up to the point we're searching for.
- * Every symbol is stored in a [<len>][<len> 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++)
+ /*
+ * Sequentially scan all the symbols up to the point we're searching
+ * for. Every symbol is stored in a [<len>][<len> 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++)
name = name + (*name) + 1;
return name - kallsyms_names;
@@ -171,7 +191,7 @@ static unsigned long get_symbol_pos(unsigned long addr,
/* This kernel should never had been booted. */ BUG_ON(!kallsyms_addresses);
- /* do a binary search on the sorted kallsyms_addresses array */
+ /* Do a binary search on the sorted kallsyms_addresses array. */
low = 0;
high = kallsyms_num_syms;
@@ -184,15 +204,15 @@ static unsigned long get_symbol_pos(unsigned long addr,
}
/*
- * search for the first aliased symbol. Aliased
- * symbols are symbols with the same address
+ * Search for the first aliased symbol. Aliased
+ * symbols are symbols with the same address.
*/
while (low && kallsyms_addresses[low-1] = kallsyms_addresses[low])
--low;
symbol_start = kallsyms_addresses[low];
- /* Search for next non-aliased symbol */
+ /* Search for next non-aliased symbol. */
for (i = low + 1; i < kallsyms_num_syms; i++) {
if (kallsyms_addresses[i] > symbol_start) {
symbol_end = kallsyms_addresses[i];
@@ -200,7 +220,7 @@ static unsigned long get_symbol_pos(unsigned long addr,
}
}
- /* if we found no next symbol, we use the end of the section */
+ /* If we found no next symbol, we use the end of the section. */
if (!symbol_end) {
if (is_kernel_inittext(addr))
symbol_end = (unsigned long)_einittext;
@@ -233,10 +253,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
/*
* Lookup an address
- * - modname is set to NULL if it's in the kernel
- * - we guarantee that the returned name is valid until we reschedule even if
- * it resides in a module
- * - we also guarantee that modname will be valid until rescheduled
+ * - modname is set to NULL if it's in the kernel.
+ * - We guarantee that the returned name is valid until we reschedule even if.
+ * It resides in a module.
+ * - We also guarantee that modname will be valid until rescheduled. */
const char *kallsyms_lookup(unsigned long addr,
unsigned long *symbolsize,
@@ -257,7 +277,7 @@ const char *kallsyms_lookup(unsigned long addr,
return namebuf;
}
- /* see if it's in a module */
+ /* See if it's in a module. */
return module_address_lookup(addr, symbolsize, offset, modname,
namebuf);
}
@@ -275,7 +295,7 @@ int lookup_symbol_name(unsigned long addr, char *symname)
kallsyms_expand_symbol(get_symbol_offset(pos), symname); return 0;
}
- /* see if it's in a module */
+ /* See if it's in a module. */
return lookup_module_symbol_name(addr, symname);
}
@@ -294,7 +314,7 @@ int lookup_symbol_attrs(unsigned long addr, unsigned long *size,
modname[0] = '\0';
return 0;
}
- /* see if it's in a module */
+ /* See if it's in a module. */
return lookup_module_symbol_attrs(addr, size, offset, modname, name);
}
@@ -323,6 +343,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,13 +354,13 @@ 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 */
+ unsigned int nameoff; /* If iterating in core kernel symbols. */
char type;
char name[KSYM_NAME_LEN];
char module_name[MODULE_NAME_LEN];
@@ -385,7 +406,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,23 +441,25 @@ 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;
if (iter->module_name[0]) {
char type;
- /* Label it "global" if it is exported,
- * "local" if not exported. */
+ /*
+ * Label it "global" if it is exported,
+ * "local" if not exported.
+ */
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 *)),
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 *)),
iter->value, iter->type, iter->name);
return 0;
}
@@ -450,9 +473,11 @@ static const struct seq_operations kallsyms_op = {
static int kallsyms_open(struct inode *inode, struct file *file) {
- /* We keep iterator in m->private, since normal case is to
+ /*
+ * We keep iterator in m->private, since normal case is to
* s_start from where we left off, so we avoid doing
- * using get_symbol_offset for every symbol */
+ * using get_symbol_offset for every symbol.
+ */
struct kallsym_iter *iter;
int ret;
@@ -481,7 +506,4 @@ static int __init kallsyms_init(void)
proc_create("kallsyms", 0444, NULL, &kallsyms_operations); return 0;
}
-__initcall(kallsyms_init);
-
-EXPORT_SYMBOL(__print_symbol); -EXPORT_SYMBOL_GPL(sprint_symbol); +device_initcall(kallsyms_init);
Signature · 7 lines
1.5.4.3 Thanks - Manish
Quoted 5 lines
--
Stefan Richter
-===-=--= --=- =--=
http://arcgraph.de/sr/
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 21 lines · Manish Katiyar
Quoted 13 lines · Stefan Richter
Quoted 2 lines · Manish Katiyar
kernel/kallsyms.c +0
-0[...]
kernel/kallsyms.c
Quoted 6 lines
kernel/kallsyms.c +4
-2-/* get symbol type information. This is encoded as a single char at the -* begining of the symbol name */ +/* +* get symbol type information. This is encoded as a single char at the +* begining of the symbol name +*/ Typo: beginning
Quoted 5 lines
Besides, several sentences in comments of this file start lower-case but end with a full stop, while other sentences start upper-case but don't end with a full stop. The author(s) of the comments obviously didn't care for consistency and good readability. If you like you could fix this as well. :-)
Quoted 3 lines
Hi Stefan,
Below is the updated patch
Hi Stefan,
Has this been accepted, or is it still not worth it ?
Thanks -
Manish
Quoted 339 lines
Patch to fix coding style whitespace issues and replace
__initcallwithdevice_initcall. Fixed multi-line comments as per coding style.Errors as reported by checkpatch.pl :-
Before:
total: 14 errors, 14 warnings, 487 lines checked
After :
total: 0 errors, 8 warnings, 509 lines checkedCompile tested binary verified as :-
Before:
text data bss dec hex filename 2405 4 0 2409 969kernel/kallsyms.oAfter :
text data bss dec hex filename 2405 4 0 2409 969kernel/kallsyms.oSigned-off-by Manish Katiyar <[email protected]>---
kernel/kallsyms.c | 134 +++++++++++++++++++++++++++++++----------------------1 files changed, 78 insertions(+), 56 deletions(-)kernel/kallsyms.c +0
-1@@ -30,12 +30,16 @@ #define all_var 0 #endif -/* These will be re-linked against their real values during the second link stage */
+/*
+ * These will be re-linked against their real values
+ * during the second link stage.
+ */
extern const unsigned long kallsyms_addresses[] __attribute__((weak)); extern const u8 kallsyms_names[] __attribute__((weak));kernel/kallsyms.c +3
-2-/* tell the compiler that the count isn't in the small data section if the arch -* has one (eg: FRV) +/* +* Tell the compiler that the count isn't in the small data section if the arch +* has one (eg: FRV). */
extern const unsigned longkallsyms_num_syms
__attribute__((weak,section(".rodata")));kernel/kallsyms.c +42
-26@@ -75,31 +79,37 @@ static int is_ksym_addr(unsigned long addr) return is_kernel_text(addr) || is_kernel_inittext(addr); } -/* expand a compressed symbol data into the resulting uncompressed string, -given the offset to where the symbol is in the compressed stream */ +/* +* Expand a compressed symbol data into the resulting uncompressed string, +* given the offset to where the symbol is in the compressed stream. +*/ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result) { int len, skipped_first = 0; const u8 *tptr, *data; - /* get the compressed symbol length from the first symbol byte */ + /* Get the compressed symbol length from the first symbol byte. */ data = &kallsyms_names[off]; len = *data; data++; - /* update the offset to return the offset for the next symbol on - * the compressed stream */ + /* + * Update the offset to return the offset for the next symbol on + * the compressed stream. + */ off += len + 1; - /* for every byte on the compressed symbol data, copy the table - entry for that byte */ - while(len) { - tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ]; + /* + * For every byte on the compressed symbol data, copy the table + * entry for that byte. + */ + while (len) { + tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; data++; len--; while (*tptr) { - if(skipped_first) { + if (skipped_first) { *result = *tptr; result++; } else@@ -110,36 +120,46 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result) *result = '\0'; - /* return to offset to the next symbol */ + /* Return to offset to the next symbol. */ return off; } -/* get symbol type information. This is encoded as a single char at the -* begining of the symbol name */ +/* +* Get symbol type information. This is encoded as a single char at the +* beginning of the symbol name. +*/ static char kallsyms_get_symbol_type(unsigned int off) { - /* get just the first code, look it up in the token table, and return the - * first char from this token */ - return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ]; + /* + * Get just the first code, look it up in the token table, + * and return the first char from this token. + */ + return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off + 1]]]; } -/* find the offset on the compressed stream given and index in the -* kallsyms array */ +/* +* Find the offset on the compressed stream given and index in the +* kallsyms array. +*/ static unsigned int get_symbol_offset(unsigned long pos) { const u8 *name; int i; - /* 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] ]; + /* + * 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]]; - /* sequentially scan all the symbols up to the point we're searching for. - * Every symbol is stored in a [<len>][<len> 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++) + /* + * Sequentially scan all the symbols up to the point we're searching + * for. Every symbol is stored in a [<len>][<len> 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++) name = name + (*name) + 1;return name -
kallsyms_names;kernel/kallsyms.c +9
-9@@ -171,7 +191,7 @@ static unsigned long get_symbol_pos(unsigned long addr, /* This kernel should never had been booted. */ BUG_ON(!kallsyms_addresses); - /* do a binary search on the sorted kallsyms_addresses array */ + /* Do a binary search on the sorted kallsyms_addresses array. */ low = 0; high = kallsyms_num_syms;@@ -184,15 +204,15 @@ static unsigned long get_symbol_pos(unsigned long addr, } /* - * search for the first aliased symbol. Aliased - * symbols are symbols with the same address + * Search for the first aliased symbol. Aliased + * symbols are symbols with the same address. */ while (low && kallsyms_addresses[low-1] = kallsyms_addresses[low]) --low; symbol_start = kallsyms_addresses[low]; - /* Search for next non-aliased symbol */ + /* Search for next non-aliased symbol. */ for (i = low + 1; i < kallsyms_num_syms; i++) { if (kallsyms_addresses[i] > symbol_start) { symbol_end = kallsyms_addresses[i];@@ -200,7 +220,7 @@ static unsigned long get_symbol_pos(unsigned long addr, } } - /* if we found no next symbol, we use the end of the section */ + /* If we found no next symbol, we use the end of the section. */ if (!symbol_end) { if (is_kernel_inittext(addr)) symbol_end = (unsigned long)_einittext;@@ -233,10 +253,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize, /* * Lookup an address - * - modname is set to NULL if it's in the kernel - * - we guarantee that the returned name is valid until we reschedule even if - * it resides in a module - * - we also guarantee that modname will be valid until rescheduled + * - modname is set to NULL if it's in the kernel. + * - We guarantee that the returned name is valid until we reschedule even if. + * It resides in a module. + * - We also guarantee that modname will be valid until rescheduled. */ const char *kallsyms_lookup(unsigned long addr,unsigned long *symbolsize,
kernel/kallsyms.c +7
-6@@ -257,7 +277,7 @@ const char *kallsyms_lookup(unsigned long addr, return namebuf; } - /* see if it's in a module */ + /* See if it's in a module. */ return module_address_lookup(addr, symbolsize, offset, modname, namebuf); }@@ -275,7 +295,7 @@ int lookup_symbol_name(unsigned long addr, char *symname) kallsyms_expand_symbol(get_symbol_offset(pos), symname); return 0; } - /* see if it's in a module */ + /* See if it's in a module. */ return lookup_module_symbol_name(addr, symname); }@@ -294,7 +314,7 @@ int lookup_symbol_attrs(unsigned long addr,unsigned long *size, modname[0] = '\0'; return 0; } - /* see if it's in a module */ + /* See if it's in a module. */ return lookup_module_symbol_attrs(addr, size, offset, modname, name); }@@ -323,6 +343,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,13 +354,13 @@ 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 */ + unsigned int nameoff; /* If iterating in core kernel symbols. */ char type; char name[KSYM_NAME_LEN];char module_name[MODULE_NAME_LEN];
kernel/kallsyms.c +1
-1@@ -385,7 +406,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);
kernel/kallsyms.c +5
-3@@ -420,23 +441,25 @@ 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; if (iter->module_name[0]) { char type; - /* Label it "global" if it is exported, -* "local" if not exported. */ + /* +* Label it "global" if it is exported, +* "local" if not exported. +*/ 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 *)),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 *)),iter->value,iter->type,iter->name); return 0;
}kernel/kallsyms.c +5
-7@@ -450,9 +473,11 @@ static const struct seq_operations kallsyms_op = { static int kallsyms_open(struct inode *inode, struct file *file) { - /* We keep iterator in m->private, since normal case is to + /* + * We keep iterator in m->private, since normal case is to * s_start from where we left off, so we avoid doing - * using get_symbol_offset for every symbol */ + * using get_symbol_offset for every symbol. + */ struct kallsym_iter *iter; int ret;@@ -481,7 +506,4 @@ static int __init kallsyms_init(void) proc_create("kallsyms", 0444, NULL, &kallsyms_operations); return 0; } -__initcall (kallsyms_init); - -EXPORT_SYMBOL (__print_symbol); -EXPORT_SYMBOL_GPL (sprint_symbol); +device_initcall (kallsyms_init); --1.5.4.3
Quoted 10 lines
Thanks -
ManishQuoted 5 lines
--
Stefan Richter
-===-=--= --=- =--=
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 6 lines · Manish Katiyar
Quoted 1 line · Manish Katiyar
Below is the updated patch
Hi Stefan,
Has this been accepted, or is it still not worth it ?
Your last posting looked good to me. But I am not the one to take it; I just looked at the thread coincidentally.
One thing that wasn't answered in the discussion is whether device_initcall is not only the equivalent but also the /best/ replacement of __initcall, specifically for kallsyms_init. (Maybe it should be something else; then a mechanical replacement by device_initcall would lower awareness of the issue --- if there is an issue. There probably isn't, but I don't know.)
Signature · 3 lines
Stefan Richter -===-=--= --= ---= http://arcgraph.de/sr/
Re: [PATCH] Replace deprecated __initcall with device_initcall and
In reply to Manish KatiyarQuoted 9 lines · Stefan Richter
Quoted 6 lines · Manish Katiyar
Quoted 1 line · Manish Katiyar
Below is the updated patch
Hi Stefan,
Has this been accepted, or is it still not worth it ?
Your last posting looked good to me. But I am not the one to take it;
Thanks a lot for your response Stefan.
I understand that this doesn't lie in purview of Ingo's interest, but since one of the kernel maintainers is already in the mail chain, Ingo can it be pulled by you, else I will send it to andrew or probably [email protected].
Quoted 9 lines
I
just looked at the thread coincidentally.One thing that wasn't answered in the discussion is whether
device_initcallis not only the equivalent but also the /best/ replacement of__initcall, specifically forkallsyms_init. (Maybe it should be something else; then a mechanical replacement bydevice_initcallwould lower awareness of the issue --- if there is an issue. There probably isn't, but I don't know.)
hmm... I don't know much about this, and googling doesn't give anything significant.
Thanks -
Manish
Quoted 5 lines
--
Stefan Richter
-===-=--= --= ---=
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html