Re: [PATCH 1/1] V4L: stk11xx, add a new webcam driver

From: Jiri Slaby
Date: Tue Aug 28 2007 - 01:33:50 EST


Andrew Morton napsal(a):
> On Sun, 26 Aug 2007 07:09:02 -0700
> Jiri Slaby <jirislaby@xxxxxxxxx> wrote:
> + retok = stk11xx_check_device(dev, 500);
> + if (retok != 1) {
> + dev_err(&dev->udev->dev, "load microcode fail\n");
> + return -EIO;
> + }
>
> Normally we'd use a return value of zero to indicate success. So that the
> negative return value can tell people _why_ it failed.

it returns
-EIO = fail
0 = we succeeded, but the device is not ready
1 = the device is OK

Seems proper to change the 0 -> EBUSY or something and 1 -> 0 anyway, if we
check only for 1.

>> +
>> + for (i = 0; i < 16; i++) {
>> + stk11xx_write_reg(dev, 0x0000, 0x25);
>> + stk11xx_write_reg(dev, 0x0000, 0x24);
>> + stk11xx_read_reg(dev, 0x0000, &value);
>> +
>> + dev_dbg(&dev->udev->dev, "Loop 1: Read 0x0000 = %02x\n", value);
>> + }
>> +
>> + ret = stk11xx_process_table(dev, table_2);
>> + if (ret)
>> + goto end;
>> +
>> + for (i = 0; i < 16; i++) {
>> + stk11xx_write_reg(dev, 0x0000, 0x25);
>> + stk11xx_write_reg(dev, 0x0000, 0x24);
>> + stk11xx_read_reg(dev, 0x0000, &value);
>> +
>> + dev_dbg(&dev->udev->dev, "Loop 2: Read 0x0000 = %02x\n", value);
>> + }
>> +
>> + ret = stk11xx_process_table(dev, table_3);
>> + if (ret)
>> + goto end;
>> +
>> + for (i = 0; i < 16; i++) {
>> + stk11xx_write_reg(dev, 0x0000, 0x25);
>> + stk11xx_write_reg(dev, 0x0000, 0x24);
>> + stk11xx_read_reg(dev, 0x0000, &value);
>> +
>> + dev_dbg(&dev->udev->dev, "Loop 3: Read 0x0000 = %02x\n", value);
>> + }
>
> Again, ARRAY_SIZE() would be clearer here.

No, this is only do this 16 times, no corresponding table :).

thanks for review,
--
Jiri Slaby (jirislaby@xxxxxxxxx)
Faculty of Informatics, Masaryk University
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/