Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755388AbbBBKKL (ORCPT ); Mon, 2 Feb 2015 05:10:11 -0500 Received: from smtp-out-232.synserver.de ([212.40.185.232]:1110 "EHLO smtp-out-228.synserver.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933087AbbBBKKI (ORCPT ); Mon, 2 Feb 2015 05:10:08 -0500 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 21591 Message-ID: <54CF4CF9.1030708@metafoo.de> Date: Mon, 02 Feb 2015 11:10:01 +0100 From: Lars-Peter Clausen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: Nicholas Mc Guire CC: Nicholas Mc Guire , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] iio: ad_sigma_delta: cleanup wait_for_completion return handling References: <1422866258-10517-1-git-send-email-hofrat@osadl.org> <54CF464F.9000306@metafoo.de> <20150202095002.GA28005@opentech.at> In-Reply-To: <20150202095002.GA28005@opentech.at> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2190 Lines: 52 On 02/02/2015 10:50 AM, Nicholas Mc Guire wrote: > On Mon, 02 Feb 2015, Lars-Peter Clausen wrote: > >> On 02/02/2015 09:37 AM, Nicholas Mc Guire wrote: >>> return type of wait_for_completion_timeout is unsigned long not int, rather >>> than introducing a new variable the wait_for_completion_timeout is moved >>> into the if condition as the return value is only used to detect timeout. >> >> But the return value is bound by the timeout parameter and we know that >> fits into a int. And I really dont like moving the function call into the >> if condition, so unless there is some additional explanation why this is >> necessary and should be done I'm inclined to nack this. >> > > well having correct types is important for all static code chekcers > and I did not want to add a new variable just for this case > simply because the result is only relevant in the == 0 case > anyway. > > I do think that the types being assigned should correct with respect > to the API definition even if it fits in this case. > >>> >>> Signed-off-by: Nicholas Mc Guire >>> --- >>> >>> Aside from the fixup of the wait_for_completion_timeout handling >>> a minor coding style issue in the else branch was fixed - the {} is >>> not needed for the one-line body. >> >> If one of the branches of a conditional statement has braces the other >> branches should also have braces. This is documented in >> Documentation/CodingStyle. > > my bad - it is not uncommon to be asymetric - but you are right that Chapter 3 > states it should not be asymetric in this case - will remove that. > > given the botched braces this needs to be redone - let me know if moving > it into the condition is ok (its not uncommon) or if an additional variable > of type unsigned long is the prefered solution. I prefer the extra variable, but that's personal taste. And maybe add the stuff about the static code checker etc to the commit message. Thanks, - Lars -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/