Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6823550ybh; Thu, 8 Aug 2019 06:16:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgKnQqlU2T9TqUbB7Wgj8cpHJ++zDhQLVE5G1TAQ6xE+0mgxSMkOrVk6RJmU9rbARlEGcS X-Received: by 2002:a65:614a:: with SMTP id o10mr12453150pgv.407.1565270170610; Thu, 08 Aug 2019 06:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565270170; cv=none; d=google.com; s=arc-20160816; b=iZ67aQWXPQUH03YmnRLkfhWXKYmnx9GW5B2bvmEQ9PddZPQrLOrNsM8/lnWv2HvGqk +ae2GBKdqCScXdUEEKiSWzcEi5+m4dXnvMR632RX8H10ln1aD8NMxbA0qE1RpsTAOPNf jNfsSuCBNb55zQKSPAKa3CW+AwKkg1TLv5x1b0/zckgd96RDSpCqCPIe4IyRNYoSeWJX V5Ck3RgaaomJ5+bB2AHFaG3/1z2gJo2QX6j8BV9uAbANHGAVfoLn9nDAPGMFpvdj5Q5b ernwJ6u9/vZud44LTfVlcH5hrX3t2RHwAOpgDr3nKuLip5jLpwv9xJlOJUHx8PH/3BJ2 V/7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=m+WNdel+Dnau0pBTt84XyxMfPZdcshlcBCU6IlnuG1M=; b=PiNGr7xp85Z7NV0UgTRJRW1B/PsTt5LgsHB794fygeT8YfAQ4+yc/sSFlXJkt+qPbO G2CPG5l/ParzM+sGjNIk3CGqKXDqgwt8didFiX4nrK5tN7izu7cYwpDw9NRsfJoyIxpf me01BqpcxsMfF4Ef57P72/mYzBEJV+W2QLxnH+ypvj6Hpc0KsbNxZzstY4+ora8BoeJI ZLrbg6XYpLwdenU6OdQJDDcmbUnE1w9HMLHZhlQtaHt4hFWYIxx/t5CbaJulwJZcxNz+ thFMEjHIaPylJd+SdtQ2HH2L54+8TegvVb0xCXbn97g68+OB3I+jj7KttFR5HDaD39JJ sH5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r8LLjQSF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cj14si49712979plb.141.2019.08.08.06.15.54; Thu, 08 Aug 2019 06:16:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=r8LLjQSF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732969AbfHHNPK (ORCPT + 99 others); Thu, 8 Aug 2019 09:15:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:57654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732643AbfHHNPJ (ORCPT ); Thu, 8 Aug 2019 09:15:09 -0400 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2495321874; Thu, 8 Aug 2019 13:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565270108; bh=5yPzM5yGGSNATY9kmjyrKwemZkcgY7dISuXee3TjHbA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=r8LLjQSFOD5ZA2mugoq5PfbhvrYb2QgV1WP0LufxAR2YpULVjpPB2DqsCJ99YgWf3 ybC/lYyEiNBMdDlf4f24jeP2nXzUoU26pgn6E0S9/W+NjWNk0YpL1aSWS6bCRgtYxg 3y+rWBmCPDgsAGJrTYBT8OmYFX4iQf7MlbbLmBFE= Received: by mail-lj1-f172.google.com with SMTP id k18so88823676ljc.11; Thu, 08 Aug 2019 06:15:08 -0700 (PDT) X-Gm-Message-State: APjAAAXyJLc6qlfutqhn+ZJYT6IaIrYWqBuqAKQj4Mj0D+7ewi3PZCkU ouoqj8YK1zC6kqLKgO0SPTwE9aGtXNkY6TV/ia8= X-Received: by 2002:a2e:3008:: with SMTP id w8mr8417296ljw.13.1565270106316; Thu, 08 Aug 2019 06:15:06 -0700 (PDT) MIME-Version: 1.0 References: <20190718143044.25066-1-s.nawrocki@samsung.com> <20190718143044.25066-4-s.nawrocki@samsung.com> <669c6b25-eb7e-ed3a-72a2-ee155a568363@arm.com> In-Reply-To: <669c6b25-eb7e-ed3a-72a2-ee155a568363@arm.com> From: Krzysztof Kozlowski Date: Thu, 8 Aug 2019 15:14:54 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/9] soc: samsung: Add Exynos Adaptive Supply Voltage driver To: Robin Murphy Cc: Sylwester Nawrocki , devicetree@vger.kernel.org, "linux-samsung-soc@vger.kernel.org" , linux-pm@vger.kernel.org, pankaj.dubey@samsung.com, =?UTF-8?B?QmFydMWCb21pZWogxbtvxYJuaWVya2lld2ljeg==?= , "linux-kernel@vger.kernel.org" , robh+dt@kernel.org, kgene@kernel.org, vireshk@kernel.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Aug 2019 at 14:48, Robin Murphy wrote: > > 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." Good point, thanks! Best regards, Krzysztof