All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] V4L: stk11xx, add a new webcam driver
Date: Tue, 28 Aug 2007 07:33:08 +0200	[thread overview]
Message-ID: <46D3B394.9090609@gmail.com> (raw)
In-Reply-To: <20070827154049.8c5e61fe.akpm@linux-foundation.org>

Andrew Morton napsal(a):
> On Sun, 26 Aug 2007 07:09:02 -0700
> Jiri Slaby <jirislaby@gmail.com> 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@gmail.com)
Faculty of Informatics, Masaryk University

  reply	other threads:[~2007-08-28  5:33 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-26 14:09 [PATCH 1/1] V4L: stk11xx, add a new webcam driver Jiri Slaby
2007-08-27 22:40 ` Andrew Morton
2007-08-28  5:33   ` Jiri Slaby [this message]
2007-08-28  5:36     ` Andrew Morton
2007-08-28  5:41       ` Jiri Slaby
2007-08-28  6:35 ` Alexander E. Patrakov
2007-11-06  7:40 ` Andrew Morton
2007-11-06 10:48   ` Jiri Slaby
2007-11-07 17:57     ` Mauro Carvalho Chehab
  -- strict thread matches above, loose matches on Subject: below --
2007-05-24 14:01 Jiri Slaby
2007-05-24 14:24 ` Markus Rechberger
2007-05-24 15:07   ` Jiri Slaby
2007-05-28 15:21     ` Markus Rechberger
2007-05-24 23:07   ` Jiri Slaby
2007-05-25  8:22     ` Stefan Richter
2007-05-25  8:30       ` Jiri Slaby
2007-05-24 17:38 ` Diego Calleja
2007-05-24 18:01   ` Ismail Dönmez
2007-05-25  8:19     ` Stefan Richter
     [not found]       ` <4af2d03a0705250127j3d05cd6bkb114cad0e6ecb449@mail.gmail.com>
2007-05-25  9:50         ` Stefan Richter
2007-05-28 15:00 ` Mauro Carvalho Chehab
2007-05-28 15:14   ` Markus Rechberger
2007-05-28 16:28     ` Luca Risolia
2007-05-28 16:42       ` Markus Rechberger
2007-05-28 18:57     ` Mauro Carvalho Chehab
2007-05-28 19:17       ` Markus Rechberger
2007-05-28 20:11         ` Mauro Carvalho Chehab
2007-05-28 21:30           ` Thierry Merle
2007-05-29  5:32             ` Thierry Merle
2007-05-29 14:25               ` Mauro Carvalho Chehab
2007-05-29 19:04                 ` Thierry Merle
2007-05-29 19:31                   ` Mauro Carvalho Chehab
2007-05-31 20:43                     ` Thierry Merle
2007-06-01 23:10                       ` Mauro Carvalho Chehab
2007-06-02  9:00                         ` Thierry Merle
2007-06-04 18:55                           ` Mauro Carvalho Chehab
2007-06-15 21:08                             ` Jiri Slaby
2007-06-16 11:46                               ` Thierry Merle
2007-06-16 12:07                                 ` Jiri Slaby
     [not found]                               ` <200706190941.47459.oliver@neukum.org>
2007-06-19  7:44                                 ` Jiri Slaby
2007-05-30 19:44   ` Jiri Slaby
2007-06-01 23:00     ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46D3B394.9090609@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.