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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Morton napsal(a):
> On Sun, 26 Aug 2007 07:09:02 -0700
> Jiri Slaby <[email protected]> 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 ([email protected])
Faculty of Informatics, Masaryk University
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux