From: Sujith Manoharan <sujith@msujith.org>
To: Joe Perches <joe@perches.com>
Cc: John Linville <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org, ath9k-devel@qca.qualcomm.com
Subject: Re: [PATCH] ath9k: Add debug information
Date: Fri, 22 Aug 2014 07:55:03 +0530 [thread overview]
Message-ID: <21494.43519.504368.455733@gargle.gargle.HOWL> (raw)
In-Reply-To: <1408635330.23250.47.camel@joe-AO725>
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
prev parent reply other threads:[~2014-08-22 2:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-21 15:06 [PATCH] ath9k: Add debug information Sujith Manoharan
2014-08-21 15:35 ` Joe Perches
2014-08-22 2:25 ` Sujith Manoharan [this message]
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=21494.43519.504368.455733@gargle.gargle.HOWL \
--to=sujith@msujith.org \
--cc=ath9k-devel@qca.qualcomm.com \
--cc=joe@perches.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox