Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67F8EC678D4 for ; Thu, 2 Mar 2023 13:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbjCBNRM (ORCPT ); Thu, 2 Mar 2023 08:17:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjCBNRK (ORCPT ); Thu, 2 Mar 2023 08:17:10 -0500 Received: from www381.your-server.de (www381.your-server.de [78.46.137.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C8338B46; Thu, 2 Mar 2023 05:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=OSGo8od9/vvLzXzkl3lpRBXCnyJUu3KOtGdrSgduc+I=; b=lXFObTFlAUfcMFAcgGY34eRrdX SK1qEVmYwzNAUCKZu/71M5QpprxdunY2xknX0+PPyymLmylKPHTM66CleDxT1E3pJ3nyrR0xqr/wW JvBZV0+B+vm+DHGOynXAbf1Na1sRw0YdYM5EXmReRY5EWloctuiMnffnQsnYnrOB6OvltLWqNgQSS 2uFfhjxxQENtGpyf8r1+TwhuwIzHR8mZlhX5cnqN6x8+IuK8dwnTcbaV5h+qJjj/bcqhIvcEAYDTu Q4PS6AlG3BsoqqJRui+63lAzCgPadUGrlV9v+vx5gNm2WoilGojhXT6WAHGOXPoqKlNO/u6Q4SUH2 YlfzGK7g==; Received: from sslproxy05.your-server.de ([78.46.172.2]) by www381.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pXins-000MgE-9B; Thu, 02 Mar 2023 14:17:00 +0100 Received: from [2604:5500:c0e5:eb00:da5e:d3ff:feff:933b] by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXinr-000C9C-Ou; Thu, 02 Mar 2023 14:16:59 +0100 Message-ID: <87bc192e-45ae-9480-5e84-8fe0adfc12e7@metafoo.de> Date: Thu, 2 Mar 2023 05:16:54 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v3 2/2] iio: adc: Add TI ADS1100 and ADS1000 Content-Language: en-US To: Mike Looijmans , Andy Shevchenko Cc: devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Caleb Connolly , ChiYuan Huang , ChiaEn Wu , Cosmin Tanislav , Ibrahim Tilki , Jonathan Cameron , Ramona Bolboaca , William Breathitt Gray , linux-kernel@vger.kernel.org References: <20230228063151.17598-1-mike.looijmans@topic.nl> <20230228063151.17598-2-mike.looijmans@topic.nl> <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.0685d97e-4a28-499e-a9e3-3bafec126832@emailsignatures365.codetwo.com> From: Lars-Peter Clausen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.8/26828/Thu Mar 2 07:36:42 2023) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/1/23 23:49, Mike Looijmans wrote: > > >> ... >> ... >> >>> +static int ads1100_runtime_suspend(struct device *dev) >>> +{ >>> +    struct iio_dev *indio_dev = >>> i2c_get_clientdata(to_i2c_client(dev)); >>> +    struct ads1100_data *data = iio_priv(indio_dev); >>> + >>> +    ads1100_set_config_bits(data, ADS1100_CFG_SC, ADS1100_SINGLESHOT); >>> +    regulator_disable(data->reg_vdd); >> Wrong devm / non-devm ordering. > > Don't understand your remark, can you explain further please? > > devm / non-devm ordering would be related to the "probe" function. As > far as I can tell, I'm not allocating resources after the devm calls. > And the "remove" is empty. Strictly speaking we need to unregister the IIO device before disabling the regulator, otherwise there is a small window where the IIO device still exists, but doesn't work anymore. This is a very theoretical scenario though. You are lucky :) There is a new function `devm_regulator_get_enable()`[1], which will manage the regulator_disable() for you. Using that will also reduce the boilerplate in `probe()` a bit - Lars [1] https://lwn.net/Articles/904383/