V4L/DVB (13924): gspca - sunplus: Optimize and remove unused sequences.
authorJean-Francois Moine <moinejf@free.fr>
Sun, 10 Jan 2010 17:39:24 +0000 (14:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:31 +0000 (15:10 -0300)
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/sunplus.c

index 472f568..0c786e0 100644 (file)
@@ -267,142 +267,6 @@ static const struct cmd spca504A_clicksmart420_open_data[] = {
        {0x06, 0x0000, 0x0000},
        {0x00, 0x0004, 0x2880},
        {0x00, 0x0001, 0x2881},
-/* look like setting a qTable */
-       {0x00, 0x0006, 0x2800},
-       {0x00, 0x0004, 0x2801},
-       {0x00, 0x0004, 0x2802},
-       {0x00, 0x0006, 0x2803},
-       {0x00, 0x000a, 0x2804},
-       {0x00, 0x0010, 0x2805},
-       {0x00, 0x0014, 0x2806},
-       {0x00, 0x0018, 0x2807},
-       {0x00, 0x0005, 0x2808},
-       {0x00, 0x0005, 0x2809},
-       {0x00, 0x0006, 0x280a},
-       {0x00, 0x0008, 0x280b},
-       {0x00, 0x000a, 0x280c},
-       {0x00, 0x0017, 0x280d},
-       {0x00, 0x0018, 0x280e},
-       {0x00, 0x0016, 0x280f},
-
-       {0x00, 0x0006, 0x2810},
-       {0x00, 0x0005, 0x2811},
-       {0x00, 0x0006, 0x2812},
-       {0x00, 0x000a, 0x2813},
-       {0x00, 0x0010, 0x2814},
-       {0x00, 0x0017, 0x2815},
-       {0x00, 0x001c, 0x2816},
-       {0x00, 0x0016, 0x2817},
-       {0x00, 0x0006, 0x2818},
-       {0x00, 0x0007, 0x2819},
-       {0x00, 0x0009, 0x281a},
-       {0x00, 0x000c, 0x281b},
-       {0x00, 0x0014, 0x281c},
-       {0x00, 0x0023, 0x281d},
-       {0x00, 0x0020, 0x281e},
-       {0x00, 0x0019, 0x281f},
-
-       {0x00, 0x0007, 0x2820},
-       {0x00, 0x0009, 0x2821},
-       {0x00, 0x000f, 0x2822},
-       {0x00, 0x0016, 0x2823},
-       {0x00, 0x001b, 0x2824},
-       {0x00, 0x002c, 0x2825},
-       {0x00, 0x0029, 0x2826},
-       {0x00, 0x001f, 0x2827},
-       {0x00, 0x000a, 0x2828},
-       {0x00, 0x000e, 0x2829},
-       {0x00, 0x0016, 0x282a},
-       {0x00, 0x001a, 0x282b},
-       {0x00, 0x0020, 0x282c},
-       {0x00, 0x002a, 0x282d},
-       {0x00, 0x002d, 0x282e},
-       {0x00, 0x0025, 0x282f},
-
-       {0x00, 0x0014, 0x2830},
-       {0x00, 0x001a, 0x2831},
-       {0x00, 0x001f, 0x2832},
-       {0x00, 0x0023, 0x2833},
-       {0x00, 0x0029, 0x2834},
-       {0x00, 0x0030, 0x2835},
-       {0x00, 0x0030, 0x2836},
-       {0x00, 0x0028, 0x2837},
-       {0x00, 0x001d, 0x2838},
-       {0x00, 0x0025, 0x2839},
-       {0x00, 0x0026, 0x283a},
-       {0x00, 0x0027, 0x283b},
-       {0x00, 0x002d, 0x283c},
-       {0x00, 0x0028, 0x283d},
-       {0x00, 0x0029, 0x283e},
-       {0x00, 0x0028, 0x283f},
-
-       {0x00, 0x0007, 0x2840},
-       {0x00, 0x0007, 0x2841},
-       {0x00, 0x000a, 0x2842},
-       {0x00, 0x0013, 0x2843},
-       {0x00, 0x0028, 0x2844},
-       {0x00, 0x0028, 0x2845},
-       {0x00, 0x0028, 0x2846},
-       {0x00, 0x0028, 0x2847},
-       {0x00, 0x0007, 0x2848},
-       {0x00, 0x0008, 0x2849},
-       {0x00, 0x000a, 0x284a},
-       {0x00, 0x001a, 0x284b},
-       {0x00, 0x0028, 0x284c},
-       {0x00, 0x0028, 0x284d},
-       {0x00, 0x0028, 0x284e},
-       {0x00, 0x0028, 0x284f},
-
-       {0x00, 0x000a, 0x2850},
-       {0x00, 0x000a, 0x2851},
-       {0x00, 0x0016, 0x2852},
-       {0x00, 0x0028, 0x2853},
-       {0x00, 0x0028, 0x2854},
-       {0x00, 0x0028, 0x2855},
-       {0x00, 0x0028, 0x2856},
-       {0x00, 0x0028, 0x2857},
-       {0x00, 0x0013, 0x2858},
-       {0x00, 0x001a, 0x2859},
-       {0x00, 0x0028, 0x285a},
-       {0x00, 0x0028, 0x285b},
-       {0x00, 0x0028, 0x285c},
-       {0x00, 0x0028, 0x285d},
-       {0x00, 0x0028, 0x285e},
-       {0x00, 0x0028, 0x285f},
-
-       {0x00, 0x0028, 0x2860},
-       {0x00, 0x0028, 0x2861},
-       {0x00, 0x0028, 0x2862},
-       {0x00, 0x0028, 0x2863},
-       {0x00, 0x0028, 0x2864},
-       {0x00, 0x0028, 0x2865},
-       {0x00, 0x0028, 0x2866},
-       {0x00, 0x0028, 0x2867},
-       {0x00, 0x0028, 0x2868},
-       {0x00, 0x0028, 0x2869},
-       {0x00, 0x0028, 0x286a},
-       {0x00, 0x0028, 0x286b},
-       {0x00, 0x0028, 0x286c},
-       {0x00, 0x0028, 0x286d},
-       {0x00, 0x0028, 0x286e},
-       {0x00, 0x0028, 0x286f},
-
-       {0x00, 0x0028, 0x2870},
-       {0x00, 0x0028, 0x2871},
-       {0x00, 0x0028, 0x2872},
-       {0x00, 0x0028, 0x2873},
-       {0x00, 0x0028, 0x2874},
-       {0x00, 0x0028, 0x2875},
-       {0x00, 0x0028, 0x2876},
-       {0x00, 0x0028, 0x2877},
-       {0x00, 0x0028, 0x2878},
-       {0x00, 0x0028, 0x2879},
-       {0x00, 0x0028, 0x287a},
-       {0x00, 0x0028, 0x287b},
-       {0x00, 0x0028, 0x287c},
-       {0x00, 0x0028, 0x287d},
-       {0x00, 0x0028, 0x287e},
-       {0x00, 0x0028, 0x287f},
 
        {0xa0, 0x0000, 0x0503},
 };
@@ -622,6 +486,20 @@ static void spca504_acknowledged_command(struct gspca_dev *gspca_dev,
        PDEBUG(D_FRAM, "after wait 0x%04x", notdone);
 }
 
+static void spca504_read_info(struct gspca_dev *gspca_dev)
+{
+       int i;
+       u8 info[6];
+
+       for (i = 0; i < 6; i++)
+               info[i] = reg_r_1(gspca_dev, i);
+       PDEBUG(D_STREAM,
+               "Read info: %d %d %d %d %d %d."
+               " Should be 1,0,2,2,0,0",
+               info[0], info[1], info[2],
+               info[3], info[4], info[5]);
+}
+
 static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev,
                        u8 req,
                        u16 idx, u16 val, u16 endcode, u8 count)
@@ -881,8 +759,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
 static int sd_init(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int i;
-       u8 info[6];
 
        switch (sd->bridge) {
        case BRIDGE_SPCA504B:
@@ -924,15 +800,8 @@ static int sd_init(struct gspca_dev *gspca_dev)
 /*     case BRIDGE_SPCA504: */
                PDEBUG(D_STREAM, "Opening SPCA504");
                if (sd->subtype == AiptekMiniPenCam13) {
-                       /*****************************/
-                       for (i = 0; i < 6; i++)
-                               info[i] = reg_r_1(gspca_dev, i);
-                       PDEBUG(D_STREAM,
-                               "Read info: %d %d %d %d %d %d."
-                               " Should be 1,0,2,2,0,0",
-                               info[0], info[1], info[2],
-                               info[3], info[4], info[5]);
-                       /* spca504a aiptek */
+                       spca504_read_info(gspca_dev);
+
                        /* Set AE AWB Banding Type 3-> 50Hz 2-> 60Hz */
                        spca504A_acknowledged_command(gspca_dev, 0x24,
                                                        8, 3, 0x9e, 1);
@@ -971,8 +840,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int enable;
-       int i;
-       u8 info[6];
 
        /* create the JPEG header */
        sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
@@ -1008,14 +875,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
                break;
        case BRIDGE_SPCA504:
                if (sd->subtype == AiptekMiniPenCam13) {
-                       for (i = 0; i < 6; i++)
-                               info[i] = reg_r_1(gspca_dev, i);
-                       PDEBUG(D_STREAM,
-                               "Read info: %d %d %d %d %d %d."
-                               " Should be 1,0,2,2,0,0",
-                               info[0], info[1], info[2],
-                               info[3], info[4], info[5]);
-                       /* spca504a aiptek */
+                       spca504_read_info(gspca_dev);
+
                        /* Set AE AWB Banding Type 3-> 50Hz 2-> 60Hz */
                        spca504A_acknowledged_command(gspca_dev, 0x24,
                                                        8, 3, 0x9e, 1);
@@ -1026,13 +887,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                                                        0, 0, 0x9d, 1);
                } else {
                        spca504_acknowledged_command(gspca_dev, 0x24, 8, 3);
-                       for (i = 0; i < 6; i++)
-                               info[i] = reg_r_1(gspca_dev, i);
-                       PDEBUG(D_STREAM,
-                               "Read info: %d %d %d %d %d %d."
-                               " Should be 1,0,2,2,0,0",
-                               info[0], info[1], info[2],
-                               info[3], info[4], info[5]);
+                       spca504_read_info(gspca_dev);
                        spca504_acknowledged_command(gspca_dev, 0x24, 8, 3);
                        spca504_acknowledged_command(gspca_dev, 0x24, 0, 0);
                }