Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp153371rwr; Wed, 19 Apr 2023 04:56:31 -0700 (PDT) X-Google-Smtp-Source: AKy350aHaKQrmMraAWPArcZGXBlvCOSGZbXI2SoKfTBX0Z6XcXTzVtQEp/4dDVcbvCh9Du+b3u0L X-Received: by 2002:a05:6a20:4282:b0:ee:bac2:c6e1 with SMTP id o2-20020a056a20428200b000eebac2c6e1mr4079332pzj.23.1681905390839; Wed, 19 Apr 2023 04:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681905390; cv=none; d=google.com; s=arc-20160816; b=TBnKSIhwLNcVekjpElXnmju4SK/AH136LNDW7GoxVXoqq0XN8tqlYA+ajhKuP9W0bW i3dkSJogciw73HKcDreRTud6IRkC6zKLdev67cuISsgjAFckZCVvq4Fwz6jOVIC7YEJM WjGxesLXoZ8QiMgYMYOgFSgLgbMvPMaZ4NevI1plabEZTTyT8bMFJ9ohZ0vr7fYri3WR /DvtI7H7Sj0Gx3lscUXTW3yknuIAWXdqCxwv3srVQq6gInNhqQbIQj+G3izDMXG/hm1P wPDO4v3a4SbA27WIOa3lLndzCtKJx1Jytj6OuCN8aNexRQJp5cld5kpOAGK9hmb7hmuQ DC3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mhKWTuwxyD3PZP11VZ86u7asaTWIzbh80YtOdJhoF6w=; b=XD4xaAI/Kd6lkQuTCKqDqRwCAjoR0XLo11Cq+YMuIap0lh0tjOpMSfYbE0ySh0K43j GCFvgpDtX2bCrPehrmeFu1SXnOxiR7czD5WmfktAX27MFq5P4DyATJ3Ta+LMcBw+dmNv H1GGnv+QkTUG8uKQVTLJacAbOWBSsNLjXIFqkQLpaaWoKLRwV8sHgPnhIMLSX36tgL/G MzmqFziFW4ZOREgD1u7UsUKV+TMqC8Qg8MCtw2iaNY5/mthgfD3H1w+ztOgUELYf6vEC WVGCA+9k7iskcG4DzkSuUBLjjHXdeZ5uXA7oiO+CPVcwgZ10+omlvo0fYh8MCsq6bs7/ 0Avw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GgvKPk+m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y26-20020a63495a000000b0051b70782bbasi13182870pgk.375.2023.04.19.04.56.17; Wed, 19 Apr 2023 04:56:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GgvKPk+m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232970AbjDSLrJ (ORCPT + 99 others); Wed, 19 Apr 2023 07:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231560AbjDSLrH (ORCPT ); Wed, 19 Apr 2023 07:47:07 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DA264C22; Wed, 19 Apr 2023 04:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681904824; x=1713440824; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=iZ9zP/czoiwzuGqd+7mx8aaZzCqymmjJky/8w2YBO04=; b=GgvKPk+mwm7KiUFEw7XrE0YujxMqz2by6rrkwi2/ApqTB/p18T46wKRJ W/WNg6ntzZAhQJzxBVzIuwvLUsOxVlJGb+6+7AbelE2kGUCQ3tNbKxGum HOLFAGxB1sQFVCJZ42a1peO/SvIjL4Mp0ENv8ZEL3UISiUrs0f1WprJD/ fSBDkFrnntw5waSZytW3iPJEYkEYRj7ODfmpvi6qHXToUAx24nhiIJqDj FDoKqtdfj90NqM8Q0cZpN2o5mGQnQa2+oZ+Fa1d1MNQp23N3Afl/cU4Xt cLMw97VDIE9bdf/Yo1De6FiL89pzIODT2kHDoeTVpueiONq3F6sqY728j Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10684"; a="325759615" X-IronPort-AV: E=Sophos;i="5.99,208,1677571200"; d="scan'208";a="325759615" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 04:47:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10684"; a="721902168" X-IronPort-AV: E=Sophos;i="5.99,208,1677571200"; d="scan'208";a="721902168" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008.jf.intel.com with ESMTP; 19 Apr 2023 04:47:00 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pp6H5-002DIC-0p; Wed, 19 Apr 2023 14:46:59 +0300 Date: Wed, 19 Apr 2023 14:46:58 +0300 From: Andy Shevchenko To: Dinh Nguyen Cc: Guenter Roeck , linux-hwmon@vger.kernel.org, dinguyen@kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, jdelvare@suse.com Subject: Re: [PATCH 3/5] hwmon: (socfpga) Add hardware monitoring support on SoCFPGA platforms Message-ID: References: <20230410153314.27127-1-dinh.nguyen@linux.intel.com> <20230410153314.27127-3-dinh.nguyen@linux.intel.com> <09730359-8731-e21e-3335-bf60ba7f1280@roeck-us.net> <8d158880-1e6a-5fdd-dae7-a7647794eb60@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 18, 2023 at 12:29:40PM -0500, Dinh Nguyen wrote: > On 4/17/2023 4:51 PM, Guenter Roeck wrote: > > On 4/17/23 13:55, Dinh Nguyen wrote: ... > > ... and this contradict each other. If bit 31 indicates an error, > > this can not be a signed 32-bit value. > > > You're right! I've re-read the spec and should have the the code look for > the specific error values: > > 0x80000000 - inactive > 0x80000001 - old value > 0x80000002 - invalid channel > 0x80000003 -? corrupted. No, they are not hex. Probably you need to define an error space with it, but at least just use signed _decimal_ values. Instead of BIT(31) this should go as #define ..._ERR_BASE INT_MIN // or equivalent if the type is not int #define ..._ERR_MAX ... // or whatever name is better Then in your code if (value >= _ERR_MAX) return 0; err = _ERR_MAX - value; switch (err) { ... } P.S. I asked during internal review if the values are bit fielded when errors. AFAIU that time they are, now it seems different. -- With Best Regards, Andy Shevchenko