Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2313148yba; Thu, 25 Apr 2019 14:19:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxq57gNKdVePTk7TR2geJMf0lEuSqDEC79Tz12V+6w5VRN2YCov2WeiCKehmIY+lB0qtDSU X-Received: by 2002:a62:2fc1:: with SMTP id v184mr10495216pfv.258.1556227190661; Thu, 25 Apr 2019 14:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556227190; cv=none; d=google.com; s=arc-20160816; b=qMNGa24s5is+HhaRXTtD0nb90v9t2PN9AA5KCwmdvr7VeUL7AmFu4ot35lcn83AQzd UZjXmkcSjH2JgEmT/q254lDGOaWdUnBapUmlVqqbHfFic2baBrsMwYZ6w7FRZl8DEjeC xWkUMVrJlZwZij5WB5Y1ArCS7+nWm2MehEuOxbNBMxRLc9lw3zlMn/zFZ4/Bpd+kWD2y zCpTIWPMywDW2zHPH7AIMYfJQC4rnUfRGxNEd3qKnmaWzcYdiWkzWmraRozMTEKtfxT0 DQQZyo8gqfvLphNip/GL+Jvlt0jcBshcJRU35hQVogRfh66r1WJ16iUOLxxSwV3AMKSO d5uQ== 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:dkim-signature; bh=7iwea6UpuDboaEVy8ociq8XRsqFyNOF/vHgsyWf4dgA=; b=lMOYVCSpU3XXIsC1hcXbTC6yRoXKUEmrJk44N15FGJaNDpsFl3C94f5eBvvJy7RtvL 7LEagwToGq40kSZIKd4Dze4M978xrs/Dt5YFP/7ZrsGhGcCcblA4GV0U1Dp40qePfjIj +fbnkqmHgDNsaZ/e2pdSRQmUVs5AdOfPOgIGTFSBUPN8py2YVhmu0uoK204ZzHCWVWXR aS3CwotUw0fCmdyFzgsiPghYnYrqFkg8nzu2iqtbmwz3ucHULbRI3e38oFKFdkzS+Hp0 OBUbeERqTVQGmlq7YBn+e5zWgBfsPO0J9eIwwT/LK3TPfyrCOH5KFYAArbF0OPP/m9tw qCbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hf+Bkb9m; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s61si20442607plb.313.2019.04.25.14.19.35; Thu, 25 Apr 2019 14:19:50 -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=@gmail.com header.s=20161025 header.b=hf+Bkb9m; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728936AbfDYSwA (ORCPT + 99 others); Thu, 25 Apr 2019 14:52:00 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41203 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDYSwA (ORCPT ); Thu, 25 Apr 2019 14:52:00 -0400 Received: by mail-wr1-f66.google.com with SMTP id c12so796056wrt.8; Thu, 25 Apr 2019 11:51:59 -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=7iwea6UpuDboaEVy8ociq8XRsqFyNOF/vHgsyWf4dgA=; b=hf+Bkb9m8NLLL5hDqFic7RZEANH+j98J5H9UgtXBds6WNIi+3sv+i5a1DfD5hSePIZ RBeFDoguz1UB8ufC1Vo7jdxoWKmyWKx8+8ocv5lsn5Kbz93rInJM4ICVRzDkdBGnigLz 86DhRkl3Fp0MZydkTnkJwr6pp2v5I2AMIzJbRq4Wilo44ypjb8pAvUJ6j37Fml1UK0mi g+PwdRFNCdgC0bnBxuK+H6LGrx2xdBB2GKvnHZSUPSUO5QKesxIaRDz5lbMMT1a8IOlH zwPY+IVZG1hab7QNqpsOasSR4Ik5TabJPYpVkDZgEo8fw2eNRfzWeS7vcpbfYQEMLu4g SW0Q== 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=7iwea6UpuDboaEVy8ociq8XRsqFyNOF/vHgsyWf4dgA=; b=Y4iV+Ah+vIhoPKzuynX/lox0nUGaIQUrlrQnXKpfFWQfyuc5P+9db0tMCDcpOwMCIw 34utTDUc+t/AO5WcH4xCx348DGc/3D9gflmuS/XV4ZqsA4Syyzin9FIqzBLoGgUf4vfX gBdXrOkf3Vh7t8hZyMQvGfqayTVUdwdWFHEkd8p8Hn2+uNsePJAc/LPBuFgscuToqt8W 2aNhUlnWwCimmdeR4N5rgQaLP2rDn3XoDjJMKBFsZM2tj8S6s30tTczCA9i70dLhyfwG 3DG+cl7ypi0+k/gsQ0GJe0KkVQxMh8DLnhzSozq+GsWyGRROy8awSvShe2aRXfuJRpT4 9sJg== X-Gm-Message-State: APjAAAVyCkOoiNL89h+sT2LvjfvfWtRoWyVD4qAJnI/C/jHSy2xwXGlS DemXhPO3I62nD0khw7hPgz2nOA9zpG0= X-Received: by 2002:a5d:5308:: with SMTP id e8mr27774863wrv.126.1556218318295; Thu, 25 Apr 2019 11:51:58 -0700 (PDT) Received: from [192.168.20.141] ([194.99.104.18]) by smtp.gmail.com with ESMTPSA id c2sm21286136wrr.13.2019.04.25.11.51.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 11:51:57 -0700 (PDT) Subject: Re: [PATCH v3 08/11] platform/x86: asus-wmi: Enhance detection of thermal data To: "Pawnikar, Sumeet R" Cc: Corentin Chary , Darren Hart , Andy Shevchenko , Daniel Drake , "acpi4asus-user@lists.sourceforge.net" , "platform-driver-x86@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <7acd57fe-604a-a96a-4ca2-a25bc88d6405@gmail.com> <7595c4f0-3dbb-2fe5-4daf-4b9a266f67d7@gmail.com> <3C3E65E75D9910479323816378A812E7414CDE12@BGSMSX104.gar.corp.intel.com> From: Yurii Pavlovskyi Message-ID: Date: Thu, 25 Apr 2019 20:51:54 +0200 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: <3C3E65E75D9910479323816378A812E7414CDE12@BGSMSX104.gar.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24.04.19 20:25, Pawnikar, Sumeet R wrote: >> + /* >> + * If the temperature value in deci-Kelvin is near the absolute >> + * zero temperature, something is clearly wrong. >> + */ >> + if (!value || value == 1) >> + return 0; > Do you still need to return 0 in case of wrong/failure case ? > Shouldn't you return error here ? Yes, I think 0 is right there, it's not an error condition in the check itself (such as IO or memory error). The function returns two values: check result in asus->asus_hwmon_thermal_available and error code. This is still a successful negative result. The 0 or 1 (as added in this patch) there merely indicates that the temperature measurement is not available this way. It is safe to assume that no device that does provide temperature will return 0.1 K. The temperature measurement is not critical for driver operation so the driver proceeds without it. One could return ENODEV when the check result is negative, but that would just move the actual check and assignment further to asus_wmi_fan_init. This is how it might look like in DSDT in this case: Method (TMPR, 0, NotSerialized) { Return (One) } .. If ((IIA0 == 0x00110011)) { Return ((TMPR () & 0xFFFF)) } This is indeed the right method ID but it's nothing there. Regards, Yurii