public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [TRIVIAL] Simplify tosh_get_info() in drivers/char/toshiba.c
@ 2006-01-16 17:07 Michael Opdenacker
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Opdenacker @ 2006-01-16 17:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Adrian Bunk

This patch against 2.6.15 is just a trivial simplification of 
tosh_get_info() in drivers/char/toshiba.c.
It was doing something like: b=a; b+=c; return b-a;
Replaced by: return c;
Also removed an unnecessary local variable.

Signed-off-by: Michael Opdenacker <michael@free-electrons.com>

diff -pruN linux-2.6.15/drivers/char/toshiba.c linux-2.6.15-toshiba/drivers/char/toshiba.c
--- linux-2.6.15/drivers/char/toshiba.c	2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.15-toshiba/drivers/char/toshiba.c	2006-01-16 10:26:02.000000000 +0100
@@ -299,12 +299,6 @@ static int tosh_ioctl(struct inode *ip, 
 #ifdef CONFIG_PROC_FS
 static int tosh_get_info(char *buffer, char **start, off_t fpos, int length)
 {
-	char *temp;
-	int key;
-
-	temp = buffer;
-	key = tosh_fn_status();
-
 	/* Arguments
 	     0) Linux driver version (this will change if format changes)
 	     1) Machine ID
@@ -314,16 +308,14 @@ static int tosh_get_info(char *buffer, c
 	     5) Fn Key status
 	*/
 
-	temp += sprintf(temp, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n",
+	return sprintf(buffer, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n",
 		tosh_id,
 		(tosh_sci & 0xff00)>>8,
 		tosh_sci & 0xff,
 		(tosh_bios & 0xff00)>>8,
 		tosh_bios & 0xff,
 		tosh_date,
-		key);
-
-	return temp-buffer;
+		tosh_fn_status());
 }
 #endif
 


-- 
Michael Opdenacker, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training



^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] [TRIVIAL] Simplify tosh_get_info() in drivers/char/toshiba.c
@ 2006-06-25 16:01 Michael Opdenacker
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Opdenacker @ 2006-06-25 16:01 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Adrian Bunk

This patch against 2.6.17 is just a trivial simplification of 
tosh_get_info() in drivers/char/toshiba.c.
It was doing something like: b=a; b+=c; return b-a;
Replaced by: return c;
Also removed an unnecessary local variable.

Also available on 
http://free-electrons.com/pub/patches/linux/20060625/patch-2.6.17-toshiba

Signed-off-by: Michael Opdenacker <michael@free-electrons.com>

--- linux-2.6.17/drivers/char/toshiba.c    2006-06-18 03:49:35.000000000 
+0200
+++ linux-2.6.17-toshiba/drivers/char/toshiba.c    2006-06-25 
17:49:56.000000000 +0200
@@ -299,12 +299,6 @@ static int tosh_ioctl(struct inode *ip,
 #ifdef CONFIG_PROC_FS
 static int tosh_get_info(char *buffer, char **start, off_t fpos, int 
length)
 {
-    char *temp;
-    int key;
-
-    temp = buffer;
-    key = tosh_fn_status();
-
     /* Arguments
          0) Linux driver version (this will change if format changes)
          1) Machine ID
@@ -314,16 +308,14 @@ static int tosh_get_info(char *buffer, c
          5) Fn Key status
     */
 
-    temp += sprintf(temp, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n",
+    return sprintf(buffer, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n",
         tosh_id,
         (tosh_sci & 0xff00)>>8,
         tosh_sci & 0xff,
         (tosh_bios & 0xff00)>>8,
         tosh_bios & 0xff,
         tosh_date,
-        key);
-
-    return temp-buffer;
+        tosh_fn_status());
 }
 #endif
 

-- 
Michael Opdenacker, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training



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

end of thread, other threads:[~2006-06-25 16:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-16 17:07 [PATCH] [TRIVIAL] Simplify tosh_get_info() in drivers/char/toshiba.c Michael Opdenacker
  -- strict thread matches above, loose matches on Subject: below --
2006-06-25 16:01 Michael Opdenacker

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