All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath9k: make use of slot time macros
@ 2011-02-11  7:01 Mohammed Shafi Shajakhan
  2011-02-11 12:52 ` Felix Fietkau
  0 siblings, 1 reply; 15+ messages in thread
From: Mohammed Shafi Shajakhan @ 2011-02-11  7:01 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, lrodriguez, Mohammed Shafi Shajakhan

From: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

Instead of using raw numbers to assign slot time it would be better to
make use of predefined slot time macros

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
---
 drivers/net/wireless/ath/ath9k/hw.c   |    2 +-
 drivers/net/wireless/ath/ath9k/main.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f9cf815..7834f75 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -411,7 +411,7 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
 		AR_STA_ID1_CRPT_MIC_ENABLE |
 		AR_STA_ID1_MCAST_KSRCH;
 	ah->enable_32kHz_clock = DONT_USE_32KHZ;
-	ah->slottime = 20;
+	ah->slottime = ATH9K_SLOT_TIME_20;
 	ah->globaltxtimeout = (u32) -1;
 	ah->power_mode = ATH9K_PM_UNDEFINED;
 }
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index d95a576..96755c4 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1926,9 +1926,9 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
 
 	if (changed & BSS_CHANGED_ERP_SLOT) {
 		if (bss_conf->use_short_slot)
-			slottime = 9;
+			slottime = ATH9K_SLOT_TIME_9;
 		else
-			slottime = 20;
+			slottime = ATH9K_SLOT_TIME_20;
 		if (vif->type == NL80211_IFTYPE_AP) {
 			/*
 			 * Defer update, so that connected stations can adjust
-- 
1.7.0.4


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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-11  7:01 [PATCH] ath9k: make use of slot time macros Mohammed Shafi Shajakhan
@ 2011-02-11 12:52 ` Felix Fietkau
  2011-02-11 16:15   ` John W. Linville
  2011-02-14  4:31   ` Mohammed Shafi
  0 siblings, 2 replies; 15+ messages in thread
From: Felix Fietkau @ 2011-02-11 12:52 UTC (permalink / raw)
  To: Mohammed Shafi Shajakhan; +Cc: linville, linux-wireless, lrodriguez

On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
> From: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
> 
> Instead of using raw numbers to assign slot time it would be better to
> make use of predefined slot time macros
How does this make it better?

- Felix

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-11 12:52 ` Felix Fietkau
@ 2011-02-11 16:15   ` John W. Linville
  2011-02-11 16:21     ` Felix Fietkau
  2011-02-14  4:35     ` Mohammed Shafi
  2011-02-14  4:31   ` Mohammed Shafi
  1 sibling, 2 replies; 15+ messages in thread
From: John W. Linville @ 2011-02-11 16:15 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Mohammed Shafi Shajakhan, linux-wireless, lrodriguez

On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
> > From: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
> > 
> > Instead of using raw numbers to assign slot time it would be better to
> > make use of predefined slot time macros
> How does this make it better?

Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?

-- 
John W. Linville                Someday the world will need a hero, and you
linville@tuxdriver.com                  might be all we have.  Be ready.

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-11 16:15   ` John W. Linville
@ 2011-02-11 16:21     ` Felix Fietkau
  2011-02-11 16:29       ` John W. Linville
  2011-02-14  4:35     ` Mohammed Shafi
  1 sibling, 1 reply; 15+ messages in thread
From: Felix Fietkau @ 2011-02-11 16:21 UTC (permalink / raw)
  To: John W. Linville; +Cc: Mohammed Shafi Shajakhan, linux-wireless, lrodriguez

On 2011-02-11 5:15 PM, John W. Linville wrote:
> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>> > From: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
>> > 
>> > Instead of using raw numbers to assign slot time it would be better to
>> > make use of predefined slot time macros
>> How does this make it better?
> 
> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
Well, neither the unit of this variable, nor the values that can be used
are ath9k specific.

- Felix

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-11 16:21     ` Felix Fietkau
@ 2011-02-11 16:29       ` John W. Linville
  2011-02-14  4:41         ` Mohammed Shafi
  0 siblings, 1 reply; 15+ messages in thread
From: John W. Linville @ 2011-02-11 16:29 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Mohammed Shafi Shajakhan, linux-wireless, lrodriguez

On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
> On 2011-02-11 5:15 PM, John W. Linville wrote:
> > On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
> >> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
> >> > From: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
> >> > 
> >> > Instead of using raw numbers to assign slot time it would be better to
> >> > make use of predefined slot time macros
> >> How does this make it better?
> > 
> > Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
> Well, neither the unit of this variable, nor the values that can be used
> are ath9k specific.

True -- the patch is probably an unnecessarily zealous attempt to avoid
"magic numbers" in the code. :-)

John
-- 
John W. Linville                Someday the world will need a hero, and you
linville@tuxdriver.com                  might be all we have.  Be ready.

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-11 12:52 ` Felix Fietkau
  2011-02-11 16:15   ` John W. Linville
@ 2011-02-14  4:31   ` Mohammed Shafi
  1 sibling, 0 replies; 15+ messages in thread
From: Mohammed Shafi @ 2011-02-14  4:31 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: Mohammed Shajakhan, linville, linux-wireless, Luis Rodriguez

On Friday 11 February 2011 06:22 PM, Felix Fietkau wrote:
> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>    
>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>
>> Instead of using raw numbers to assign slot time it would be better to
>> make use of predefined slot time macros
>>      
> How does this make it better?
>    
There is a macro already available, so why not make use of it and 
improve the readability of the code. Please correct me if I am wrong.
> - Felix
> .
>
>    

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-11 16:15   ` John W. Linville
  2011-02-11 16:21     ` Felix Fietkau
@ 2011-02-14  4:35     ` Mohammed Shafi
  1 sibling, 0 replies; 15+ messages in thread
From: Mohammed Shafi @ 2011-02-14  4:35 UTC (permalink / raw)
  To: John W. Linville
  Cc: Felix Fietkau, Mohammed Shajakhan, linux-wireless, Luis Rodriguez

On Friday 11 February 2011 09:45 PM, John W. Linville wrote:
> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>    
>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>>      
>>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>>
>>> Instead of using raw numbers to assign slot time it would be better to
>>> make use of predefined slot time macros
>>>        
>> How does this make it better?
>>      
> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
>    
John I never thought of that, but we have three macros in the driver :

mac.h             72 #define ATH9K_SLOT_TIME_6 6
mac.h             73 #define ATH9K_SLOT_TIME_9 9
mac.h             74 #define ATH9K_SLOT_TIME_20 20

both slot times 6,9 can be classified as short

thanks,
shafi



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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-11 16:29       ` John W. Linville
@ 2011-02-14  4:41         ` Mohammed Shafi
  2011-02-14  4:46           ` Mohammed Shafi
  2011-02-14 20:14           ` John W. Linville
  0 siblings, 2 replies; 15+ messages in thread
From: Mohammed Shafi @ 2011-02-14  4:41 UTC (permalink / raw)
  To: John W. Linville
  Cc: Felix Fietkau, Mohammed Shajakhan, linux-wireless, Luis Rodriguez

On Friday 11 February 2011 09:59 PM, John W. Linville wrote:
> On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
>    
>> On 2011-02-11 5:15 PM, John W. Linville wrote:
>>      
>>> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>>>        
>>>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>>>>          
>>>>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>>>>
>>>>> Instead of using raw numbers to assign slot time it would be better to
>>>>> make use of predefined slot time macros
>>>>>            
>>>> How does this make it better?
>>>>          
>>> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
>>>        
>> Well, neither the unit of this variable, nor the values that can be used
>> are ath9k specific.
>>      
> True -- the patch is probably an unnecessarily zealous attempt to avoid
> "magic numbers" in the code. :-)
>    
John there are two instances where these macros are used:

htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
  init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;


> John
>    

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-14  4:41         ` Mohammed Shafi
@ 2011-02-14  4:46           ` Mohammed Shafi
  2011-02-14 13:48             ` Felix Fietkau
  2011-02-14 20:14           ` John W. Linville
  1 sibling, 1 reply; 15+ messages in thread
From: Mohammed Shafi @ 2011-02-14  4:46 UTC (permalink / raw)
  To: nbd; +Cc: Mohammed Shajakhan, linux-wireless, Luis Rodriguez

On Monday 14 February 2011 10:11 AM, Mohammed Shafi wrote:
> On Friday 11 February 2011 09:59 PM, John W. Linville wrote:
>> On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
>>> On 2011-02-11 5:15 PM, John W. Linville wrote:
>>>> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>>>>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>>>>>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>>>>>
>>>>>> Instead of using raw numbers to assign slot time it would be 
>>>>>> better to
>>>>>> make use of predefined slot time macros
>>>>> How does this make it better?
>>>> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
>>> Well, neither the unit of this variable, nor the values that can be 
>>> used
>>> are ath9k specific.
Felix  then I don't know why these macros are used here and I followed 
the same thing:

htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
>> True -- the patch is probably an unnecessarily zealous attempt to avoid
>> "magic numbers" in the code. :-)
> John there are two instances where these macros are used:
>
> htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
>  init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
>
>
>> John

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-14  4:46           ` Mohammed Shafi
@ 2011-02-14 13:48             ` Felix Fietkau
  2011-02-14 14:02               ` Mohammed Shafi
  0 siblings, 1 reply; 15+ messages in thread
From: Felix Fietkau @ 2011-02-14 13:48 UTC (permalink / raw)
  To: Mohammed Shafi; +Cc: linux-wireless, Luis Rodriguez

On 2011-02-14 5:46 AM, Mohammed Shafi wrote:
> On Monday 14 February 2011 10:11 AM, Mohammed Shafi wrote:
>> On Friday 11 February 2011 09:59 PM, John W. Linville wrote:
>>> On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
>>>> On 2011-02-11 5:15 PM, John W. Linville wrote:
>>>>> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>>>>>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>>>>>>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>>>>>>
>>>>>>> Instead of using raw numbers to assign slot time it would be 
>>>>>>> better to
>>>>>>> make use of predefined slot time macros
>>>>>> How does this make it better?
>>>>> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
>>>> Well, neither the unit of this variable, nor the values that can be 
>>>> used
>>>> are ath9k specific.
> Felix  then I don't know why these macros are used here and I followed 
> the same thing:
> 
> htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
> init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
Just because the macros are there doesn't mean that it was a good idea
to use them. As far as I know, these were simply inherited from the
Atheros codebase that ath9k was based on.
I actually consider the code more readable without the redundant
"ATH9K_SLOT_TIME_" part.

- Felix

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-14 13:48             ` Felix Fietkau
@ 2011-02-14 14:02               ` Mohammed Shafi
  2011-02-14 14:29                 ` Felix Fietkau
  0 siblings, 1 reply; 15+ messages in thread
From: Mohammed Shafi @ 2011-02-14 14:02 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Mohammed Shajakhan, linux-wireless, Luis Rodriguez

On Monday 14 February 2011 07:18 PM, Felix Fietkau wrote:
> On 2011-02-14 5:46 AM, Mohammed Shafi wrote:
>    
>> On Monday 14 February 2011 10:11 AM, Mohammed Shafi wrote:
>>      
>>> On Friday 11 February 2011 09:59 PM, John W. Linville wrote:
>>>        
>>>> On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
>>>>          
>>>>> On 2011-02-11 5:15 PM, John W. Linville wrote:
>>>>>            
>>>>>> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>>>>>>              
>>>>>>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>>>>>>>                
>>>>>>>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>>>>>>>
>>>>>>>> Instead of using raw numbers to assign slot time it would be
>>>>>>>> better to
>>>>>>>> make use of predefined slot time macros
>>>>>>>>                  
>>>>>>> How does this make it better?
>>>>>>>                
>>>>>> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
>>>>>>              
>>>>> Well, neither the unit of this variable, nor the values that can be
>>>>> used
>>>>> are ath9k specific.
>>>>>            
>> Felix  then I don't know why these macros are used here and I followed
>> the same thing:
>>
>> htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
>> init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
>>      
> Just because the macros are there doesn't mean that it was a good idea
> to use them. As far as I know, these were simply inherited from the
> Atheros codebase that ath9k was based on.
> I actually consider the code more readable without the redundant
> "ATH9K_SLOT_TIME_" part.
>    
Felix I agree the first part, but I could still see no harm in using 
these macros.
Initially we  using these values 6,9,20(no other values) for the slot 
time and there are macros defined for them. If we are using some other 
values I would agree that its wrong.
Why not make use of it ?
IMHO if we use these macros it will at least people who are reading the 
code there are three standard values 6,9 and 20
I am sure it would help us to debug issues easily(just like Fair beacon 
distribution thing).

> - Felix
> .
>
>    

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-14 14:02               ` Mohammed Shafi
@ 2011-02-14 14:29                 ` Felix Fietkau
  2011-02-14 14:36                   ` Mohammed Shafi
  0 siblings, 1 reply; 15+ messages in thread
From: Felix Fietkau @ 2011-02-14 14:29 UTC (permalink / raw)
  To: Mohammed Shafi; +Cc: linux-wireless, Luis Rodriguez

On 2011-02-14 3:02 PM, Mohammed Shafi wrote:
> On Monday 14 February 2011 07:18 PM, Felix Fietkau wrote:
>> On 2011-02-14 5:46 AM, Mohammed Shafi wrote:
>>    
>>> On Monday 14 February 2011 10:11 AM, Mohammed Shafi wrote:
>>>      
>>>> On Friday 11 February 2011 09:59 PM, John W. Linville wrote:
>>>>        
>>>>> On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
>>>>>          
>>>>>> On 2011-02-11 5:15 PM, John W. Linville wrote:
>>>>>>            
>>>>>>> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>>>>>>>              
>>>>>>>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>>>>>>>>                
>>>>>>>>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>>>>>>>>
>>>>>>>>> Instead of using raw numbers to assign slot time it would be
>>>>>>>>> better to
>>>>>>>>> make use of predefined slot time macros
>>>>>>>>>                  
>>>>>>>> How does this make it better?
>>>>>>>>                
>>>>>>> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
>>>>>>>              
>>>>>> Well, neither the unit of this variable, nor the values that can be
>>>>>> used
>>>>>> are ath9k specific.
>>>>>>            
>>> Felix  then I don't know why these macros are used here and I followed
>>> the same thing:
>>>
>>> htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
>>> init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
>>>      
>> Just because the macros are there doesn't mean that it was a good idea
>> to use them. As far as I know, these were simply inherited from the
>> Atheros codebase that ath9k was based on.
>> I actually consider the code more readable without the redundant
>> "ATH9K_SLOT_TIME_" part.
>>    
> Felix I agree the first part, but I could still see no harm in using 
> these macros.
> Initially we  using these values 6,9,20(no other values) for the slot 
> time and there are macros defined for them. If we are using some other 
> values I would agree that its wrong.
> Why not make use of it ?
> IMHO if we use these macros it will at least people who are reading the 
> code there are three standard values 6,9 and 20
How is 6 a standard value? And why use driver specific defines when it's
really an 802.11 standard thing?

Using something like this would make the code more readable:
#define IEEE80211_SHORT_SLOT_TIME	9
#define IEEE80211_LONG_SLOT_TIME	20

ATH9K_SLOT_TIME_9 or ATH9K_SLOT_TIME_20? Not so much...

> I am sure it would help us to debug issues easily(just like Fair beacon 
> distribution thing).
I really don't see how this is helpful in any way.
The main reason why I object to stuff like this is because I think that
"other code is like that" is not a good reason for repeating it,
especially if what was done on the other code never made much sense to
begin with. In this case I think it's more of a reason to clean up the
other code first and then make things more consistent :)

- Felix

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-14 14:29                 ` Felix Fietkau
@ 2011-02-14 14:36                   ` Mohammed Shafi
  0 siblings, 0 replies; 15+ messages in thread
From: Mohammed Shafi @ 2011-02-14 14:36 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Mohammed Shajakhan, linux-wireless, Luis Rodriguez

On Monday 14 February 2011 07:59 PM, Felix Fietkau wrote:
> On 2011-02-14 3:02 PM, Mohammed Shafi wrote:
>    
>> On Monday 14 February 2011 07:18 PM, Felix Fietkau wrote:
>>      
>>> On 2011-02-14 5:46 AM, Mohammed Shafi wrote:
>>>
>>>        
>>>> On Monday 14 February 2011 10:11 AM, Mohammed Shafi wrote:
>>>>
>>>>          
>>>>> On Friday 11 February 2011 09:59 PM, John W. Linville wrote:
>>>>>
>>>>>            
>>>>>> On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
>>>>>>
>>>>>>              
>>>>>>> On 2011-02-11 5:15 PM, John W. Linville wrote:
>>>>>>>
>>>>>>>                
>>>>>>>> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>>>>>>>>
>>>>>>>>                  
>>>>>>>>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>>>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>>>>>>>>>
>>>>>>>>>> Instead of using raw numbers to assign slot time it would be
>>>>>>>>>> better to
>>>>>>>>>> make use of predefined slot time macros
>>>>>>>>>>
>>>>>>>>>>                      
>>>>>>>>> How does this make it better?
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
>>>>>>>>
>>>>>>>>                  
>>>>>>> Well, neither the unit of this variable, nor the values that can be
>>>>>>> used
>>>>>>> are ath9k specific.
>>>>>>>
>>>>>>>                
>>>> Felix  then I don't know why these macros are used here and I followed
>>>> the same thing:
>>>>
>>>> htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
>>>> init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
>>>>
>>>>          
>>> Just because the macros are there doesn't mean that it was a good idea
>>> to use them. As far as I know, these were simply inherited from the
>>> Atheros codebase that ath9k was based on.
>>> I actually consider the code more readable without the redundant
>>> "ATH9K_SLOT_TIME_" part.
>>>
>>>        
>> Felix I agree the first part, but I could still see no harm in using
>> these macros.
>> Initially we  using these values 6,9,20(no other values) for the slot
>> time and there are macros defined for them. If we are using some other
>> values I would agree that its wrong.
>> Why not make use of it ?
>> IMHO if we use these macros it will at least people who are reading the
>> code there are three standard values 6,9 and 20
>>      
> How is 6 a standard value? And why use driver specific defines when it's
> really an 802.11 standard thing?
>
> Using something like this would make the code more readable:
> #define IEEE80211_SHORT_SLOT_TIME	9
> #define IEEE80211_LONG_SLOT_TIME	20
>
> ATH9K_SLOT_TIME_9 or ATH9K_SLOT_TIME_20? Not so much...
>
>    
>> I am sure it would help us to debug issues easily(just like Fair beacon
>> distribution thing).
>>      
> I really don't see how this is helpful in any way.
> The main reason why I object to stuff like this is because I think that
> "other code is like that" is not a good reason for repeating it,
> especially if what was done on the other code never made much sense to
> begin with. In this case I think it's more of a reason to clean up the
> other code first and then make things more consistent :)
>    
Felix, I did not send the patch by looking at the other code :), its 
just only a part of justification.
Any way I have no problems if I this patch does not gets merged as it is 
not going to fix any thing.
I am still not yet convinced why its wrong, but I do respect your views 
and really thanks a lot for your reviews
> - Felix
> .
>
>    

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-14  4:41         ` Mohammed Shafi
  2011-02-14  4:46           ` Mohammed Shafi
@ 2011-02-14 20:14           ` John W. Linville
  2011-02-15  6:07             ` Mohammed Shafi
  1 sibling, 1 reply; 15+ messages in thread
From: John W. Linville @ 2011-02-14 20:14 UTC (permalink / raw)
  To: Mohammed Shafi
  Cc: Felix Fietkau, Mohammed Shajakhan, linux-wireless, Luis Rodriguez

On Mon, Feb 14, 2011 at 10:11:01AM +0530, Mohammed Shafi wrote:
> On Friday 11 February 2011 09:59 PM, John W. Linville wrote:
> >On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
> >>On 2011-02-11 5:15 PM, John W. Linville wrote:
> >>>On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
> >>>>On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
> >>>>>From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
> >>>>>
> >>>>>Instead of using raw numbers to assign slot time it would be better to
> >>>>>make use of predefined slot time macros
> >>>>How does this make it better?
> >>>Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
> >>Well, neither the unit of this variable, nor the values that can be used
> >>are ath9k specific.
> >True -- the patch is probably an unnecessarily zealous attempt to avoid
> >"magic numbers" in the code. :-)
> John there are two instances where these macros are used:
> 
> htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
>  init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;

Maybe you should just get rid of those instead?

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

* Re: [PATCH] ath9k: make use of slot time macros
  2011-02-14 20:14           ` John W. Linville
@ 2011-02-15  6:07             ` Mohammed Shafi
  0 siblings, 0 replies; 15+ messages in thread
From: Mohammed Shafi @ 2011-02-15  6:07 UTC (permalink / raw)
  To: John W. Linville
  Cc: Mohammed Shajakhan, Felix Fietkau, linux-wireless, Luis Rodriguez

On Tuesday 15 February 2011 01:44 AM, John W. Linville wrote:
> On Mon, Feb 14, 2011 at 10:11:01AM +0530, Mohammed Shafi wrote:
>    
>> On Friday 11 February 2011 09:59 PM, John W. Linville wrote:
>>      
>>> On Fri, Feb 11, 2011 at 05:21:06PM +0100, Felix Fietkau wrote:
>>>        
>>>> On 2011-02-11 5:15 PM, John W. Linville wrote:
>>>>          
>>>>> On Fri, Feb 11, 2011 at 01:52:23PM +0100, Felix Fietkau wrote:
>>>>>            
>>>>>> On 2011-02-11 8:01 AM, Mohammed Shafi Shajakhan wrote:
>>>>>>              
>>>>>>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>>>>>>
>>>>>>> Instead of using raw numbers to assign slot time it would be better to
>>>>>>> make use of predefined slot time macros
>>>>>>>                
>>>>>> How does this make it better?
>>>>>>              
>>>>> Maybe if it was ATH9K_SHORT_SLOT_TIME it would make more sense?
>>>>>            
>>>> Well, neither the unit of this variable, nor the values that can be used
>>>> are ath9k specific.
>>>>          
>>> True -- the patch is probably an unnecessarily zealous attempt to avoid
>>> "magic numbers" in the code. :-)
>>>        
>> John there are two instances where these macros are used:
>>
>> htc_drv_beacon.c 242 if (ah->slottime == ATH9K_SLOT_TIME_20)
>>   init.c           517 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
>>      
> Maybe you should just get rid of those instead?
>    
Ok John, thanks.

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

end of thread, other threads:[~2011-02-15  6:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-11  7:01 [PATCH] ath9k: make use of slot time macros Mohammed Shafi Shajakhan
2011-02-11 12:52 ` Felix Fietkau
2011-02-11 16:15   ` John W. Linville
2011-02-11 16:21     ` Felix Fietkau
2011-02-11 16:29       ` John W. Linville
2011-02-14  4:41         ` Mohammed Shafi
2011-02-14  4:46           ` Mohammed Shafi
2011-02-14 13:48             ` Felix Fietkau
2011-02-14 14:02               ` Mohammed Shafi
2011-02-14 14:29                 ` Felix Fietkau
2011-02-14 14:36                   ` Mohammed Shafi
2011-02-14 20:14           ` John W. Linville
2011-02-15  6:07             ` Mohammed Shafi
2011-02-14  4:35     ` Mohammed Shafi
2011-02-14  4:31   ` Mohammed Shafi

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.