LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net-next v2] net: ipa: always inline ipa_aggr_granularity_val()
@ 2021-08-11 13:59 Alex Elder
  2021-08-12 22:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2021-08-11 13:59 UTC (permalink / raw)
  To: davem, kuba
  Cc: leon, bjorn.andersson, evgreen, cpratapa, subashab, lkp, elder,
	netdev, linux-kernel

It isn't required, but all callers of ipa_aggr_granularity_val()
pass a constant value (IPA_AGGR_GRANULARITY) as the usec argument.
Two of those callers are in ipa_validate_build(), with the result
being passed to BUILD_BUG_ON().

Evidently the "sparc64-linux-gcc" compiler (at least) doesn't always
inline ipa_aggr_granularity_val(), so the result of the function is
not constant at compile time, and that leads to build errors.

Define the function with the __always_inline attribute to avoid the
errors.  We can see by inspection that the value passed is never
zero, so we can just remove its WARN_ON() call.

Fixes: 5bc5588466a1f ("net: ipa: use WARN_ON() rather than assertions")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alex Elder <elder@linaro.org>
---
v2: Drop WARN_ON() call, as suggested by Leon Romanovsky

David/Jakub, the bug this fixes is only in net-next/master.

 drivers/net/ipa/ipa_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index f332210ce5354..581b75488c6fe 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -253,12 +253,11 @@ ipa_hardware_config_qsb(struct ipa *ipa, const struct ipa_data *data)
 /* Compute the value to use in the COUNTER_CFG register AGGR_GRANULARITY
  * field to represent the given number of microseconds.  The value is one
  * less than the number of timer ticks in the requested period.  0 is not
- * a valid granularity value.
+ * a valid granularity value (so for example @usec must be at least 16 for
+ * a TIMER_FREQUENCY of 32000).
  */
-static u32 ipa_aggr_granularity_val(u32 usec)
+static __always_inline u32 ipa_aggr_granularity_val(u32 usec)
 {
-	WARN_ON(!usec);
-
 	return DIV_ROUND_CLOSEST(usec * TIMER_FREQUENCY, USEC_PER_SEC) - 1;
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v2] net: ipa: always inline ipa_aggr_granularity_val()
  2021-08-11 13:59 [PATCH net-next v2] net: ipa: always inline ipa_aggr_granularity_val() Alex Elder
@ 2021-08-12 22:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-12 22:00 UTC (permalink / raw)
  To: Alex Elder
  Cc: davem, kuba, leon, bjorn.andersson, evgreen, cpratapa, subashab,
	lkp, elder, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Wed, 11 Aug 2021 08:59:48 -0500 you wrote:
> It isn't required, but all callers of ipa_aggr_granularity_val()
> pass a constant value (IPA_AGGR_GRANULARITY) as the usec argument.
> Two of those callers are in ipa_validate_build(), with the result
> being passed to BUILD_BUG_ON().
> 
> Evidently the "sparc64-linux-gcc" compiler (at least) doesn't always
> inline ipa_aggr_granularity_val(), so the result of the function is
> not constant at compile time, and that leads to build errors.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: ipa: always inline ipa_aggr_granularity_val()
    https://git.kernel.org/netdev/net-next/c/676eec8efd8e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-12 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 13:59 [PATCH net-next v2] net: ipa: always inline ipa_aggr_granularity_val() Alex Elder
2021-08-12 22:00 ` patchwork-bot+netdevbpf

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).