From: Stefan Assmann <sassmann@kpanic.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
"backports@vger.kernel.org" <backports@vger.kernel.org>
Subject: Re: cocci: multiple versions of function with different arguments
Date: Wed, 23 Apr 2014 13:13:41 +0200 [thread overview]
Message-ID: <5357A065.3020400@kpanic.de> (raw)
In-Reply-To: <1398249715.4173.3.camel@jlt4.sipsolutions.net>
On 23.04.2014 12:41, Johannes Berg wrote:
> On Wed, 2014-04-23 at 12:27 +0200, Stefan Assmann wrote:
>
>> I'm trying to generate a patch to define a function with different
>> arguments depending on the kernel version. I'm having some difficulties,
>> maybe you can tell me what's wrong with the following approach.
>
> I can't answer that, but given the premise
>
>> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
>> vlan_rx_add_vid_func(a, b, c)
>> +#else
>> + vlan_rx_add_vid_func(a, c)
>> +#endif
>
> and the fact that later kernel versions add an argument, wouldn't it be
> much easier to provide a macro in the appropriate header file:
>
> #define vlan_rx_add_vid_func(a,b,c) vlan_rx_add_vid_func(a,c)
>
> johannes
>
That's one way to handle it but I'm sure there will be other cases where
we might use coccinelle similarly, where a define might be tricky.
Luis asked me to do some cleanup on igb, so I'm exploring ways to make
it easier for other network drivers as well.
If for some reason cocci should have a problem with this the fallback
to a define is a good idea.
Thanks Johannes!
Stefan
next prev parent reply other threads:[~2014-04-23 11:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 10:27 cocci: multiple versions of function with different arguments Stefan Assmann
2014-04-23 10:41 ` Johannes Berg
2014-04-23 11:13 ` Stefan Assmann [this message]
2014-04-23 11:16 ` Johannes Berg
2014-04-23 18:27 ` Luis R. Rodriguez
2014-04-24 11:42 ` Stefan Assmann
2014-04-24 15:49 ` Luis R. Rodriguez
2014-04-23 12:07 ` Julia Lawall
2014-04-23 12:09 ` Johannes Berg
2014-04-23 12:14 ` Julia Lawall
2014-04-23 12:18 ` Johannes Berg
2014-04-23 12:36 ` Stefan Assmann
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=5357A065.3020400@kpanic.de \
--to=sassmann@kpanic.de \
--cc=backports@vger.kernel.org \
--cc=johannes@sipsolutions.net \
--cc=julia.lawall@lip6.fr \
/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