Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp490843rwb; Wed, 10 Aug 2022 11:33:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR7dIDNz1sHt0mgOxSQRO2tnAiipasb0gyqNb7Npafpa0N1p058PCMR4m0Ija5t6GgGO2QWT X-Received: by 2002:a05:6402:540c:b0:434:d965:f8a with SMTP id ev12-20020a056402540c00b00434d9650f8amr27695144edb.30.1660156439097; Wed, 10 Aug 2022 11:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660156439; cv=none; d=google.com; s=arc-20160816; b=HRIqgCIB0fL4p4B8uTCrg88/0+uQfAGubIyUF+bgDp9KReLv9q6ZyPHFPKPvvUU8yt n3ZesHsG8j2CWTVORNlz6g0CWNeLicyAeq0Hqb36x+kb9lVPh5pt5737DK7N5EGax688 FEO/0dVNrrIxnWYve9qEfuQmmoL69JkYTEAxwfKDkyeR9p2EnA7l6gkGhqEhewPmAKKA f04ql4xNDV1zfKgupk7nF+/BnG1hpDWL9EAw0edHnfW7Jj1IZR6YKh1BgbDHy8FyBkp6 uZtAGwsN1nLXnkZq3+IJdH1wxFiLrzi04yCiU4CLpwmQaXZb1/kJPBvnIxui8WkHvvrT r9Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=4Qe7pkOfTkIyBMN77CscNdL9fHPyjbZahG4sCTgRDro=; b=fPPCANgCniI4NNOF9Ip9NvJZhI5i0QpR3+DZrIny7EAQj45WF1RYZZUPEq3Vcwnmmj uTtMFTx1Ekb+vHto9vn3CB9YRHK6i9CaNQsqjWB2SBiXTB/TEEzDGzELrCXlpp7pwH4v VRaS7LKwzP560mUbwPueSeYG1PrIMQ9Nltx8gIXnRIWAhR2g43xLMPQUG/FN9HckAmw3 XY8NudgyC84chMe12mrZtMvfqwF4/fk36pBs/I4DzMwySZA5Z+72txGYMLVELgBDt2W1 g8ag71bpAlesEnKnxgDTYWuXoGuZHzpYaYNlIBRUmctTG+r8U8gOHutsxF3RE+AUQ7Hs uG7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NAXMZLDY; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa14-20020a170907868e00b007269af37e73si5302218ejc.685.2022.08.10.11.33.33; Wed, 10 Aug 2022 11:33:59 -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=@gmail.com header.s=20210112 header.b=NAXMZLDY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbiHJSSt (ORCPT + 99 others); Wed, 10 Aug 2022 14:18:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbiHJSSs (ORCPT ); Wed, 10 Aug 2022 14:18:48 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E86078BCC; Wed, 10 Aug 2022 11:18:47 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id q16so15038646pgq.6; Wed, 10 Aug 2022 11:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc; bh=4Qe7pkOfTkIyBMN77CscNdL9fHPyjbZahG4sCTgRDro=; b=NAXMZLDYFMah87mFGFNrcsSjybO35Sl6jtbdplfqpavTsUj3ercqV92jpwqr04Csir RiPLjxRoP81ns+VmzbymOLhXLs59bQUsuf6yOoB9rftTas9cRILF+cKY40ZmHMkbRrFU BVML7yoSAEzK63V8JUVY65MZtEa8LpKWdeKlSlg0tDwsCifGSl4JVnPSqxVWc7E4M40/ Rzv/XYE9NEFenugR4twTvUEvELN1qwLQ8vxZF7e5O0lxjdNsuyZxyeG46u5sl7W0vpmv cYPo+zwNu8A/8NMYXZof84nPYrU3e1qIw+125i4czCZlwKqevpeH/GDce1BVx1Fwv2Dq B3Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc; bh=4Qe7pkOfTkIyBMN77CscNdL9fHPyjbZahG4sCTgRDro=; b=MsFVXMsawhBBOocsD2S3eoTO0z8yfqP8mPg0TbWQllW4xRHCGmaa9rBNT8LdO4Lsc0 KC03YdFdA8NdrUpBg48MrxbVoXlb0pwZwgGuiAC2RkF9ftqDrFVpMcCMKXetY42v/v7U ZI0vBN8PEZQXG0yVOewv8QdXmOxt1NwZUNP7leBZgNwjww1cWUyPuPMf5dz/abOEVj5B R5zM36c2PO8bw0WWVqrnO/yRzMaGxPfFQAArNQaakUQeJcJplC6qJqiezIThb+fRcx82 ejXVUCgUs39lduv3KyeZWVCEVUZG1OIWENSNm/tXe044/g9ErW+3ZNJiMZmPSDgVSyxh Vq7A== X-Gm-Message-State: ACgBeo2Hn5IABDRAjT1UKHAO2AvAgid3WdXcJNjpzQkn/T5ikhb6u4Fe 3UrGrzvgnd8ZfzFza6rafsI= X-Received: by 2002:a63:8348:0:b0:41d:b224:c541 with SMTP id h69-20020a638348000000b0041db224c541mr9213899pge.143.1660155526528; Wed, 10 Aug 2022 11:18:46 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id n6-20020aa79846000000b0052e6c073a3csm2398088pfq.142.2022.08.10.11.18.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Aug 2022 11:18:45 -0700 (PDT) Sender: Guenter Roeck Message-ID: <275071f0-d00b-daf5-8232-a0a6a46d685b@roeck-us.net> Date: Wed, 10 Aug 2022 11:18:44 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] hwmon: corsair-psu: add reporting of rail mode via debugfs Content-Language: en-US To: Wilken Gottwalt Cc: linux-kernel@vger.kernel.org, Jean Delvare , Jonathan Corbet , linux-hwmon@vger.kernel.org References: <20220810133012.GB274220@roeck-us.net> <20220810193541.29f95ec5@posteo.net> From: Guenter Roeck In-Reply-To: <20220810193541.29f95ec5@posteo.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 8/10/22 10:35, Wilken Gottwalt wrote: > 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? > Define or not is up to you, but it would be nice if at least some of the explanation above would be documented in the driver. Guenter