]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] gspca - sonixj: Remove magic numbers for delay
authorNémeth Márton <nm127@freemail.hu>
Mon, 18 Oct 2010 10:00:48 +0000 (07:00 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 16:30:03 +0000 (14:30 -0200)
The number 0xdd is used for marking delay init sequence steps.
Replace 0xdd values only if the meaning is delay.

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/sonixj.c

index c0573c405a11bf978d10591e3e08a361e35bab65..da64947fc08f594593c478f15ea04f73d79602b1 100644 (file)
@@ -552,20 +552,23 @@ static const u8 reg84[] = {
        0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f,     /* VR VG VB */
        0x00, 0x00, 0x00                        /* YUV offsets */
 };
+
+#define DELAY  0xdd
+
 static const u8 adcm1700_sensor_init[][8] = {
        {0xa0, 0x51, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xb0, 0x51, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10},       /* reset */
-       {0xdd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+       {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
        {0xb0, 0x51, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+       {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
        {0xb0, 0x51, 0x0c, 0xe0, 0x2e, 0x00, 0x00, 0x10},
        {0xb0, 0x51, 0x10, 0x02, 0x02, 0x00, 0x00, 0x10},
        {0xb0, 0x51, 0x14, 0x0e, 0x0e, 0x00, 0x00, 0x10},
        {0xb0, 0x51, 0x1c, 0x00, 0x80, 0x00, 0x00, 0x10},
        {0xb0, 0x51, 0x20, 0x01, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+       {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
        {0xb0, 0x51, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+       {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
        {0xb0, 0x51, 0x04, 0x01, 0x00, 0x00, 0x00, 0x10},
        {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10},
        {0xb0, 0x51, 0x14, 0x01, 0x00, 0x00, 0x00, 0x10},
@@ -609,7 +612,7 @@ static const u8 gc0307_sensor_init[][8] = {
        {0xa0, 0x21, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x10},
        {0xa0, 0x21, 0x0f, 0xb2, 0x00, 0x00, 0x00, 0x10},
        {0xa0, 0x21, 0x12, 0x70, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 10ms*/
+       {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 10ms*/
        {0xa0, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xa0, 0x21, 0x15, 0xb8, 0x00, 0x00, 0x00, 0x10},
        {0xa0, 0x21, 0x16, 0x13, 0x00, 0x00, 0x00, 0x10},
@@ -730,9 +733,9 @@ static const u8 mi0360_sensor_init[][8] = {
 static const u8 mi0360b_sensor_init[][8] = {
        {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
        {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10},
-       {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/
+       {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/
        {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/
+       {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/
        {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10},
        {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10},
        {0xd1, 0x5d, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10},
@@ -808,7 +811,7 @@ static const u8 mo4000_sensor_init[][8] = {
 };
 static const u8 mt9v111_sensor_init[][8] = {
        {0xb1, 0x5c, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, /* reset? */
-       {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
+       {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
        {0xb1, 0x5c, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xb1, 0x5c, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10}, /* IFP select */
        {0xb1, 0x5c, 0x08, 0x04, 0x80, 0x00, 0x00, 0x10}, /* output fmt ctrl */
@@ -896,10 +899,10 @@ static const u8 om6802_sensor_param1[][8] = {
 static const u8 ov7630_sensor_init[][8] = {
        {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
+       {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
        {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
+       {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
        {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},
 /* win: i2c_r from 00 to 80 */
        {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10},
@@ -953,7 +956,7 @@ static const u8 ov7630_sensor_param1[][8] = {
 static const u8 ov7648_sensor_init[][8] = {
        {0xa1, 0x21, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},       /* reset */
-       {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
+       {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
        {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xd1, 0x21, 0x03, 0xa4, 0x30, 0x88, 0x00, 0x10},
        {0xb1, 0x21, 0x11, 0x80, 0x08, 0x00, 0x00, 0x10},
@@ -1002,7 +1005,7 @@ static const u8 ov7648_sensor_param1[][8] = {
 
 static const u8 ov7660_sensor_init[][8] = {
        {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */
-       {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
+       {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
        {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
                                                /* Outformat = rawRGB */
        {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */
@@ -1098,7 +1101,7 @@ static const u8 ov7660_sensor_param1[][8] = {
 static const u8 po1030_sensor_init[][8] = {
 /* the sensor registers are described in m5602/m5602_po1030.h */
        {0xa1, 0x6e, 0x3f, 0x20, 0x00, 0x00, 0x00, 0x10}, /* sensor reset */
-       {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
+       {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
        {0xa1, 0x6e, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x6e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xd1, 0x6e, 0x04, 0x02, 0xb1, 0x02, 0x39, 0x10},
@@ -1152,10 +1155,10 @@ static const u8 po1030_sensor_param1[][8] = {
 static const u8 po2030n_sensor_init[][8] = {
        {0xa1, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x6e, 0x1f, 0x99, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */
+       {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */
        {0xa1, 0x6e, 0x1e, 0x0a, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x6e, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */
+       {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */
        {0xa1, 0x6e, 0x20, 0x44, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x6e, 0x05, 0x70, 0x00, 0x00, 0x00, 0x10},
@@ -1204,7 +1207,7 @@ static const u8 po2030n_sensor_init[][8] = {
 };
 static const u8 po2030n_sensor_param1[][8] = {
        {0xa1, 0x6e, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 8ms */
+       {DELAY, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 8ms */
        {0xa1, 0x6e, 0x1b, 0xf4, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10},
        {0xd1, 0x6e, 0x16, 0x50, 0x40, 0x49, 0x40, 0x10},
@@ -1218,16 +1221,16 @@ static const u8 po2030n_sensor_param1[][8] = {
        {0xc1, 0x6e, 0x16, 0x52, 0x40, 0x48, 0x00, 0x10},
 /*after start*/
        {0xa1, 0x6e, 0x15, 0x0f, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */
+       {DELAY, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */
        {0xa1, 0x6e, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x10},
-       {0xdd, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */
+       {DELAY, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */
        {0xa1, 0x6e, 0x1b, 0x53, 0x00, 0x00, 0x00, 0x10},
        {}
 };
 
 static const u8 soi768_sensor_init[][8] = {
        {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */
-       {0xdd, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 96ms */
+       {DELAY, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 96ms */
        {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x10},
@@ -1542,7 +1545,7 @@ static void i2c_w_seq(struct gspca_dev *gspca_dev,
                        const u8 (*data)[8])
 {
        while ((*data)[0] != 0) {
-               if ((*data)[0] != 0xdd)
+               if ((*data)[0] != DELAY)
                        i2c_w8(gspca_dev, *data);
                else
                        msleep((*data)[1]);