mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Signed-off-by: Richa Jha <richa.jha2@gmail.com>
@ 2017-05-17 10:12 Richa Jha
  2017-05-17 12:02 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Richa Jha @ 2017-05-17 10:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Richa Jha

 From short to string conversion
---
 drivers/char/efirtc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c
index dc62568..b8a4d02 100644
--- a/drivers/char/efirtc.c
+++ b/drivers/char/efirtc.c
@@ -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,
-- 
2.1.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Signed-off-by: Richa Jha <richa.jha2@gmail.com>
  2017-05-17 10:12 [PATCH] Signed-off-by: Richa Jha <richa.jha2@gmail.com> Richa Jha
@ 2017-05-17 12:02 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2017-05-17 12:02 UTC (permalink / raw)
  To: Richa Jha; +Cc: Linux Kernel Mailing List

On Wed, May 17, 2017 at 12:12 PM, Richa Jha <richa.jha2@gmail.com> wrote:
>  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.

> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-17 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17 10:12 [PATCH] Signed-off-by: Richa Jha <richa.jha2@gmail.com> Richa Jha
2017-05-17 12:02 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®