[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdYDM4EnyumV0_Sq+_QWq=mBRMEFayb5E+ZycYnrfuxcKA@mail.gmail.com>
Date: Wed, 11 Jan 2017 16:07:24 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: David Daney <ddaney@...iumnetworks.com>
Cc: David Daney <ddaney.cavm@...il.com>,
Alexandre Courbot <gnurou@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
David Daney <david.daney@...ium.com>,
Marc Zyngier <marc.zyngier@....com>
Subject: Re: [PATCH v2 2/3] gpio: Add gpio driver support for ThunderX and OCTEON-TX
On Mon, Jan 9, 2017 at 9:02 PM, David Daney <ddaney@...iumnetworks.com> wrote:
>> if (test_bit(line, gpio->invert_mask))
>> return !(read_bits & BIT(bank_bit));
>> else
>> return !!(read_bits & BIT(bank_bit));
>>
>> OK maybe not much clearer but seems clearer to me.
>
> As I really dislike the "!!" idiom, would you settle for:
>
> if (test_bit(line, gpio->invert_mask))
> return (read_bits & BIT(bank_bit)) == 0;
> else
> return (read_bits & BIT(bank_bit)) != 0;
Not the biggest issue in the world. But I maintain a huge stack
of GPIO drivers and it drives me crazy that each one has to bear
the mark of the authors habits rather than mine.
>> I think this is overkill. Use hierarchical irqdomain.
>
> I will look into it. I suspect it will require more lines of driver code to
> implement it than what I have here (that does actually work).
I understand. But at the same time, the kernel needs to have the
right idea of what it is dealing with here.
The generic IRQ handling code will take a shorter fastpath if
you are using hierarchical irqdomain (I think?) but I can't claim
to be an expert. When in doubt, consult Marc Z.
Yours,
Linus Walleij
Powered by blists - more mailing lists