Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2092628rwb; Sun, 4 Sep 2022 08:09:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR6jMmU7GrXwnIV6+k+pHtkl1oTOE+bjFXuc8llrwSBbQiKd1gNq/+V8kOgQZPcbvYqPOOuD X-Received: by 2002:a63:ce06:0:b0:430:328b:7346 with SMTP id y6-20020a63ce06000000b00430328b7346mr18177004pgf.339.1662304162179; Sun, 04 Sep 2022 08:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662304162; cv=none; d=google.com; s=arc-20160816; b=hyO9iTitKhAfRh6zgdmloYShTpFMz1XTy3bf6dUi0GMYHfQPh0i82F7g6gRjJqL2aY cevNpzR/ivojGbNfh5KbZ98JhDbqXLxbm9cG4ckRvfxKByymTVYWFKrWM08Fl2kcoI80 b2uBifLO5Cos7u/ECGOs+5r3fgJaV4tv5ncIqtfwxOYHeKKeOIgfK8DJ7YvUU4/aFl5B oXTmhq82TEe8h+wVbSeHncgYYM7cYoatfzfkv/+atrZ1IQdACpM0fH6bOYze/w6QKK9x jAlhJhY/DieA/KZDnzIRjLFpOiaHyO3hN3TPoHG+XnmPN/Fupq7z5JppHRKpfw16zcZn +REw== 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=+FR6rc2UdHYaR3VuBt2cnLZmtlKQ1d0amNTzdMSlqhw=; b=NLSAcD4hqYhLEeSEDR3bz9uEdiT+VKHeDaqhTf2HThzlMRy8RoRaCQ7KgMEEBY0ty2 pH58Ko3ae7cvvuxsgPA6PQe8wL4zNyHuK/P8UCRG1xhSS0coBsCADq5uq6ghadAe/ihE BSy6XX6S7z7CtMTkman2z4UZoWf7819jjqDVX+/LHKMg3L9PTAV7+cnWrodAeCWWvH8D BEPI0q1C6GOrLc9e54U12EAZrhr/NAdordg2X6efc4tzjQp8cpO7gEiWUiV2gUn46TLh /GmJO08MUqFLcz/G5nboCMP0Ex+O9r6l9N9B59bR9GHLyt+R3CXzbS/mBZzk0SA+g+An nNJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o+940Zsr; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a17090a850300b001f20d1c9f4dsi12323151pjn.67.2022.09.04.08.09.10; Sun, 04 Sep 2022 08:09:22 -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=@kernel.org header.s=k20201202 header.b=o+940Zsr; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234337AbiIDOiA (ORCPT + 99 others); Sun, 4 Sep 2022 10:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbiIDOh6 (ORCPT ); Sun, 4 Sep 2022 10:37:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70A383341B; Sun, 4 Sep 2022 07:37:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72AB6B80D78; Sun, 4 Sep 2022 14:37:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42711C433D6; Sun, 4 Sep 2022 14:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662302274; bh=7zTaLKk/YvXMljqVKzIItnnizZmpS7vkmEXB4DMC+Hs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=o+940ZsrS37x4e4mDMiB7rDt+uuYjA21QQk/PX0LqJFdqKDgIn3TO/cNl2SArmG8a Hq/W/LOcdBG/KiyIWALo53KjGchc+2oaDftg1dF1yszDXq+rZSZI3CUB4qShy12F67 sJHejE9w0aXwziIrf9JDgNuxpi6Ld8Pbu6S0dlANrpMznRwTqI8Ho2g7LPKe0w0rYC feChJE8C/re8eZqhSBCUr2sw1rH540P8Okomb8zjbpAwuFj9uKFr/yjdp/oJHlxjfw wZfUUXlLFL3tom7GAjL3w/alJ/sSkSWeoPL+CmxZsQ35s/EFyFkCPmlUI7IabeTXMo Zh+RvgkiLkAYg== Date: Sun, 4 Sep 2022 15:03:46 +0100 From: Jonathan Cameron To: Crt Mori Cc: Andy Shevchenko , linux-iio , Linux Kernel Mailing List Subject: Re: [PATCH 1/3] iio: temperature: mlx90632 Add runtime powermanagement modes Message-ID: <20220904150346.0c56de9d@jic23-huawei> In-Reply-To: References: <20220902131258.3316367-1-cmo@melexis.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Sat, 3 Sep 2022 14:05:38 +0200 Crt Mori wrote: > On Fri, 2 Sept 2022 at 20:39, Andy Shevchenko wrote: > > > > On Fri, Sep 2, 2022 at 8:59 PM Crt Mori wrote: > > > On Fri, 2 Sept 2022 at 17:28, Andy Shevchenko wrote: > > > > On Fri, Sep 2, 2022 at 4:13 PM wrote: > > > > > + if (current_powerstatus == MLX90632_PWR_STATUS_SLEEP_STEP) > > > > > + return mlx90632_pwr_set_sleep_step(data->regmap); > > > > > > > > > + else > > > > > > > > Redundant. > > > > > > > No, the powermode changes among the type. > > > > Yes. 'else' keyword is always redundant in the > > > > if (...) > > return / break / continue / goto > > else > > > > cases. > > > In this case current power mode of the sensor is halt, so the else is > needed to set it to continuous mode, which means I can't just remove > the else here because this statement restores the power mode before > this function was entered (and changed powermode for the setup). > > > > > > + return mlx90632_pwr_continuous(data->regmap); > > > > ... > > > > > > > +static int __maybe_unused mlx90632_pm_runtime_suspend(struct device *dev) > > > > > > > > No __maybe_unused, use pm_ptr() / pm_sleep_ptr() below. > > > > > > > Care to explain a bit more about this? I just followed what other > > > drivers have... > > > > And other drivers have what I said, but it's a new feature. > > If you run `git log --no-merges --grep 'pm_ptr' -- drivers/iio > > include/linux/` and read the history it will explain the case. > > > Thanks for the hint. The relevant EXPORT_ for this particular case isn't upstream yet We had a proposal on IIO list, but there was a better one as part of cleaning this up for MFD. I haven't checked if there is a suitable immutable branch for that patch yet... Jonathan