[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mjpeg-users
Subject:    [Mjpeg-users] [PATCH 7/7] bt856: Shrink register cache
From:       Jean Delvare <khali () linux-fr ! org>
Date:       2006-01-08 16:12:05
Message-ID: 20060108171205.03c37149.khali () linux-fr ! org
[Download RAW message or body]

The bt856 driver has a register cache much larger than needed. We
really only write to 3 registers, so a 32-byte cache is a bit too
much. We can be just as efficient with a 6-byte cache. We could even
do with a 3-byte cache, but at the cost of additional arithmetics
arguably not worth the spared 3 bytes.

Also, 4 of the 6 other members of the bt856 data structure were not
used anywhere, so we can as well drop them for an additional 16 bytes
of memory spared.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/media/video/bt856.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

--- linux-2.6.15-git.orig/drivers/media/video/bt856.c	2006-01-08 12:09:17.000000000 +0100
+++ linux-2.6.15-git/drivers/media/video/bt856.c	2006-01-08 15:25:11.000000000 +0100
@@ -71,17 +71,14 @@
 
 /* ----------------------------------------------------------------------- */
 
-#define REG_OFFSET  0xCE
+#define REG_OFFSET	0xDA
+#define BT856_NR_REG	6
 
 struct bt856 {
-	unsigned char reg[32];
+	unsigned char reg[BT856_NR_REG];
 
 	int norm;
 	int enable;
-	int bright;
-	int contrast;
-	int hue;
-	int sat;
 };
 
 #define   I2C_BT856        0x88
@@ -120,8 +117,8 @@
 	struct bt856 *encoder = i2c_get_clientdata(client);
 
 	printk(KERN_INFO "%s: register dump:", I2C_NAME(client));
-	for (i = 0xd6; i <= 0xde; i += 2)
-		printk(" %02x", encoder->reg[i - REG_OFFSET]);
+	for (i = 0; i < BT856_NR_REG; i += 2)
+		printk(" %02x", encoder->reg[i]);
 	printk("\n");
 }
 

-- 
Jean Delvare


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic