[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1521743410.7999.48.camel@perches.com>
Date: Thu, 22 Mar 2018 11:30:10 -0700
From: Joe Perches <joe@...ches.com>
To: Paolo Pisati <p.pisati@...il.com>
Cc: Alan Tull <atull@...nel.org>, Moritz Fischer <mdf@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
linux-fpga@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support
On Thu, 2018-03-22 at 18:26 +0100, Paolo Pisati wrote:
> > It's frequently nicer to use a static function
> > for these enum -> string conversions like:
> >
> > static const char *get_err_string(unsigned long err)
> > {
> > switch (err) {
> > case ENOERR: return "No Error";
> > case EID: return "ID ERR";
> > case ECMD: return "CMD ERR";
> > [...]
> > }
> > return "default switch case";
> > }
>
> Ok - checkpatch complained when i put the "case ...: return ...;" on the same
> line as you did here, that is why i ended up with the ugly "case...: $string;
> break" all on different lines
checkpatch is brainless and stupid and if it
recommends stupid consistency over readability,
ignore it.
> > > + pr_debug("machxo2 status: 0x%08lX - done=%d, cfgena=%d, busy=%d, fail=%d, devver=%d, err=%s\n",
> > > + *status, test_bit(DONE, status), test_bit(ENAB, status),
> > > + test_bit(BUSY, status), test_bit(FAIL, status),
> > > + test_bit(DVER, status), ferr);
> >
> > So instead of ferr, this could use
> > get_err_string(*status)
> >
> > And please try to keep a consistent alignment for
> > indentation of multiple line statements
>
> I tried, but then checkpatch complained again about the indentation of the above block
> and i literally had to guess...
I think it only complained about the
2nd line that starts *status because it
doesn't align with the open parenthesis
of pr_debug
Powered by blists - more mailing lists