All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Kevin Hao <haokexin@gmail.com>
Cc: linux-ide@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH v3] libata: support the ata host which implements a queue depth less than 32
Date: Sat, 12 Jul 2014 04:36:43 +0400	[thread overview]
Message-ID: <53C0831B.70504@cogentembedded.com> (raw)
In-Reply-To: <20140712002626.GA314@pek-khao-d1.corp.ad.wrs.com>

On 07/12/2014 04:26 AM, Kevin Hao wrote:

>>> -	for (i = 0; i < ATA_MAX_QUEUE; i++) {
>>> -		tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE;
>>> +	for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) {
>>> +		tag = tag < max_queue ? tag : 0;

>>     Assigning 'tag' back to 'tag' is quite stupid, don't you think? Why not:

>> 		if (tag >= max_queue)
>> 			tag = 0;

> Since I am an idiot, it is very possible for me to write stupid code.
> But I don't believe this is one. I don't think the above code is more readable.

    Perhaps I'm an idiot (I even seldom doubt it) but to me it looks like 
clear abuse of the ?: operator. But that's probably just me...

> Thanks,
> Kevin

MBR, Sergei


  reply	other threads:[~2014-07-12  0:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11  6:10 [PATCH v3] libata: support the ata host which implements a queue depth less than 32 Kevin Hao
2014-07-11 11:57 ` Sergei Shtylyov
2014-07-11 14:47   ` Tejun Heo
2014-07-12  0:26   ` Kevin Hao
2014-07-12  0:36     ` Sergei Shtylyov [this message]
2014-07-11 14:51 ` Tejun Heo
2014-07-12  0:27   ` Kevin Hao
2014-07-11 16:28 ` Bartlomiej Zolnierkiewicz
2014-07-11 16:33   ` Bartlomiej Zolnierkiewicz
2014-07-12  0:58     ` Kevin Hao

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=53C0831B.70504@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=dan.j.williams@intel.com \
    --cc=haokexin@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=tj@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.