[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220916134757.migsntozviogv2jh@skbuf>
Date: Fri, 16 Sep 2022 16:47:57 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Mattias Forsblad <mattias.forsblad@...il.com>,
netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, linux@...linux.org.uk
Subject: Re: [PATCH net-next v13 2/6] net: dsa: Add convenience functions for
frame handling
On Fri, Sep 16, 2022 at 08:06:38AM +0200, Christian Marangi wrote:
> > +static inline void dsa_switch_inband_complete(struct dsa_switch *ds, struct completion *completion)
> > +{
> > + /* Custom completion? */
> > + complete(completion ?: &ds->inband_done);
>
> Missing handling for custom completion!
>
> Should be
>
> complete(completion ? completion : &ds->inband_done);
!!!!
https://en.wikipedia.org/wiki/%3F:#C
https://en.wikipedia.org/wiki/Elvis_operator
| A GNU extension to C allows omitting the second operand, and using
| implicitly the first operand as the second also:
|
| a == x ? : y;
|
| The expression is equivalent to
|
| a == x ? (a == x) : y;
|
| except that if x is an expression, it is evaluated only once. The
| difference is significant if evaluating the expression has side effects.
| This shorthand form is sometimes known as the Elvis operator in other
| languages.
cat ternary.c
#include <stdio.h>
int main(void)
{
printf("%d\n", 3 ?: 4);
return 0;
}
make ternary
./ternary
3
Powered by blists - more mailing lists