Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1783739ybc; Sun, 17 Nov 2019 07:16:24 -0800 (PST) X-Google-Smtp-Source: APXvYqykP+ozqhJPmtQRMroE6g99EFwF5lvSzni63YcdjKjOAIQ3Bcchl8WOhaJ8B+mHFeu3wgU4 X-Received: by 2002:a05:600c:296:: with SMTP id 22mr24946502wmk.155.1574003784606; Sun, 17 Nov 2019 07:16:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574003784; cv=none; d=google.com; s=arc-20160816; b=c4CINEBLfn69Issp3GUwfHF3opuE0oywLYd3GIDlKnqleK5gVRT634vd3D79rcm8PK CeQESdudkYwrrc+mc6uGTn8xFBCn2JmYHD5bEBHSAu1pZp2CDfIh0YEXL8TBCHtCvDrE S6y7JQJ7noRDPGsKeWbOen3LI1COx0PuRDNrV8BqVUJFaq1wIt0ZaJ+vnuMUUBh9SKUa oTsLshtL8kCyoNM/FATzbdYIQ8ZkRjup7owp88mRguZUxcsqh/q79dmDnk9H5+DcEHzf j4wKA1BchM8bLXfE6iuLrpQKY8aJTdgw0Km/sfuOymkHoSRdf/qUzs3r2dmZtARqKI5l c/Aw== 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:to:subject:dkim-signature; bh=ohIww/0HlLZvHNlD7QGqumPEU6d625wQgkeBIpVoTF8=; b=e/hDoAm5ws6+6mCQsMEG1fmpsa8JNKF0y5Pnn5BrdkEzprJq/PTpowsTsJxaPiC4DP amcSl+uPZbMTVGRf+SZswYl3F1SR3aiAxRh414wRbj9YBapeBpAsyM3noNA1j/1MHmx+ ZFVwuxs2bM9JxUZp3+gPhsQIOKK38qtAHjbeAjTFqcxlF5qhiva0F97WB2TSmj7LinyZ 4UrL76jg8z48urSCQM/OpNrvWh7cAfno/y1oEtoVKuSOxEHSAxpXFRPsiCMrROtoOiA1 UBOnBUxr4RieVlo65iFkTQ7jwiWXC2GiT8PME0lXcWHUU8Ph1t5r546mCqZWK9tE2ZIr faRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Sh9JCCcg; 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 y40si10133934edd.383.2019.11.17.07.15.47; Sun, 17 Nov 2019 07:16:24 -0800 (PST) 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=fail header.i=@gmail.com header.s=20161025 header.b=Sh9JCCcg; 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 S1726271AbfKQPOU (ORCPT + 99 others); Sun, 17 Nov 2019 10:14:20 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44471 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfKQPOU (ORCPT ); Sun, 17 Nov 2019 10:14:20 -0500 Received: by mail-pl1-f193.google.com with SMTP id az9so8172904plb.11; Sun, 17 Nov 2019 07:14:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ohIww/0HlLZvHNlD7QGqumPEU6d625wQgkeBIpVoTF8=; b=Sh9JCCcgFUBuQzANZRUtv3exuxaNHn42FMioYvi6veXrHYrefVqkGbTVDRZoU4vAoA /7T5QOHkKGuedZlNhyCQtdB3ePddOAdYXaFsYKaiYKSjJVUDLFuCtAYmwpduFgXvGF+K aiwTfmwxOvnRw94LOpaSuKhdVD3MRY08GYoMcoRMUBCNSM3Fc7ULkvFtjNtmsQgkeJ/8 mXdCUrJk6QnNxQZsg3yvtkLpBwdCkrhBM2debyKjAZcg5yfwbeSeNJNhhaHrYNZ/akmS iRvjSj1CZq/Hg6OCgwxP03Lt69fjR7vlUjpUgij3lwAAW2FBKYuJm3ZU8iCQxcTZOnJC JIwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ohIww/0HlLZvHNlD7QGqumPEU6d625wQgkeBIpVoTF8=; b=Bcj8UYS+LGYBhXRcSA3s42by5OBMvq+I9nbFSwa2fbeGLx+NA+gmqUu1TUc0rEKmF4 7E2e3O1iQPr4YFvCq+gV2MS89Dr+SI4Qjmmq4GRAcaJvqueDvXlDQAbKBuMYy12V3UJc DemrMGVArkJxTIGCw84syQuxkTUeN3x6fFBBI3f/uCAGcL8tDvNie4VodRBPE62Q24Nk m+CCt3EVXIkVguKhR4kY0u0GhkbDHBhkYArS2byWFetXjqWZjf3Up0Ig/IK4s82w0AcS GlY1ElZeET38iz52NnnTg6kwfADD1QySV/lCdBN/r2/o2OGgGyAzosnAlnN0c5kVkDcb y3Kw== X-Gm-Message-State: APjAAAU4uyKuwYPogltWxJtl9d871Jms1zGG7Eur8qU4NqwF8Yxig09t B+aWNJ6X3nDc1U6VWcQJZ282J2y/ X-Received: by 2002:a17:90a:1b69:: with SMTP id q96mr33454663pjq.89.1574003658972; Sun, 17 Nov 2019 07:14:18 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id i123sm22468546pfe.145.2019.11.17.07.14.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Nov 2019 07:14:17 -0800 (PST) Subject: Re: [PATCH v3] dell-smm-hwmon: Add support for disabling automatic BIOS fan control To: Giovanni Mascellani , =?UTF-8?Q?Pali_Roh=c3=a1r?= , Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191116173610.208358-1-gio@debian.org> <3a10f96a-06e1-39f4-74a6-908d25b1f496@roeck-us.net> <371da137-6073-00f4-7520-c990da6be40e@debian.org> From: Guenter Roeck Message-ID: <280fd587-fb59-f52e-015b-b9b534c44794@roeck-us.net> Date: Sun, 17 Nov 2019 07:14:16 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <371da137-6073-00f4-7520-c990da6be40e@debian.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/17/19 12:02 AM, Giovanni Mascellani wrote: > Hi, > > Il 16/11/19 23:08, Guenter Roeck ha scritto: >>> +    mutex_lock(&i8k_mutex); >>> +    err = i8k_enable_fan_auto_mode(enable); >>> +    mutex_unlock(&i8k_mutex); >>> + >>> +    return err ? -EIO : count; >> >> Why override the error code ? i8k_enable_fan_auto_mode() >> can return -EINVAL. >> >> I can see that the rest of the driver has the same bad habit, >> but that is not a reason to continue it. > > Ok, I thought it was the appropriate thing to do just because it was > done elsewhere. If it's not a good idea, do you think a patch removing > the other instances of this construct would be appropriate? > In general it is never a good idea to override error codes. "I have seen it elsewhere" is vener a good argument - you'll find examples for everything in the Linux kernel. As for fixing up the other instances in this driver, sure, if you feel like it, but that would have to be a separate patch. >>> +} >>> + >>>   static SENSOR_DEVICE_ATTR_RO(temp1_input, i8k_hwmon_temp, 0); >>>   static SENSOR_DEVICE_ATTR_RO(temp1_label, i8k_hwmon_temp_label, 0); >>>   static SENSOR_DEVICE_ATTR_RO(temp2_input, i8k_hwmon_temp, 1); >>> @@ -749,12 +794,15 @@ static SENSOR_DEVICE_ATTR_RO(temp10_label, >>> i8k_hwmon_temp_label, 9); >>>   static SENSOR_DEVICE_ATTR_RO(fan1_input, i8k_hwmon_fan, 0); >>>   static SENSOR_DEVICE_ATTR_RO(fan1_label, i8k_hwmon_fan_label, 0); >>>   static SENSOR_DEVICE_ATTR_RW(pwm1, i8k_hwmon_pwm, 0); >>> +static SENSOR_DEVICE_ATTR_WO(pwm1_enable, i8k_hwmon_pwm_enable, 0); >>>   static SENSOR_DEVICE_ATTR_RO(fan2_input, i8k_hwmon_fan, 1); >>>   static SENSOR_DEVICE_ATTR_RO(fan2_label, i8k_hwmon_fan_label, 1); >>>   static SENSOR_DEVICE_ATTR_RW(pwm2, i8k_hwmon_pwm, 1); >>> +static SENSOR_DEVICE_ATTR_WO(pwm2_enable, i8k_hwmon_pwm_enable, 0); >>>   static SENSOR_DEVICE_ATTR_RO(fan3_input, i8k_hwmon_fan, 2); >>>   static SENSOR_DEVICE_ATTR_RO(fan3_label, i8k_hwmon_fan_label, 2); >>>   static SENSOR_DEVICE_ATTR_RW(pwm3, i8k_hwmon_pwm, 2); >>> +static SENSOR_DEVICE_ATTR_WO(pwm3_enable, i8k_hwmon_pwm_enable, 0); >> >> Having three attributes do all the same is not very valuable. >> I would suggest to stick with pwm1_enable and document that it applies >> to all pwm channels. > > I had no idea what is the convention here. No problem changing this thing. > >>> @@ -1200,6 +1291,14 @@ static int __init i8k_probe(void) >>>       i8k_fan_max = fan_max ? : I8K_FAN_HIGH;    /* Must not be 0 */ >>>       i8k_pwm_mult = DIV_ROUND_UP(255, i8k_fan_max); >>>   +    fan_control = dmi_first_match(i8k_whitelist_fan_control); >>> +    if (fan_control && fan_control->driver_data) { >>> +        const struct i8k_fan_control_data *fan_control_data = >>> fan_control->driver_data; >>> +        manual_fan = fan_control_data->manual_fan; >>> +        auto_fan = fan_control_data->auto_fan; >>> +        pr_info("enabling experimental BIOS fan control support\n"); >> >> That isn't entirely accurate. What this enables is the ability >> to select automatic or manual fan control. > > Hmm, it sounds right to me: there is a feature which is "BIOS fan > control" and this driver can "support" it or not, i.e., be aware of it > and interact with it or not. And all of this is "experimental". The "experimental" is fine, and I understand that those involved in this exchange are aware what the message means. It does, however, not help others not involved. > wording seems to capture this to me. However, no problem with changing > it. How would "enabling support for setting automatic/manual fan > control" work? Can you suggest a wording? > "enabling experimental support for ... " sounds good to me. Thanks, Guenter > Thanks, Giovanni. >