Signed-off-by: Richa Jha <[email protected]>
PATCH 1/1 Signed-off-by: Richa Jha <[email protected]>
From short to string conversion
--- drivers/char/efirtc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/char/efirtc.c +4 -1
@@ -302,6 +302,7 @@ static int efi_rtc_proc_show(struct seq_file *m, void *v)efi_time_cap_t cap;efi_bool_t enabled, pending;unsigned long flags; +char str_timezone[128 ];memset (&eft,0 ,sizeof (eft));memset (&alm,0 ,sizeof (alm));
@@ -326,7 +327,9 @@ static int efi_rtc_proc_show(struct seq_file *m, void *v)seq_puts (m,"Timezone : unspecified\n" ); else/* XXX fixme: convert to string? */ - seq_printf(m, "Timezone : %u\n", eft.timezone); + for(i= eft.timezone,c=0; i>0 ;c++,i=i/10) + str_timezone[c] = i%10 - 48 +seq_puts (m, str_timezone); seq_printf(m,
Signature · 1 line
2.1.4
Arnd Bergmann
maintainerQuoted 2 lines · Richa Jha
From short to string conversion
---
Hi Richa,
Sorry, but we can't take that patch:
- The patch description doesn't explain what the patch is good for, only what it does.
drivers/char/efirtc.c static int efi_rtc_proc_show(struct seq_file *m, void *v) · line 332
Quoted 8 lines
drivers/char/efirtc.c +3
-1@@ -326,7 +327,9 @@ static int efi_rtc_proc_show(struct seq_file *m, void *v)seq_puts (m,"Timezone : unspecified\n" ); else/* XXX fixme: convert to string? */ - seq_printf(m, "Timezone : %u\n", eft.timezone); + for(i= eft.timezone,c=0; i>0 ;c++,i=i/10) + str_timezone[c] = i%10 - 48 +seq_puts (m, str_timezone);
- It won't compile.
- It seems to change an established ABI in an incompatible way
- My guess is that you are trying to address the 'fixme' comment, but this doesn't seem to do what the comment is about, and you leave the fixme in place. 'fixme' comments tend to be for things that the original author could not figure out initially because they are hard, so they are not a good place to start.
- the coding style is wrong
- you appear to re-implement parts of what sprintf does in a less portable way.
- You are probably trying to just learn about kernel hacking. This is good, but drivers/char/efirtc.c is a particularly bad place to start. The driver is completely obsolete (replaced by drivers/rtc/rtc-efi.c) and there is no maintainer for it.
https://kernelnewbies.org/Outreachyfirstpatch has a good overview of how to start.
Arnd