Message ID | 20200226101842.29426-3-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v1,1/4] dmaengine: Refactor dmaengine_check_align() to be bit operations only | expand |
Hi Andy, 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. > 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
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
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)) 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; }
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(-)