aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvision/usbvision-core.c
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-04-14 14:16:26 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:45:34 -0400
commitc682b3a7fb8ec69ac73511bbb6a378e40aa35f35 (patch)
tree443ac5b210222822c3f4883964defd2404601d7a /drivers/media/video/usbvision/usbvision-core.c
parentf7ca6256bc1db4fb44adda99e082f8c80ada8957 (diff)
V4L/DVB (5517): Usbvision: store the device database more efficiently
One bit wide bitfields need to declared unsigned to have the range 0 to 1, or they have the range -1 to 0. A few techniques to reduce the driver's size by about 1700 bytes on ia32, probably more on x86-64. Put the biggest fields first, less padding is necessary that way. Put fields with a limited range into a smaller type. For example VideoChannels will fit in 3 bits, and TunerType can use 8 bits. Vin_Reg1, Vin_Reg2, and Dvi_yuv define values for 8-bit registers, but they can't just go into an 8-bit field with no changes, since -1 was used as a flag to indicate a value was not present. So what we do is create a one-bit flag for each one to indicate if a value is or is not present. This only takes 9 bits and has the added advantage that when the register isn't overridden (Vin_Reg[12] never are) it doesn't need to appear in the structure definition since the default value for the flag will be zero. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Acked-by: Thierry MERLE <thierry.merle@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/usbvision/usbvision-core.c')
-rw-r--r--drivers/media/video/usbvision/usbvision-core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c
index f2154dc072e2..fee4548a9cc7 100644
--- a/drivers/media/video/usbvision/usbvision-core.c
+++ b/drivers/media/video/usbvision/usbvision-core.c
@@ -2040,8 +2040,8 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
2040 return 0; 2040 return 0;
2041 2041
2042 /* Set input format expected from decoder*/ 2042 /* Set input format expected from decoder*/
2043 if (usbvision_device_data[usbvision->DevModel].Vin_Reg1 >= 0) { 2043 if (usbvision_device_data[usbvision->DevModel].Vin_Reg1_override) {
2044 value[0] = usbvision_device_data[usbvision->DevModel].Vin_Reg1 & 0xff; 2044 value[0] = usbvision_device_data[usbvision->DevModel].Vin_Reg1;
2045 } else if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113) { 2045 } else if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113) {
2046 /* SAA7113 uses 8 bit output */ 2046 /* SAA7113 uses 8 bit output */
2047 value[0] = USBVISION_8_422_SYNC; 2047 value[0] = USBVISION_8_422_SYNC;
@@ -2112,8 +2112,8 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
2112 2112
2113 dvi_yuv_value = 0x00; /* U comes after V, Ya comes after U/V, Yb comes after Yb */ 2113 dvi_yuv_value = 0x00; /* U comes after V, Ya comes after U/V, Yb comes after Yb */
2114 2114
2115 if(usbvision_device_data[usbvision->DevModel].Dvi_yuv >= 0){ 2115 if(usbvision_device_data[usbvision->DevModel].Dvi_yuv_override){
2116 dvi_yuv_value = usbvision_device_data[usbvision->DevModel].Dvi_yuv & 0xff; 2116 dvi_yuv_value = usbvision_device_data[usbvision->DevModel].Dvi_yuv;
2117 } 2117 }
2118 else if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113) { 2118 else if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113) {
2119 /* This changes as the fine sync control changes. Further investigation necessary */ 2119 /* This changes as the fine sync control changes. Further investigation necessary */