Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2899865pxj; Mon, 17 May 2021 12:32:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzg+FfU0TykZj6OToC0q1GErwGzKrpf3usNOq5Kxp7ki2UtGb+ubwuHg5Hm0GyPkyHyngP2 X-Received: by 2002:a17:907:9612:: with SMTP id gb18mr1601187ejc.408.1621279954728; Mon, 17 May 2021 12:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621279954; cv=none; d=google.com; s=arc-20160816; b=VthpHV9PdW/7HWawuoYqkI/GuDEndAw6+bNP0hrZbmh3PdW45lko/j3Xu2tWAxo5Ms 0Kyu1Dy2LG4jN8CQjW7ctx0O3Rg3dRh57635ltJfJ0erfswiYWYo8N6UmWm4WJP9kQ+A Sia204WNSuLTFnEuzISxlRJvK9l898/KvS3U67xM4t5IQM1JyGasBfcCPnQHW8fQFnCo gWSsXVy6+V806B/3LVaTTwya9iZ3Nz6b0HNi1vZp932w+2VfBFMD+SRaq4u7EixOV3/O oj34hnPsgK+fNDYwItFQxNkWYa+wP9iW21Y81/OFBJOFdbBleePXJh6dQE2phvdPW4s8 Dv/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=9e7zfBcBd7A/Xvu3PkPKu0pjzUxa1GWfBXHzfl9E570=; b=S2vIAQkiztQFI6A9wGuMEwEkO2tibRc5tl5+NRFsIElFnsliQyNmv89wfT/J+FkK31 qpmODjbr94e9/4Yjzsiw6mG8kJyD2Z+5s5u0dQGUqI65dRNY6bapTTQSznDadf71P/lv oCJvgUQIpRqoIb1X9SVO1wRK87bit2nNt21AX+doObWU+dEY4aWbOPbKe0rvnISHZHXr 8DRUknjJ5y8dNK2V6WVBsfVA0d/OBCY/+NdQbNuSYt+jiBljRQcF4q9fPtz0Qi8Ufv8g EVk0CG6UyRaiRE+3M4cjoW9hoISRIdWI00VUOgKHkO4Hl+1K0JNIbbl4Ywr+mLa7vLKU jHCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PrZdyOJq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x22si15054739ejf.188.2021.05.17.12.32.10; Mon, 17 May 2021 12:32:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PrZdyOJq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237515AbhEQNs6 (ORCPT + 99 others); Mon, 17 May 2021 09:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237511AbhEQNs5 (ORCPT ); Mon, 17 May 2021 09:48:57 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D012EC061573; Mon, 17 May 2021 06:47:39 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id f12so7349792ljp.2; Mon, 17 May 2021 06:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=9e7zfBcBd7A/Xvu3PkPKu0pjzUxa1GWfBXHzfl9E570=; b=PrZdyOJqKOUek2FqnlPjbdD1anGIxKZ1HM6fk8hWPAX2d6ZqJ4n3KH8ZZl9+WlP31q jSu6wZ3/tOehlUE2tl+w9gEYhKIEoDsQ8dDoT0EGeWGwh9+cwfDLzNYLbJiFKdQ/Sf// 1Sp1h9z6RhF993Gsl3eKjIrh38JceX0p9CMhoe1CjJMuqsdC0TuIn3FQvME5sr5684yA 0VQikEPAfD0/of8svrmBTdtnr5HX8XCkBn8M1aMLLtCIywQAQoJNHJ/TXeUb5IB3UZkh OyWXj6REjPn898hmT/ncGBAnI+JxIiXq/ABeL6odiccbtVM/c57+FORXFePyNpSJw0Vw NsLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9e7zfBcBd7A/Xvu3PkPKu0pjzUxa1GWfBXHzfl9E570=; b=SSyI9q+KIDQlRo2IGs8J62mXx9Foqo9SjufX9tTJo1q42LRefSXLYHFbf9JXoCKPqV fEePDOZnJlzY6q2KwqBRot/GT0qxCYuT3YrPcN7YfB42YVEtqbBNJPaklPXHTkxohepv tIBtgRhFipV5JNM9OXBXj4pqOqxUrSYpTjJJa0PUrCia97kMfsm82C6DzMyPklUSqGDa /ULfYrk4bZtvoiX1xa5UaXqUHZ25wht8mL/+baoT/Jyyo197JbwLEm0fB6XWSj8mAUSo eLsx4ixD+JXzPSuCI4vcxELDjfp4IJGMPds8kn/oXZoAwRlvc9tXRXNNrZFFC7v/AWqY Z69w== X-Gm-Message-State: AOAM531CofyhBm5yq5Yc4dZX/2+P0zeI75YwO1a6N2rwwpO8EO0tEd+z uF8QbVykx3Jzgvs8mg+JdVtKLxxxXJM= X-Received: by 2002:a2e:b5d6:: with SMTP id g22mr49686115ljn.423.1621259258139; Mon, 17 May 2021 06:47:38 -0700 (PDT) Received: from [192.168.2.145] (109-252-193-91.dynamic.spd-mgts.ru. [109.252.193.91]) by smtp.googlemail.com with ESMTPSA id l2sm1962641lfc.121.2021.05.17.06.47.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 May 2021 06:47:37 -0700 (PDT) Subject: Re: [PATCH v2 3/4] memory: tegra124-emc: Fix compilation warnings on 64bit platforms To: Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter , Stephen Boyd , Nathan Chancellor , Mikko Perttunen Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-clk@vger.kernel.org References: <20210516161214.4693-1-digetx@gmail.com> <20210516161214.4693-4-digetx@gmail.com> <936cfc7d-737e-a582-ea60-ad2ba5b4ca72@canonical.com> <1d80ee0f-de4c-24d0-154f-20841874bf20@gmail.com> <4ea1bf29-c353-6fcf-5248-bfee67d5c361@canonical.com> From: Dmitry Osipenko Message-ID: Date: Mon, 17 May 2021 16:47:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <4ea1bf29-c353-6fcf-5248-bfee67d5c361@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 17.05.2021 16:39, Krzysztof Kozlowski пишет: > On 17/05/2021 09:35, Dmitry Osipenko wrote: >> 17.05.2021 14:28, Krzysztof Kozlowski пишет: >>> On 16/05/2021 12:12, Dmitry Osipenko wrote: >>>> Fix compilation warning on 64bit platforms caused by implicit promotion >>>> of 32bit signed integer to a 64bit unsigned value which happens after >>>> enabling compile-testing of the driver. >>>> >>>> Suggested-by: Nathan Chancellor >>>> Signed-off-by: Dmitry Osipenko >>>> --- >>>> drivers/memory/tegra/tegra124-emc.c | 4 ++-- >>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c >>>> index 5699d909abc2..c9eb948cf4df 100644 >>>> --- a/drivers/memory/tegra/tegra124-emc.c >>>> +++ b/drivers/memory/tegra/tegra124-emc.c >>>> @@ -272,8 +272,8 @@ >>>> #define EMC_PUTERM_ADJ 0x574 >>>> >>>> #define DRAM_DEV_SEL_ALL 0 >>>> -#define DRAM_DEV_SEL_0 (2 << 30) >>>> -#define DRAM_DEV_SEL_1 (1 << 30) >>>> +#define DRAM_DEV_SEL_0 (2u << 30) >>>> +#define DRAM_DEV_SEL_1 (1u << 30) >>> >>> Why not using BIT()? This would make even this 2<<30 less awkard... >> >> The bitfield 31:30 is a enum, 3 is a wrong value. Formally it's >> incorrect to use the BIT() macro here. > > Why "3"? BIT(31) is the same as 2<<30. By 3 I meant BIT(31)|BIT(30). This bitfield is explicitly designated as a enum in the hardware documentation. > It's common to use BIT for > register fields which do not accept all possible values. Now you > basically reimplement BIT() which is error-prone. Could you please show couple examples? The common practice today is to use FIELD_PREP helpers, but this driver was written before these helpers existed.