Search Linux Wireless

Re: [PATCH] ath9k: Add debug information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joe Perches wrote:
> Perhaps:
> static const char * const offchannel_state[] = {...
> 
> It is typically is an unsafe practice to
> index an char * array with an enum.
> 
> It might be safer to use a lookup function
> (and smaller when ath_dbg is not enabled)
> 
> Something like:
> 
> static const char *offchannel_state_string(enum ath_offchannel_state state)
> {
> #define case_rtn_string(val) case val: return #val
> 	switch (state) {
> 	case_rtn_string(ATH_OFFCHANNEL_IDLE);
> 	case_rtn_string(ATH_OFFCHANNEL_PROBE_SEND);
> 	case_rtn_string(ATH_OFFCHANNEL_PROBE_WAIT);
> 	case_rtn_string(ATH_OFFCHANNEL_SUSPEND);
> 	case_rtn_string(ATH_OFFCHANNEL_ROC_START);
> 	case_rtn_string(ATH_OFFCHANNEL_ROC_WAIT);
> 	case_rtn_string(ATH_OFFCHANNEL_ROC_DONE);
> 	default:
> 		return "unknown";
> 	}
> }

This looks better, I'll send a v2. Thanks for the review.

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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux