mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Toshiharu Okada" <toshiharu-linux@dsn.okisemi.com>
To: "Michał Nazarewicz" <m.nazarewicz@samsung.com>,
	"Andy Isaacson" <adi@hexapodia.org>
Cc: "Greg Kroah-Hartman" <gregkh@suse.de>,
	"LKML" <linux-kernel@vger.kernel.org>,
	"linux-usb" <linux-usb@vger.kernel.org>,
	"Wang, Qi" <qi.wang@intel.com>,
	"Wang, Yong Y" <yong.y.wang@intel.com>,
	"Andrew" <andrew.chih.howe.khor@intel.com>,
	"Intel OTC" <joel.clark@intel.com>,
	"Foster, Margie" <margie.foster@intel.com>,
	"Ewe, Kok Howg" <kok.howg.ewe@intel.com>
Subject: Re: [PATCH v7] USB device driver of Topcliff PCH
Date: Tue, 9 Nov 2010 13:57:05 +0900	[thread overview]
Message-ID: <001601cb7fca$918dc5e0$66f8800a@maildom.okisemi.com> (raw)
In-Reply-To: <op.vlum8dzo7p4s8u@pikus>

Hi Michal

Thank you for your comment.
I will modify to "if-else-if-else" as follows.

-----------
if (!list_empty(&ep->queue)) {
    dev_dbg(&dev->pdev->dev, "%s: list not empty", __func__);
    ret = -EAGAIN;
} else {
    if (halt) { /* halt or clear halt */
        if (ep->num == PCH_UDC_EP0)
            ep->dev->stall = 1;
        pch_udc_ep_set_stall(ep);
        pch_udc_enable_ep_interrupts(ep->dev, PCH_UDC_EPINT(ep->in,
ep->num));
        ret = 0;
    } else {
        pch_udc_ep_clear_stall(ep);
        ret = 0;
    }
}
-------------

Best regards
Toshiharu Okada (OKI SEMICONDUCTOR)
-----
Date: Mon, 08 Nov 2010 12:22:51 +0100
From: "Michał Nazarewicz" <m.nazarewicz@samsung.com>
> On Wed, 03 Nov 2010 19:37:50 +0100, Andy Isaacson <adi@hexapodia.org>
wrote:
> > I think this would be clearer as
> >
> > + if (!list_empty(&ep->queue)) {
> > + dev_dbg(&dev->pdev->dev, "%s: list not empty", __func__);
> > + ret = -EAGAIN;
> > + }
> > + if (halt) {
> > + if (ep->num == PCH_UDC_EP0)
> > + ep->dev->stall = 1;
> > + pch_udc_ep_set_stall(ep);
> > + pch_udc_enable_ep_interrupts(ep->dev,
> > +      PCH_UDC_EPINT(ep->in, ep->num));
> > + ret = 0;
> > + } else {
> > + pch_udc_ep_clear_stall(ep);
> > + ret = 0;
> > + }
>
> This changes the behavior of the construct though.
>
> > because:
> > 1. if (!list_empty  is a standalone check, there is no if/else if/else
> > connection between list_empty() and halt.
>
> This depends on how you look at it.  The way I see it is that there are
three
> mutually exclusive cases: the list is not empty, it is a halt, it is not a
> halt.  This way, if-else-if-else seems like a good construct to me.
>
> > 2. I prefer if (foo) {} else {} instead of if (!foo) {} else {}, unless
> > there is a significant reason to do the negated test.
>
> I agree on that though.
>
> >> + pr_debug("%s: %s", __func__, usbep->name);
> >
> > There are probably too many pr_debug() and dev_dbg()s in this driver.
> > Please reconsider which ones are appropriate for mainline.
>
> Do we really care?  Just don't define DEBUG...
>
> -- 
> Best regards,                                        _     _
> | Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
> | Computer Science,  Michał "mina86" Nazarewicz       (o o)
> +----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>


  reply	other threads:[~2010-11-09  4:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-25 10:24 Toshiharu Okada
2010-11-03 18:37 ` Andy Isaacson
2010-11-04  8:35   ` Toshiharu Okada
2010-11-08 11:22   ` Michał Nazarewicz
2010-11-09  4:57     ` Toshiharu Okada [this message]
2010-11-10 12:29       ` Michał Nazarewicz
2010-11-11  1:06         ` Toshiharu Okada

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='001601cb7fca$918dc5e0$66f8800a@maildom.okisemi.com' \
    --to=toshiharu-linux@dsn.okisemi.com \
    --cc=adi@hexapodia.org \
    --cc=andrew.chih.howe.khor@intel.com \
    --cc=gregkh@suse.de \
    --cc=joel.clark@intel.com \
    --cc=kok.howg.ewe@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.nazarewicz@samsung.com \
    --cc=margie.foster@intel.com \
    --cc=qi.wang@intel.com \
    --cc=yong.y.wang@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome