Re: Clarifying confusion of our variable placement rules caused by cleanup.h
From: Dan Carpenter
Date: Sun Jan 18 2026 - 14:33:47 EST
On Sun, Jan 18, 2026 at 02:17:30PM -0500, James Bottomley wrote:
> > > Duplicate header are trivially caught by tooling.
> > >
> > > But such rules aren't useful either -- I've seen that Python IDEs
> > > hide import list by default (and probably manage it) because it is
> > > not "real" code.
> > >
> > > Rules for initializers can be harmful because ordering affects code
> > > generation.
> >
> > I agree. I still prefer the upside-down x-mas tree approach for
> > declaring variables, but obviously if they also get initialized, then
> > that trumps aesthetic reasoning.
>
> How is any of this relevant to a style document? You're quibbling over
> individual maintainer foibles which, while they may be deeply held to
> you (and obviously are relevant to contributors to your subsystems
> because they need to know your foibles), can't be part of our universal
> advice because not all maintainers agree (not even on the direction of
> the Christmas Tree).
>
The direction of the Christmas Tree is always upside down. That's a
standard in networking and a bunch of other subsystems. Otherwise
people don't care. I've seen people who write code in Right Side Up
Christmas Tree style but they don't reject code which is in a different
order.
If you're working across the entire kernel like I do then it's safest
to assume Upside Down Christmas Tree is the rule.
regards,
dan carpenter