Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1774941rwi; Wed, 19 Oct 2022 15:25:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69NkObYhcbiXhI9BXDIG23wdUycIW10UTUeEkP14RvyQEZ3h7LKWzILeDmKckYGOv7CGsR X-Received: by 2002:a05:6402:1cc1:b0:453:1517:94e4 with SMTP id ds1-20020a0564021cc100b00453151794e4mr9409407edb.399.1666218329102; Wed, 19 Oct 2022 15:25:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666218329; cv=none; d=google.com; s=arc-20160816; b=TJJ5EM06qmuHcTNqJD1OKxqlX95UOGRDjWkyLFfK4F6EDbTBguwB3bJ0LYHCsVdAqD Tl/gDvduW4O35IGpfj+SQDxcTPkZk62/AV6vMRvSdMOi7oB/vk+XQbXM96Idj2ahuZ+m FtaSWRilH4F9FwNk227HUwHHRavfQPVIfNm8c2Ypx3mfaLzqbY6GCThWyv/bqq47PzsZ 1kdM1kR7LGYnL8Btt0+pWyt8Ml2txN62wRW7wMaNA2fNYlzvAE804nHUm0dIgbl4YRfM ib3UvBdzG567fQClro1Lm7aUgFSNrkdwkT87kNNgaRdyc7q46ZO3UXY4MmkP/S48CVPH 7aPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XtHG5hK716DqSXJDEcEPWfMkqPJ9JT1lrZYAk1aDGAc=; b=iPHOMGNn4Qi3i/e3EsHCIVP8yL47YMZfUFslpK3xWvUYBVQ8V3oL9eytaC19s8Rn2Z TUWzU+SIO30U7z4My8P6gA7NebJDns36hnZ5MmD2xHUediWsZ3z3YagTX22mgDnLpKWA IzNaIxI2ng/LfA+vcRD/41GfC23IJO8R0eDOM0BembnNpzXjwlQsTvOW/OFXXVKfOOB/ xAJkKYzT+bOnKDxW9WJz/wlyDVfba5j/zgxxHssOJ3ioV0TauKYcct1Dn3CXTYQ6DtVI CCptRRkayQCdVHESwKzxiVjei2/u0dX8AiKifRiBPj/DXWTrBWU090DipRJegaTTiqnN iqKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=n7NTRR6F; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rs8-20020a170907036800b0078306c5c48asi12381530ejb.250.2022.10.19.15.25.03; Wed, 19 Oct 2022 15:25:29 -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=@googlemail.com header.s=20210112 header.b=n7NTRR6F; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbiJSWEP (ORCPT + 99 others); Wed, 19 Oct 2022 18:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231289AbiJSWD7 (ORCPT ); Wed, 19 Oct 2022 18:03:59 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D3BF1BE936; Wed, 19 Oct 2022 15:03:58 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id q9so43207790ejd.0; Wed, 19 Oct 2022 15:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XtHG5hK716DqSXJDEcEPWfMkqPJ9JT1lrZYAk1aDGAc=; b=n7NTRR6F1yO3y6tvoS5o+dzNIbd5bWNbAATlKtj5YQ9T0UyZKxSOzQAqlEmBCLjEdM dTjO9a9iOQUeWg343epbYqyKdk7XIfi9RkQn8ywTdJNSPPO9SjK4qzO64JSfVExW5leB SyH5fGjkEY7MnuRX/TlKn2ZfKhkkTIGwdL2rnM2rb7CQ4KHad9Fa2g/kfL4UaCWWvdu8 D9cwOXZT98AgaN/Nqda8yoi4qaxDRDfZRGu5ud08D5eUtTzA3hOZD7TtEYSzTbZTxA0Y 1GttO62rmg3yDrFh9x6htZX+LyoXZWEolOiLTW6FfFbFFCaJFddWx0wuNr30c5CW3ROZ 4AdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XtHG5hK716DqSXJDEcEPWfMkqPJ9JT1lrZYAk1aDGAc=; b=0TF77Pzs2jgooJbHX4VGZ15TixtM0W4tKIQkb3ctXhSgHyjUch3xkRlb6Skal7Mu5I B7koqPyic6HGSp2XFjILu3gejR3egcnBJ11QbMC62GLdvyg+nGhAkeVTg9bIsZOlJUiq DYqzKbw3RDSxEpCGXUIaeaW6ou9dfgqGzal1lA6HmhuJRp9axaiCwOalqsF4EKbh9glW 3GgOkWp24qr8jNk1O73Ck73Wo3cLbB3aAqll1aClBuuta5morepNroHeGGPS/n2QawZZ 0xO7LdxaAa8x6fhuHzLyzy5+mGg9NkljYdSEfxXBSikhpia+TkWU/YCdTdrbhV7iMfSH wUWg== X-Gm-Message-State: ACrzQf2z/seXtqk4NOcdM77q0pnM2V5MXhQmrGtgKFkeKH31b3ORcqVu 2p5BQMTUDZs4arVXvTEM5D3N8RCjz8oXbUbI5S39XipXo6c= X-Received: by 2002:a17:907:7f92:b0:78d:ed9c:d86f with SMTP id qk18-20020a1709077f9200b0078ded9cd86fmr8529786ejc.251.1666217037000; Wed, 19 Oct 2022 15:03:57 -0700 (PDT) MIME-Version: 1.0 References: <20221019214108.220319-1-martin.blumenstingl@googlemail.com> <0d1b4fed-7ded-88fc-3c37-4f859fc505c1@roeck-us.net> In-Reply-To: <0d1b4fed-7ded-88fc-3c37-4f859fc505c1@roeck-us.net> From: Martin Blumenstingl Date: Thu, 20 Oct 2022 00:03:45 +0200 Message-ID: Subject: Re: [PATCH] hwmon: (jc42) Restore the min/max/critical temperatures on resume To: Guenter Roeck Cc: linux-hwmon@vger.kernel.org, jdelvare@suse.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Hi Guenter, Thank you for the quick feedback! On Wed, Oct 19, 2022 at 11:51 PM Guenter Roeck wrote: [...] > > + if (data->valid || data->temp[t_min]) > > This contradicts "with applying the previous values by only configuring > them if they are known valid". It explicitly applies the values if they > are marked as not valid, and it also applies the values if they are 0 > (I don't really see the value of doing that). > > Sorry, I don't understand the logic. Did you mean to use "&&" instead > of "||" ? My understanding is that that: 1) data->valid = true is only set in jc42_update_device() (which is only called when reading back the values from the registers) 2) jc42_write() can write values without setting data->value = true In other words: if jc42_read() is never called but jc42_write() is then we still have some setting to apply while data->valid is false. Whether that's possible in reality is something that I'm not sure about. If your suggestion is to simplify this to use data->valid only then I can do that. It would be great if you could also comment on whether jc42_update_device() should be called from jc42_suspend() to give the driver the chance to at least read the data once (and set data->valid) if this has not happened before. Best regards, Martin