Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6793011ybh; Thu, 8 Aug 2019 05:49:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqz40P+Ye4uNfY1twcNO9O2LHwuDgUu1fMC0UhpbL2w+XVzvNGA6MwMHW0KZfu0ESyFKmEkz X-Received: by 2002:aa7:9786:: with SMTP id o6mr14954242pfp.222.1565268598037; Thu, 08 Aug 2019 05:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565268598; cv=none; d=google.com; s=arc-20160816; b=ejtRJ1FPP48nNR6cNW/4aEEIlufD1HCkFbFIiBvmIlD7HsHvuswfnJE0c3E7VnDWhN bIYgBiTNUFtAIH3P962qgVgLsO4OdKTggJT0fNANXRwir6bLpCIOxfGVUJqlH6lpBMrF OzHcbI4mGJdqVvQm6+6ZMeg6U2EXT7tdZ4c1+lzGLi6bdQLqmVCn1b31B03LiN770thD dTr70xAuiYigLvHqE2eBueEylH/p312DpVELCByzXtUJ2iJxBbGfapB/4V17un9yX2/V kJW2JgHQkmpH3Yi+rk/W31XrUgxhyNkYgrfumMgWf1NufFKARBl/m7N+0nUCKYaw/PAL Rv6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=bDQSaMpTr63fevJBddU4W05ubnEtAF6LJvvgoluyc0Q=; b=I/Zgr4QjLRekmWCYU3nDFLkGPTzpjI3l5H/Jn4BFoJb++2E6Zs5ETxco+JG72VDeZY DH3xVFAGZS57Mvu9FV7orsL8RrKgFPwiO+zZjCk56pl3VW87R21Jw7bND4aGr5ofdvfQ WNncdAERSJSG+AwMU2VL3RKeMt1CsMzA5ZYAQM+A5NTKLCtZNyKmz8fBX5K6DrjLuhIu jW04fxKicXWpU8sMKobalUnP4mcIlw2XfD4wHqKID1qGRG7EQ/VF19WrFmgqodizupqq cl2h2Blspap9aXl6CRwNpQ3UWT1K1YhaR1tRnCR55XPW2exwPsS/VDCXe6kPFnhLgATM LaLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2si1884811pjb.25.2019.08.08.05.49.42; Thu, 08 Aug 2019 05:49:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732664AbfHHMs2 (ORCPT + 99 others); Thu, 8 Aug 2019 08:48:28 -0400 Received: from foss.arm.com ([217.140.110.172]:32848 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727522AbfHHMs2 (ORCPT ); Thu, 8 Aug 2019 08:48:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8BE6115A2; Thu, 8 Aug 2019 05:48:27 -0700 (PDT) Received: from [10.1.197.57] (e110467-lin.cambridge.arm.com [10.1.197.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E029C3F694; Thu, 8 Aug 2019 05:48:25 -0700 (PDT) Subject: Re: [PATCH v2 3/9] soc: samsung: Add Exynos Adaptive Supply Voltage driver To: Krzysztof Kozlowski , Sylwester Nawrocki Cc: devicetree@vger.kernel.org, "linux-samsung-soc@vger.kernel.org" , linux-pm@vger.kernel.org, pankaj.dubey@samsung.com, =?UTF-8?Q?Bart=c5=82omiej_=c5=bbo=c5=82nierkiewicz?= , "linux-kernel@vger.kernel.org" , robh+dt@kernel.org, kgene@kernel.org, vireshk@kernel.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski References: <20190718143044.25066-1-s.nawrocki@samsung.com> <20190718143044.25066-4-s.nawrocki@samsung.com> From: Robin Murphy Message-ID: <669c6b25-eb7e-ed3a-72a2-ee155a568363@arm.com> Date: Thu, 8 Aug 2019 13:48:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/08/2019 13:31, Krzysztof Kozlowski wrote: > On Thu, 8 Aug 2019 at 14:07, Sylwester Nawrocki wrote: >>>> +static unsigned int exynos5422_asv_parse_table(struct exynos_asv *asv, >>>> + unsigned int pkg_id) >>>> +{ >>>> + return (pkg_id >> EXYNOS5422_TABLE_OFFSET) & EXYNOS5422_TABLE_MASK; >>>> +} >>>> + >>>> +static bool exynos5422_asv_parse_bin2(struct exynos_asv *asv, >>>> + unsigned int pkg_id) >>>> +{ >>>> + return (pkg_id >> EXYNOS5422_BIN2_OFFSET) & EXYNOS5422_BIN2_MASK; >>> >>> return !!() for converting to boolean. >> >> I'm not convinced it is needed, the return type of the function is bool >> and value of the expression will be implicitly converted to that type. >> Is there any compiler warning related to that? > > Yeah, but bool is int so there will be no implicit conversion... I > guess it is a convention. In theory !! is the proper conversion to > bool but if bool==int then it's essentially conversion to 1. I am not > sure what's the benefit, maybe for some wrong code which would do > comparisons on result like if (exynos5422_asv_parse_bin2() == TRUE)... Not so - since we use "-std=gnu89", we have C99-like _Bool, which our bool is a typedef of. Conversions, either implicit or explicit, are well-defined: "6.3.1.2 Boolean type When any scalar value is converted to _Bool, the result is 0 if the value compares equal to 0; otherwise, the result is 1." This is even called out in Documentation/process/coding-style.rst: "When using bool types the !! construction is not needed, which eliminates a class of bugs." Robin.