[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea1c6c7d-08f2-4fc5-96cb-a6cfdd144f66@linaro.org>
Date: Sun, 7 Jan 2024 12:56:58 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Biju Das <biju.das.jz@...renesas.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Banajit Goswami <bgoswami@...cinc.com>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>, Liam Girdwood
<lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, Philipp Zabel <p.zabel@...gutronix.de>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"linux-arm-msm@...r.kernel.org" <linux-arm-msm@...r.kernel.org>,
"linux-sound@...r.kernel.org" <linux-sound@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
Sean Anderson <sean.anderson@...o.com>
Subject: Re: [PATCH v2 1/4] reset: gpio: Add GPIO-based reset controller
On 07/01/2024 11:46, Biju Das wrote:
>>>> +
>>>> + if (!platdata || !*platdata)
>>>
>>> Maybe, if (!(platdata && *platdata)) which reduces 1 inversion
>> operation.
>>
>> I would not call it easier to understand... To me !A and !*A are quite
>> obvious and easy to read instantly because !A is obvious: check if it is
>> not NULL. Therefore original check is obvious: is NULL or points to NULL?
>> Then exit.
>>
>> Now your check is a bit more complicated. It is not even frequent code
>> pattern which my brain used to see. You want to check if both are not NULL
>> and then negate it, wait, no, opposite, check if they are something and
>> then negate? To me it is really opposite of readable code.
>
> I agree maybe it is not readable, even though it reduces 1 extra operation.
>
Number of operations does not matter. Code readability matters.
Compilers are nowadays smarter than us, so don't write code more
difficult to read just to optimize some instruction like this.
Best regards,
Krzysztof
Powered by blists - more mailing lists