On Thu, Nov 07, 2024 at 01:43:31PM +0100, Johannes Berg wrote: > From: Johannes Berg <johannes.berg@xxxxxxxxx> > > Most of the original conversion is from the spatch below, > but I edited some and left out other instances that were > either buggy after conversion (where default values don't > fit into the type) or just looked strange. > > @@ > expression attr, def; > expression val; > identifier fn =~ "^nla_get_.*"; > fresh identifier dfn = fn ## "_default"; > @@ > ( > -if (attr) > - val = fn(attr); > -else > - val = def; > +val = dfn(attr, def); > | > -if (!attr) > - val = def; > -else > - val = fn(attr); > +val = dfn(attr, def); > | > -if (!attr) > - return def; > -return fn(attr); > +return dfn(attr, def); > | > -attr ? fn(attr) : def > +dfn(attr, def) > | > -!attr ? def : fn(attr) > +dfn(attr, def) > ) > > Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> Reviewed-by: Simon Horman <horms@xxxxxxxxxx>