All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Vinod Koul <vkoul@kernel.org>,
	dmaengine@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH v1 3/4] dmaengine: Drop redundant 'else' keyword
Date: Wed, 26 Feb 2020 15:44:54 +0200	[thread overview]
Message-ID: <20200226134454.GP10400@smile.fi.intel.com> (raw)
In-Reply-To: <55eafd8a-d36b-5de3-ad55-ab73d9d56146@ti.com>

On Wed, Feb 26, 2020 at 02:37:27PM +0200, Peter Ujfalusi wrote:
> On 2/26/20 12:18 PM, Andy Shevchenko wrote:
> > It's obvious that 'else' keyword is redundant in the code like
> > 
> > 	if (foo)
> > 		return bar;
> > 	else if (baz)
> > 		...
> > 
> > Drop it for good.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  include/linux/dmaengine.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index ae56a91c2a05..1bb5477ef7ec 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -1230,9 +1230,9 @@ static inline int dma_maxpq(struct dma_device *dma, enum dma_ctrl_flags flags)
> >  {
> >  	if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags))
> >  		return dma_dev_to_maxpq(dma);
> > -	else if (dmaf_p_disabled_continue(flags))
> > +	if (dmaf_p_disabled_continue(flags))
> 
> I would add blank line in between the - new - if cases for better
> readability.

Thank you for review and comment.

Here I have opposite opinion, but let Vinod and Dan, as maintainers, to decide.
I'll be not against it if it's preferred way.

> >  		return dma_dev_to_maxpq(dma) - 1;
> > -	else if (dmaf_continue(flags))
> > +	if (dmaf_continue(flags))
> >  		return dma_dev_to_maxpq(dma) - 3;
> >  	BUG();
> >  }
> > @@ -1243,7 +1243,7 @@ static inline size_t dmaengine_get_icg(bool inc, bool sgl, size_t icg,
> >  	if (inc) {
> >  		if (dir_icg)
> >  			return dir_icg;
> > -		else if (sgl)
> > +		if (sgl)
> >  			return icg;
> >  	}
> >  
> > 
> 
> - Péter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2020-02-26 13:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 10:18 [PATCH v1 1/4] dmaengine: Refactor dmaengine_check_align() to be bit operations only Andy Shevchenko
2020-02-26 10:18 ` [PATCH v1 2/4] dmaengine: Use negative condition for better readability Andy Shevchenko
2020-02-26 12:36   ` Peter Ujfalusi
2020-02-26 10:18 ` [PATCH v1 3/4] dmaengine: Drop redundant 'else' keyword Andy Shevchenko
2020-02-26 12:37   ` Peter Ujfalusi
2020-02-26 13:44     ` Andy Shevchenko [this message]
2020-02-26 10:18 ` [PATCH v1 4/4] dmaengine: consistently return string literal from switch-case Andy Shevchenko
2020-02-26 12:35   ` Peter Ujfalusi
2020-02-26 12:35 ` [PATCH v1 1/4] dmaengine: Refactor dmaengine_check_align() to be bit operations only Peter Ujfalusi
2020-03-02  7:18 ` Vinod Koul

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=20200226134454.GP10400@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=peter.ujfalusi@ti.com \
    --cc=vkoul@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.