* Re: [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])
@ 2015-06-30 8:01 Maninder Singh
0 siblings, 0 replies; 3+ messages in thread
From: Maninder Singh @ 2015-06-30 8:01 UTC (permalink / raw)
To: Joe Perches
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 MISHRA
Hi Joe,
>> 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.
If we replcase only ARRAY_SIZE then cood will look alike
to drivers/net/ethernet/intel/e1000e/phy.c
And if we have to remove these #defines , then we can also remove it from
drivers/net/ethernet/intel/e1000e/phy.c
Because same operations and same usage is there in both files.
what say?
>> 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)
>>
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])
@ 2015-06-30 4:55 Maninder Singh
2015-06-30 5:12 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Maninder Singh @ 2015-06-30 4:55 UTC (permalink / raw)
To: jeffrey.t.kirsher, jesse.brandeburg, shannon.nelson,
carolyn.wyborny, donald.c.skidmore, matthew.vick, john.ronciak,
mitch.a.williams, intel-wired-lan, netdev, linux-kernel
Cc: pankaj.m, Maninder Singh
Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Yogesh Narayan Gaur <yn.gaur@samsung.com>
---
drivers/net/ethernet/intel/igb/e1000_phy.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
index c1bb64d..e399b3c 100644
--- 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
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])
2015-06-30 4:55 Maninder Singh
@ 2015-06-30 5:12 ` Joe Perches
0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2015-06-30 5:12 UTC (permalink / raw)
To: Maninder Singh
Cc: jeffrey.t.kirsher, jesse.brandeburg, shannon.nelson,
carolyn.wyborny, donald.c.skidmore, matthew.vick, john.ronciak,
mitch.a.williams, intel-wired-lan, netdev, linux-kernel, pankaj.m
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-30 8:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-30 8:01 [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0]) Maninder Singh
-- strict thread matches above, loose matches on Subject: below --
2015-06-30 4:55 Maninder Singh
2015-06-30 5:12 ` Joe Perches
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).