From: Joe Perches <joe@perches.com>
To: "Peter Hüwe" <PeterHuewe@gmx.de>
Cc: Ian Abbott <abbotti@mev.co.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dan Carpenter <dan.carpenter@oracle.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>
Subject: Re: [Q]staging/comedi: Considation of *_find_boardinfo possible?
Date: Tue, 29 Jan 2013 15:58:37 -0800 [thread overview]
Message-ID: <1359503917.16868.24.camel@joe-AO722> (raw)
In-Reply-To: <201301300041.36064.PeterHuewe@gmx.de>
On Wed, 2013-01-30 at 00:41 +0100, Peter Hüwe wrote:
> ---> is there a way to consolidate these functions into one function (which
> can operate on the different types) ? It's almost a bit like 'templates'.
> Maybe with some gcc extensions or kernel magic functions ?
Nothing wrong with a macro.
Maybe something like:
#define comedi_find_board(array, board_id) \
({ \
int i; \
typeof array *p = array; \
typeof array *rtn = NULL; \
for (i = 0; i < ARRAY_SIZE(array); i++, p++) { \
if (p->device_id == board_id) { \
rtn = p; \
break; \
} \
} \
rtn; \
})
prev parent reply other threads:[~2013-01-29 23:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 23:41 Peter Hüwe
2013-01-29 23:56 ` H Hartley Sweeten
2013-01-30 11:04 ` Ian Abbott
2013-01-30 11:06 ` Ian Abbott
2013-01-30 17:54 ` H Hartley Sweeten
2013-01-31 16:43 ` Ian Abbott
2013-01-29 23:58 ` Joe Perches [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=1359503917.16868.24.camel@joe-AO722 \
--to=joe@perches.com \
--cc=PeterHuewe@gmx.de \
--cc=abbotti@mev.co.uk \
--cc=dan.carpenter@oracle.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®