public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Joe Perches <joe@perches.com>
Cc: Richard Kennedy <richard@rsk.demon.co.uk>,
	Andy Whitcroft <apw@canonical.com>,
	gregkh@suse.de, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wireless.h: Add STD_IW_HANDLER macro
Date: Wed, 17 Mar 2010 09:08:32 -0700	[thread overview]
Message-ID: <1268842112.5989.8.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1268841904.1652.94.camel@Joe-Laptop.home>

On Wed, 2010-03-17 at 09:05 -0700, Joe Perches wrote:

> > I copied it from driver/net/wireless/ipw2x00/ipw2200.c 
> > It just reduces typing when initialising the array :-
> > 	#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
> > 	static iw_handler p80211wext_handlers[] = {
> > 		IW_IOCTL(SIOCSIWCOMMIT) = (iw_handler) p80211wext_siwcommit,
> > 		...
> > Oh, having quickly looked at wireless.h, I see there is already a macro
> > IW_IOCTL_IDX so I guess I should have used that!
> > would something like this be better?
> > 	static iw_handler p80211wext_handlers[] = {
> > 		[IW_IOCTL_IDX(SIOCSIWCOMMIT)] = (iw_handler) p80211wext_siwcommit,
> > 		...
> 
> orinoco uses one more macro indirection which seems reasonable
> 
> Maybe this define should be moved to wireless.h
> 
> #define STD_IW_HANDLER(id, func) \
> 	[IW_IOCTL_IDX(id)] = (iw_handler) func
> 
> the line continued macro probably avoids checkpatch warnings too...
> 
> orinoco use:
> 
> static const iw_handler	orinoco_handler[] = {
> 	STD_IW_HANDLER(SIOCSIWCOMMIT,	orinoco_ioctl_commit),
> 	STD_IW_HANDLER(SIOCGIWNAME,	cfg80211_wext_giwname),
> 
> Here's a suggested patch:
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> diff --git a/include/linux/wireless.h b/include/linux/wireless.h
> index 5b4c6c7..ad9f8d5 100644
> --- a/include/linux/wireless.h
> +++ b/include/linux/wireless.h
> @@ -346,6 +346,8 @@
>  #define SIOCIWFIRST	0x8B00
>  #define SIOCIWLAST	SIOCIWLASTPRIV		/* 0x8BFF */
>  #define IW_IOCTL_IDX(cmd)	((cmd) - SIOCIWFIRST)
> +#define STD_IW_HANDLER(id, func) \
> +	[IW_IOCTL_IDX(id)] = (iw_handler) func

Err, who still cares about wireless extensions (who isn't working on
net/wireless/wext*)?

johannes


  reply	other threads:[~2010-03-17 16:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17 11:00 checkpatch false positive Richard Kennedy
2010-03-17 11:53 ` Andy Whitcroft
2010-03-17 15:25 ` Joe Perches
2010-03-17 15:40   ` Richard Kennedy
2010-03-17 16:05     ` [PATCH] wireless.h: Add STD_IW_HANDLER macro Joe Perches
2010-03-17 16:08       ` Johannes Berg [this message]
2010-03-17 17:46         ` [PATCH 1/2] net/wireless/wext_core.c: Use IW_IOCTL_IDX macro Joe Perches
2010-03-17 17:48           ` [PATCH 2/2] net/wireless/wext_core.c: Use IW_EVENT_IDX macro Joe Perches

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=1268842112.5989.8.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=apw@canonical.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=richard@rsk.demon.co.uk \
    /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