RE: [PATCH 6/6] net: Free skbs from irqs when possible.
From: David Laight <hidden>
Date: 2014-03-18 15:53:55
From: David Laight <hidden>
Date: 2014-03-18 15:53:55
From: Bjørn Mork ...
quoted
Try following code, and you'll get a compilation error. unsigned int can_this_fly(struct sk_buff *skb) { return IS_ENABLED(CONFIG_NOWAY_SIR) ? skb->unknown_field : 0; }Doh. Of course. Thanks for spoon feeding me that.
Of course, config_enabled(foo) could be implemented as config_enabled_(foo, 1, 0) Allowing you to define and test: IS_ENABLED_Q(CONFIG_NOWAY_SIR, skb->unknown_field, 0) Although you'd probably need to paste the expansions of both 'foo' 'foo_MODULE' onto __ARG_PLACEHOLDER_ to avoid the ||. More useful might be IF_ENABLED(foo, x) which expands to either x or nothing at all. The you could conditionally generate the chunks of format statement as well as the parameter list. OTOH you might want readable code! David