* [PATCH] irda: fix overly long udelay()
@ 2016-11-24 16:26 Arnd Bergmann
2016-11-26 1:56 ` David Miller
2016-11-28 1:00 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-11-24 16:26 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: Arnd Bergmann, netdev, linux-kernel
irda_get_mtt() returns a hardcoded '10000' in some cases,
and with gcc-7, we get a build error because this triggers a
compile-time check in udelay():
drivers/net/irda/w83977af_ir.o: In function `w83977af_hard_xmit':
w83977af_ir.c:(.text.w83977af_hard_xmit+0x14c): undefined reference to `__bad_udelay'
Older compilers did not run into this because they either did not
completely inline the irda_get_mtt() or did not consider the
10000 value a constant expression.
The code has been wrong since the start of git history.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/irda/w83977af_ir.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index 4e3d2e7c697c..e8c3a8c32534 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -518,7 +518,9 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
mtt = irda_get_mtt(skb);
pr_debug("%s(%ld), mtt=%d\n", __func__ , jiffies, mtt);
- if (mtt)
+ if (mtt > 1000)
+ mdelay(mtt/1000);
+ else if (mtt)
udelay(mtt);
/* Enable DMA interrupt */
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] irda: fix overly long udelay()
2016-11-24 16:26 [PATCH] irda: fix overly long udelay() Arnd Bergmann
@ 2016-11-26 1:56 ` David Miller
2016-11-28 1:00 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-11-26 1:56 UTC (permalink / raw)
To: arnd; +Cc: samuel, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 24 Nov 2016 17:26:22 +0100
> irda_get_mtt() returns a hardcoded '10000' in some cases,
> and with gcc-7, we get a build error because this triggers a
> compile-time check in udelay():
>
> drivers/net/irda/w83977af_ir.o: In function `w83977af_hard_xmit':
> w83977af_ir.c:(.text.w83977af_hard_xmit+0x14c): undefined reference to `__bad_udelay'
>
> Older compilers did not run into this because they either did not
> completely inline the irda_get_mtt() or did not consider the
> 10000 value a constant expression.
>
> The code has been wrong since the start of git history.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
...
> @@ -518,7 +518,9 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
>
> mtt = irda_get_mtt(skb);
> pr_debug("%s(%ld), mtt=%d\n", __func__ , jiffies, mtt);
> - if (mtt)
> + if (mtt > 1000)
> + mdelay(mtt/1000);
> + else if (mtt)
> udelay(mtt);
I know this isn't caused by you, but wow what is going on with the
indentation here?!?!?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] irda: fix overly long udelay()
2016-11-24 16:26 [PATCH] irda: fix overly long udelay() Arnd Bergmann
2016-11-26 1:56 ` David Miller
@ 2016-11-28 1:00 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-11-28 1:00 UTC (permalink / raw)
To: arnd; +Cc: samuel, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 24 Nov 2016 17:26:22 +0100
> irda_get_mtt() returns a hardcoded '10000' in some cases,
> and with gcc-7, we get a build error because this triggers a
> compile-time check in udelay():
>
> drivers/net/irda/w83977af_ir.o: In function `w83977af_hard_xmit':
> w83977af_ir.c:(.text.w83977af_hard_xmit+0x14c): undefined reference to `__bad_udelay'
>
> Older compilers did not run into this because they either did not
> completely inline the irda_get_mtt() or did not consider the
> 10000 value a constant expression.
>
> The code has been wrong since the start of git history.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied, thanks Arnd.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-28 1:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 16:26 [PATCH] irda: fix overly long udelay() Arnd Bergmann
2016-11-26 1:56 ` David Miller
2016-11-28 1:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).