diff mbox series

crypto: Remove redundant #ifdef in crypto_yield()

Message ID alpine.DEB.2.21.1907262217130.1791@nanos.tec.linutronix.de (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: Remove redundant #ifdef in crypto_yield() | expand

Commit Message

Thomas Gleixner July 26, 2019, 8:19 p.m. UTC
While looking at CONFIG_PREEMPT dependencies treewide the #ifdef in
crypto_yield() matched.

CONFIG_PREEMPT and CONFIG_PREEMPT_VOLUNTARY are mutually exclusive so the
extra !CONFIG_PREEMPT conditional is redundant.

cond_resched() has only an effect when CONFIG_PREEMPT_VOLUNTARY is set,
otherwise it's a stub which the compiler optimizes out.

Remove the whole conditional.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-crypto@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
---
 include/crypto/algapi.h |    2 --
 1 file changed, 2 deletions(-)

Comments

Herbert Xu Aug. 2, 2019, 4:55 a.m. UTC | #1
On Fri, Jul 26, 2019 at 10:19:07PM +0200, Thomas Gleixner wrote:
> While looking at CONFIG_PREEMPT dependencies treewide the #ifdef in
> crypto_yield() matched.
> 
> CONFIG_PREEMPT and CONFIG_PREEMPT_VOLUNTARY are mutually exclusive so the
> extra !CONFIG_PREEMPT conditional is redundant.
> 
> cond_resched() has only an effect when CONFIG_PREEMPT_VOLUNTARY is set,
> otherwise it's a stub which the compiler optimizes out.
> 
> Remove the whole conditional.
> 
> No functional change.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-crypto@vger.kernel.org
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> ---
>  include/crypto/algapi.h |    2 --
>  1 file changed, 2 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -409,10 +409,8 @@  static inline int crypto_memneq(const vo
 
 static inline void crypto_yield(u32 flags)
 {
-#if !defined(CONFIG_PREEMPT) || defined(CONFIG_PREEMPT_VOLUNTARY)
 	if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
 		cond_resched();
-#endif
 }
 
 int crypto_register_notifier(struct notifier_block *nb);