Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH] fm10k: don't use BIT() macro where the value isn't a bitmask
@ 2016-04-14 20:17 Jacob Keller
  2016-04-14 20:25 ` Keller, Jacob E
  2016-06-14 16:44 ` Singh, Krishneil K
  0 siblings, 2 replies; 3+ messages in thread
From: Jacob Keller @ 2016-04-14 20:17 UTC (permalink / raw)
  To: intel-wired-lan

The FM10K_MAX_DATA_PER_TXD is really just using a bitshift as a power of
2 operation in an efficient manner. We shouldn't represent this as a BIT()
because that obscures the intention of the operation.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index fcf106e545c5..e98b86bf0ca1 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -406,7 +406,7 @@ static inline u16 fm10k_desc_unused(struct fm10k_ring *ring)
 	 (&(((union fm10k_rx_desc *)((R)->desc))[i]))
 
 #define FM10K_MAX_TXD_PWR	14
-#define FM10K_MAX_DATA_PER_TXD	BIT(FM10K_MAX_TXD_PWR)
+#define FM10K_MAX_DATA_PER_TXD	(1u << FM10K_MAX_TXD_PWR)
 
 /* Tx Descriptors needed, worst case */
 #define TXD_USE_COUNT(S)	DIV_ROUND_UP((S), FM10K_MAX_DATA_PER_TXD)
-- 
2.8.1.102.ga49ec4a


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

* [Intel-wired-lan] [PATCH] fm10k: don't use BIT() macro where the value isn't a bitmask
  2016-04-14 20:17 [Intel-wired-lan] [PATCH] fm10k: don't use BIT() macro where the value isn't a bitmask Jacob Keller
@ 2016-04-14 20:25 ` Keller, Jacob E
  2016-06-14 16:44 ` Singh, Krishneil K
  1 sibling, 0 replies; 3+ messages in thread
From: Keller, Jacob E @ 2016-04-14 20:25 UTC (permalink / raw)
  To: intel-wired-lan

On Thu, 2016-04-14 at 13:17 -0700, Jacob Keller wrote:
> The FM10K_MAX_DATA_PER_TXD is really just using a bitshift as a power
> of
> 2 operation in an efficient manner. We shouldn't represent this as a
> BIT()
> because that obscures the intention of the operation.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> ?drivers/net/ethernet/intel/fm10k/fm10k.h | 2 +-
> ?1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h
> b/drivers/net/ethernet/intel/fm10k/fm10k.h
> index fcf106e545c5..e98b86bf0ca1 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k.h
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
> @@ -406,7 +406,7 @@ static inline u16 fm10k_desc_unused(struct
> fm10k_ring *ring)
> ?	?(&(((union fm10k_rx_desc *)((R)->desc))[i]))
> ?
> ?#define FM10K_MAX_TXD_PWR	14
> -#define FM10K_MAX_DATA_PER_TXD	BIT(FM10K_MAX_TXD_PWR)
> +#define FM10K_MAX_DATA_PER_TXD	(1u << FM10K_MAX_TXD_PWR)
> ?
> ?/* Tx Descriptors needed, worst case */
> ?#define TXD_USE_COUNT(S)	DIV_ROUND_UP((S),
> FM10K_MAX_DATA_PER_TXD)

Note: this *will* cause a checkpatch warning, but as per discussion
with Alex, I think this is a false positive. I don't know if there is a
good way to fix it? Perhaps we could introduce some sort of "power of
2" macro that would leave in a single place, but I really don't know if
that makes a lot of sense. I also am not sure how to make checkpatch.pl
avoid the complaints for specific cases such as this.

Thanks,
Jake

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

* [Intel-wired-lan] [PATCH] fm10k: don't use BIT() macro where the value isn't a bitmask
  2016-04-14 20:17 [Intel-wired-lan] [PATCH] fm10k: don't use BIT() macro where the value isn't a bitmask Jacob Keller
  2016-04-14 20:25 ` Keller, Jacob E
@ 2016-06-14 16:44 ` Singh, Krishneil K
  1 sibling, 0 replies; 3+ messages in thread
From: Singh, Krishneil K @ 2016-06-14 16:44 UTC (permalink / raw)
  To: intel-wired-lan



-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Thursday, April 14, 2016 1:17 PM
To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Subject: [Intel-wired-lan] [PATCH] fm10k: don't use BIT() macro where the value isn't a bitmask

The FM10K_MAX_DATA_PER_TXD is really just using a bitshift as a power of
2 operation in an efficient manner. We shouldn't represent this as a BIT() because that obscures the intention of the operation.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---

Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>



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

end of thread, other threads:[~2016-06-14 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-14 20:17 [Intel-wired-lan] [PATCH] fm10k: don't use BIT() macro where the value isn't a bitmask Jacob Keller
2016-04-14 20:25 ` Keller, Jacob E
2016-06-14 16:44 ` Singh, Krishneil K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox