Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2418008rwe; Sun, 28 Aug 2022 10:54:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR4+fksUsLib9yZyLBH7s8iPOGTl9sD8WmPU5MUC1T2hqFF9GgNcZcrf57cSJJDIe0ba8J+f X-Received: by 2002:a63:67c1:0:b0:42c:366f:e8fe with SMTP id b184-20020a6367c1000000b0042c366fe8femr59539pgc.198.1661709260156; Sun, 28 Aug 2022 10:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661709260; cv=none; d=google.com; s=arc-20160816; b=k/AW/XAYKuDPaB45F7/JcTfiuGn/Ht5wL8qKYrnc8Gd8AkRi0+VhTWGPzkYZYsu+vv g/fWtDbNDq3w4747BjCBz+2KXWLnas04yoJGS31Uc9tnkKEmy90KRew87MnmBJ9XbyXx ErD6P8wOCChxtBJlWu4WZCTIwM6+lBw0YNu2mgPGFOOzFmgiHqKfEdvBntitEMl2ZPOL 7By5P+RInsvq/ryIgEIdYxL/EyILGt6gsDtXWJPbwGFRE7Vnyq9IpbOZyjG6VPbPZIfl JaqxF9vkzwVYR8kWRBprdcEUmCcNi+Fhz7oYJCjVW+wS+LhdDJyC8WzH0StDCwd1076E 0mmQ== 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=gJG4QwJR3fhSy9AOeo1/JLXKqWm7d6rqGCCin8VY0sQ=; b=txxUMK9OpEjT0m63Ek9fX6UTextmkgNol8YipiEJZmqOTExnwEmcDU1RHAqZZ8HKMM tNKN1PapQ2/RzP4sTDzIu1bqOrTkbWZ+G+KN3iVsP7/kURgkRxAsvE5HA8ZXVLGzwWhK mZvYzXAc6tDRQpUVI/k278KnDrIRvbaFD5cFgseIhQoXyOlCxoyV3L+Q8i+okpAqZy7I NM6Xl1aL0YGUjmgJUC6uA+DrEA77lNs6HmW1iom+djf25CPNrmmf2pa0pVWXfNbRRkV7 EMJSoSf50fXH4tGgdVvTZKM6yfpbk2cOkv1zf0mGUzKa0wrA77hFE+Notw7HuiIFAfQk BrbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="r4c0E5/J"; 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 p8-20020a17090ab90800b001fb10e717d4si7430896pjr.176.2022.08.28.10.54.08; Sun, 28 Aug 2022 10:54:20 -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="r4c0E5/J"; 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 S229963AbiH1RHz (ORCPT + 99 others); Sun, 28 Aug 2022 13:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiH1RHw (ORCPT ); Sun, 28 Aug 2022 13:07:52 -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 F1E0B3137E; Sun, 28 Aug 2022 10:07:51 -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 AE640B80B08; Sun, 28 Aug 2022 17:07:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E8DC433D6; Sun, 28 Aug 2022 17:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661706469; bh=iRCrcUJU/gdcFVVqwqMJvmG4wkdRzhFVjxK4n791U20=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=r4c0E5/Ji1azkaovZcwAofgFC631PbBPee91aygbYDQ2zhS93ObIStJPRjn67B/BU Q3ZiRREfnNnMNJApa5NRnh67pIpY4i0XuGBqEC6AysNoBll4IsEUlbYZysS5ostMCr Ry6Avzrbl32RqXfSh/ra2LzIg3hn478mX0WtECvyg9rQTn1R1wkNvFy+4eve+l2Z0I EaiRiRh2f7FuFQUI1dq/o440wSmqGNP6dDo6nMn06roMmOcDBQ9bqcFUq3ZCPK+aqZ wdYtJQYH4RHIQZXKImML++XSgIMnVBnp1SLix6qcfOFdl4tBJjZ0epU9OuOZSBOriR EImG3L+L9/STg== Date: Sun, 28 Aug 2022 17:33:27 +0100 From: Jonathan Cameron To: Shreeya Patel Cc: lars@metafoo.de, krisman@collabora.com, dmitry.osipenko@collabora.com, kernel@collabora.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] iio: light: tsl2583: Fix module unloading Message-ID: <20220828173327.7949ad73@jic23-huawei> In-Reply-To: <20220826122352.288438-1-shreeya.patel@collabora.com> References: <20220826122352.288438-1-shreeya.patel@collabora.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 Fri, 26 Aug 2022 17:53:52 +0530 Shreeya Patel wrote: > tsl2583 uses devm_iio_device_register() function and > calling iio_device_unregister() in remove breaks the > module unloading. > Fix this by using iio_device_register() instead of > devm_iio_device_register() function in probe. Not sure why you are wrapping at 55 chars. I rewrapped this whilst applying. Reworded it a little too as I was touching it anyway. Applied to the fixes-togreg branch of iio.git. > > Cc: stable@vger.kernel.org > Fixes: 371894f5d1a0 ("iio: tsl2583: add runtime power management support") I took a look at this patch and it introduces the issue I just pointed out in replying to your v1 by dropping the /* Make sure the chip is on */ Which was correct even with runtime pm because it covered the case of runtime_pm being disabled. We probably need to bring that back as well, perhaps as part of a cleanup patch taking this fully devm_ This driver has another issue for working if runtime PM isn't built into the kernel which is that it checks the return of pm_runtime_put_autosuspend() which calls static inline int __pm_runtime_suspend(struct device *dev, int rpmflags) { return -ENOSYS; } I've been meaning to do an audit for drivers that have this problem for a while, but not yet gotten to it. An ideal IIO driver needs to work correctly whether or not CONFIG_PM is enabled. Jonathan > Signed-off-by: Shreeya Patel > --- > Changes in v2 > - Use iio_device_register() instead of devm_iio_device_register() > - Add fixes and stable tags > > drivers/iio/light/tsl2583.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c > index 82662dab87c0..94d75ec687c3 100644 > --- a/drivers/iio/light/tsl2583.c > +++ b/drivers/iio/light/tsl2583.c > @@ -858,7 +858,7 @@ static int tsl2583_probe(struct i2c_client *clientp, > TSL2583_POWER_OFF_DELAY_MS); > pm_runtime_use_autosuspend(&clientp->dev); > > - ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); > + ret = iio_device_register(indio_dev); > if (ret) { > dev_err(&clientp->dev, "%s: iio registration failed\n", > __func__);