All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])
Date: Mon, 29 Jun 2015 22:12:36 -0700	[thread overview]
Message-ID: <1435641156.6661.1.camel@perches.com> (raw)
In-Reply-To: <1435640130-1466-1-git-send-email-maninder1.s@samsung.com>

On Tue, 2015-06-30 at 10:25 +0530, Maninder Singh wrote:
> Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])

I think all of these #defines should be removed instead
as they are all used only once.

> diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
[]
> @@ -37,8 +37,7 @@ static s32  igb_set_master_slave_mode(struct e1000_hw *hw);
>  static const u16 e1000_m88_cable_length_table[] = {
>  	0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
>  #define M88E1000_CABLE_LENGTH_TABLE_SIZE \
> -	(sizeof(e1000_m88_cable_length_table) / \
> -	sizeof(e1000_m88_cable_length_table[0]))
> +	ARRAY_SIZE(e1000_m88_cable_length_table)
>  
>  static const u16 e1000_igp_2_cable_length_table[] = {
>  	0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
> @@ -50,8 +49,7 @@ static const u16 e1000_igp_2_cable_length_table[] = {
>  	83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
>  	104, 109, 114, 118, 121, 124};
>  #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \
> -	(sizeof(e1000_igp_2_cable_length_table) / \
> -	 sizeof(e1000_igp_2_cable_length_table[0]))
> +	ARRAY_SIZE(e1000_igp_2_cable_length_table)
>  
>  /**
>   *  igb_check_reset_block - Check if PHY reset is blocked




WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: Maninder Singh <maninder1.s@samsung.com>
Cc: jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com,
	shannon.nelson@intel.com, carolyn.wyborny@intel.com,
	donald.c.skidmore@intel.com, matthew.vick@intel.com,
	john.ronciak@intel.com, mitch.a.williams@intel.com,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, pankaj.m@samsung.com
Subject: Re: [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])
Date: Mon, 29 Jun 2015 22:12:36 -0700	[thread overview]
Message-ID: <1435641156.6661.1.camel@perches.com> (raw)
In-Reply-To: <1435640130-1466-1-git-send-email-maninder1.s@samsung.com>

On Tue, 2015-06-30 at 10:25 +0530, Maninder Singh wrote:
> Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])

I think all of these #defines should be removed instead
as they are all used only once.

> diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
[]
> @@ -37,8 +37,7 @@ static s32  igb_set_master_slave_mode(struct e1000_hw *hw);
>  static const u16 e1000_m88_cable_length_table[] = {
>  	0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
>  #define M88E1000_CABLE_LENGTH_TABLE_SIZE \
> -	(sizeof(e1000_m88_cable_length_table) / \
> -	sizeof(e1000_m88_cable_length_table[0]))
> +	ARRAY_SIZE(e1000_m88_cable_length_table)
>  
>  static const u16 e1000_igp_2_cable_length_table[] = {
>  	0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
> @@ -50,8 +49,7 @@ static const u16 e1000_igp_2_cable_length_table[] = {
>  	83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
>  	104, 109, 114, 118, 121, 124};
>  #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \
> -	(sizeof(e1000_igp_2_cable_length_table) / \
> -	 sizeof(e1000_igp_2_cable_length_table[0]))
> +	ARRAY_SIZE(e1000_igp_2_cable_length_table)
>  
>  /**
>   *  igb_check_reset_block - Check if PHY reset is blocked




  reply	other threads:[~2015-06-30  5:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30  4:55 [Intel-wired-lan] [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0]) Maninder Singh
2015-06-30  4:55 ` Maninder Singh
2015-06-30  5:12 ` Joe Perches [this message]
2015-06-30  5:12   ` Joe Perches
2015-06-30 14:53 ` [Intel-wired-lan] " Fujinaka, Todd
2015-06-30 14:53   ` Fujinaka, Todd
2015-06-30 19:01   ` Richard Weinberger
2015-06-30 19:01     ` Richard Weinberger
2015-06-30 20:16     ` Fujinaka, Todd
2015-06-30 20:16       ` Fujinaka, Todd
2015-06-30 20:16       ` Fujinaka, Todd
2015-06-30 20:24       ` Richard Weinberger
2015-06-30 20:24         ` Richard Weinberger
2015-06-30 20:38       ` Alex Gartrell
2015-06-30 20:38         ` Alex Gartrell
2015-06-30 20:52       ` Joe Perches
2015-06-30 20:52         ` Joe Perches
2015-06-30 22:25       ` Fujinaka, Todd
2015-06-30 22:25         ` Fujinaka, Todd
2015-06-30 22:32         ` Joe Perches
2015-06-30 22:32           ` Joe Perches
  -- strict thread matches above, loose matches on Subject: below --
2015-06-30  8:01 Maninder Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435641156.6661.1.camel@perches.com \
    --to=joe@perches.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.