diff mbox

[net-next,13/13] i40e/i40evf: Convert macro to static inline

Message ID 1418124170-7495-14-git-send-email-jeffrey.t.kirsher@intel.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Kirsher, Jeffrey T Dec. 9, 2014, 11:22 a.m. UTC
Inline functions are preferred over macros when they can be used
interchangeably.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_type.h   | 5 ++++-
 drivers/net/ethernet/intel/i40evf/i40e_type.h | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Sergei Shtylyov Dec. 9, 2014, 7:06 p.m. UTC | #1
Hello.

On 12/09/2014 02:22 PM, Jeff Kirsher wrote:

> Inline functions are preferred over macros when they can be used
> interchangeably.

> Reported-by: Joe Perches <joe@perches.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_type.h   | 5 ++++-
>   drivers/net/ethernet/intel/i40evf/i40e_type.h | 5 ++++-
>   2 files changed, 8 insertions(+), 2 deletions(-)

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
> index 844421f..618cce2 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_type.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
> @@ -481,7 +481,10 @@ struct i40e_hw {
>   	u32 debug_mask;
>   };
>
> -#define i40e_is_vf(_hw)	((_hw)->mac.type == I40E_MAC_VF)
> +static inline bool i40e_is_vf(struct i40e_hw *hw)
> +{
> +	return (hw->mac.type == I40E_MAC_VF);

    Parens not needed.

[...]
> diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
> index d8175cd..6b6fcf6 100644
> --- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
> +++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
> @@ -475,7 +475,10 @@ struct i40e_hw {
>   	u32 debug_mask;
>   };
>
> -#define i40e_is_vf(_hw)	((_hw)->mac.type == I40E_MAC_VF)
> +static inline bool i40e_is_vf(struct i40e_hw *hw)
> +{
> +	return (hw->mac.type == I40E_MAC_VF);

    Likewise.

[...]

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 844421f..618cce2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -481,7 +481,10 @@  struct i40e_hw {
 	u32 debug_mask;
 };
 
-#define i40e_is_vf(_hw)	((_hw)->mac.type == I40E_MAC_VF)
+static inline bool i40e_is_vf(struct i40e_hw *hw)
+{
+	return (hw->mac.type == I40E_MAC_VF);
+}
 
 struct i40e_driver_version {
 	u8 major_version;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index d8175cd..6b6fcf6 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -475,7 +475,10 @@  struct i40e_hw {
 	u32 debug_mask;
 };
 
-#define i40e_is_vf(_hw)	((_hw)->mac.type == I40E_MAC_VF)
+static inline bool i40e_is_vf(struct i40e_hw *hw)
+{
+	return (hw->mac.type == I40E_MAC_VF);
+}
 
 struct i40e_driver_version {
 	u8 major_version;