aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvision/usbvision.h
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.h
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.h')
-rw-r--r--drivers/media/video/usbvision/usbvision.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h
index b4412a5014ad..9cad77733400 100644
--- a/drivers/media/video/usbvision/usbvision.h
+++ b/drivers/media/video/usbvision/usbvision.h
@@ -342,21 +342,24 @@ struct usbvision_frame {
342#define BRIDGE_NT1005 1005 342#define BRIDGE_NT1005 1005
343 343
344struct usbvision_device_data_st { 344struct usbvision_device_data_st {
345 int Interface; /* to handle special interface number like BELKIN and Hauppauge WinTV-USB II */
346 int Codec;
347 int VideoChannels;
348 __u64 VideoNorm; 345 __u64 VideoNorm;
349 int AudioChannels; 346 const char *ModelString;
350 int Radio:1; 347 int Interface; /* to handle special interface number like BELKIN and Hauppauge WinTV-USB II */
351 int vbi:1; 348 __u16 Codec;
352 int Tuner:1; 349 unsigned VideoChannels:3;
353 int TunerType; 350 unsigned AudioChannels:2;
354 int Vin_Reg1; 351 unsigned Radio:1;
355 int Vin_Reg2; 352 unsigned vbi:1;
356 int X_Offset; 353 unsigned Tuner:1;
357 int Y_Offset; 354 unsigned Vin_Reg1_override:1; /* Override default value with */
358 int Dvi_yuv; 355 unsigned Vin_Reg2_override:1; /* Vin_Reg1, Vin_Reg2, etc. */
359 char *ModelString; 356 unsigned Dvi_yuv_override:1;
357 __u8 Vin_Reg1;
358 __u8 Vin_Reg2;
359 __u8 Dvi_yuv;
360 __u8 TunerType;
361 __s16 X_Offset;
362 __s16 Y_Offset;
360}; 363};
361 364
362/* Declared on usbvision-cards.c */ 365/* Declared on usbvision-cards.c */