Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp503590rwb; Wed, 10 Aug 2022 11:49:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR57J117rlfmdYflHHjzT4dLYwBLOnOPzLjYozyDd341eVw5RyYZuCxMnwkaAyULxrX6+yL9 X-Received: by 2002:a17:907:2722:b0:731:23a3:be78 with SMTP id d2-20020a170907272200b0073123a3be78mr15237297ejl.330.1660157365407; Wed, 10 Aug 2022 11:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660157365; cv=none; d=google.com; s=arc-20160816; b=0kV/H+GYGY9au6mGfJnBHsPGmGSqHM8Ohxzqwdxn30Jb4maEqsxAWL3y9YJZhver5c uQ17i95MRpY1Zv0Di4ZS06V+OSZhszOUwtz73yCj62T9p2VxX4BFPrCVu8VQ2zpWcpK+ G5KZ8BkzROt0RaFJLNYy0FXkZe/Xj6Qh6zJVkhr6BjtmyOz+EylgESC8ldGrT6gPxFFr 5WEcgvpnKHcQzWzhD63nu0Feg2DfaETtMb8A1363WjGVr7FPzyAuI+MnYm6HpdQPtdGC rRYpZwEmcEMGegGLx/PRW2/OLg1K4Xi/8aJStUs3aioLQgteaIvcbGPF0yeCEGfhX62/ wxGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=5tDvTJGVbGuM8Z+BUg2FnoswQUZXMPwRYZfrUu3KbKw=; b=pIOSh7+uYlbfXc+RJ03+B4b1uqIc6WXUux/NfSRT5fMibdBSYk7gcJK/mAegCcHlLC c4JTXzzd4gzvu85DVkOQwlJRl+AFWtysuN0gB2JT03mzGWJ7T0VgTj56O2c9mNn0gGdt yo/H/P4dBT5bsI7N9QOLbq4A96u3eMr/Us2rOn+kmu0VPbnImwfSWgJSRyVSxj2kbxdF gpJQtzbmd9D4sKuluhZx3/+6MUijJ8l00o9p8HiNHwxqN4kubBRQWt+HHkMpqxEAhwT9 Slkl0zU5al2X/S/nf2dJPzDJ7vz5Ybveh/3jN1fyjdktqR0ZqNAEQahOFamHjeaCL6qJ PvkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=MHEooSvm; 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=posteo.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020a1709064e5900b007341ad4aff7si67376ejw.505.2022.08.10.11.48.58; Wed, 10 Aug 2022 11:49:25 -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=@posteo.net header.s=2017 header.b=MHEooSvm; 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=posteo.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232550AbiHJRft (ORCPT + 99 others); Wed, 10 Aug 2022 13:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231368AbiHJRfq (ORCPT ); Wed, 10 Aug 2022 13:35:46 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4DE258B6F for ; Wed, 10 Aug 2022 10:35:45 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id CBBE3240105 for ; Wed, 10 Aug 2022 19:35:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1660152943; bh=XrwCglE9bKXMgEZnO62BEsdmCMy5RjaDtuIUp+Juvxw=; h=Date:From:To:Cc:Subject:From; b=MHEooSvmk1OPETItSd7jtOSLB6RW7JLBi17zVdcTBk9LZoL2r/JaCPHJ/FTZXO2Iu brC/Z1XFGfjDoVAizB9if14/pszEMCd3/O4vGZBoc5x7VU2f5PPm93P8SVyy2EbuOw +kv3tgxYypsXL+cHk9bw1+KZFhB8vyWOnyqSYh1MvziIDYuYMjC+J1AxGAiycKleKG C+YXmqxW7smWs2F/4vwXLYQSRSVUoUHh2gItU4a0aMdMg6pGiZt0OQ/EUhQlSsQ1Hk UNVA5FdpdlZSPaapne5pfNgE9+JQAu43cX7Xsk0kkNRr4mHtuFAbSpPyNhNI0xLz2x 8wj/cCSMMyeKQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4M2xt65cPKz9rxQ; Wed, 10 Aug 2022 19:35:42 +0200 (CEST) Date: Wed, 10 Aug 2022 17:35:41 +0000 From: Wilken Gottwalt To: Guenter Roeck Cc: linux-kernel@vger.kernel.org, Jean Delvare , Jonathan Corbet , linux-hwmon@vger.kernel.org Subject: Re: [PATCH] hwmon: corsair-psu: add reporting of rail mode via debugfs Message-ID: <20220810193541.29f95ec5@posteo.net> In-Reply-To: <20220810133012.GB274220@roeck-us.net> References: <20220810133012.GB274220@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Wed, 10 Aug 2022 06:30:12 -0700 Guenter Roeck wrote: > > +static int ocpmode_show(struct seq_file *seqf, void *unused) > > +{ > > + struct corsairpsu_data *priv = seqf->private; > > + long val; > > + int ret; > > + > > + ret = corsairpsu_get_value(priv, PSU_CMD_OCPMODE, 0, &val); > > + if (ret < 0) > > + seq_puts(seqf, "N/A\n"); > > + else > > + seq_printf(seqf, "%s\n", (val == 0x02) ? "multi rail" : "single rail"); > > If this is not always available, would it be better not to create the file > in the first place ? If that is not feasible, it should at least be > documented that the value is not always available to ensure that no one > complains about it (or at least no one who read the documentation). > > Also, is the value strictly 0x02 for multi-rail configurations, or > is that possibly just a bit or the number of rails ? The mode is actually switchable on fly, similar to the fan. I do not want to provide the switching functionality, because also similar to the fan controls, it can be used to damage the PSU. It is part of the over current protection system (hence the name ocpmode) and people use the RAW interface to switch the fans and the ocpmode. This is also the reason I made it that way, because you could poll the information right in the process of switching, which can result in bogus values. 0x02 is the value for "switching to multi rail was successful", every other value is considered "single rail mode". Or you get a malformed message which results in "N/A" or unknown. So yes, you are right, I could at least add a define for the value and be more clear in the documentation. Would that be okay for you? greetings, Wilken