Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5884347ybl; Tue, 10 Dec 2019 13:09:56 -0800 (PST) X-Google-Smtp-Source: APXvYqx4ej8rC4F+KV2+Cbvzd8aJ079oDbvNi+U7e7TmDiY0Dn2r75LETJltxBfLM4TVCIQJvd8t X-Received: by 2002:a05:6808:218:: with SMTP id l24mr853772oie.75.1576012196317; Tue, 10 Dec 2019 13:09:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576012196; cv=none; d=google.com; s=arc-20160816; b=blxIu5LazXHxMcrjUGFPjzbsaCjzJXMZUA4t6UhIGs77nOfpGy3BLMMsqNvp9XF6Nf COkHQ7Ifviykd4LoLuMdYHKBD8nXW3DtqGgyaE3vBUjmCHzGFEJRd7F7hEReG4vIppV3 dE7rudp2KdeXuokoruK31hdmy1u10nE35DgNWgcw5vy3qgil7XquS7elQESf2xZtJU+e g4EvhuAcDKDAaWo92xS/ipw/hbDj4lUD2vIytQuY9xKe2SWL5RYRIJnjEMI7ttul7F7Q w0uz7TJq70rG8GCAopOTDkhMb8W5W4iiDmgbrGSKYBfZzE7RmWFw5CmfBPc4ykZG2nEy xicg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZoqeFxSUpoEkFH26eS82BFyrMDaUPVE642zHU1W7a2M=; b=Bpqtr8Y31aEXh45n66zPfTZOxbREsi5cPkdImjwZ0KSVql5u6pbC/3X3f8PmJFpqs9 LsP2ovIr6SqlSNkhbNwTx27lPvAfXkfBIf9s8TXjfNg80nCiWad+bX2/iXY5Nq9nMgb5 h0B7Fm6Eu514yQC5qxjm0g+K+NgV74UjTHeTH9rddoh4u9g9Tvdq3T7jUwqJaf33jU+q VleLWqJIF5/iGqmB3gXtXQbEmqGedbDzt+ulc87fwKZ+ihxrciAiCV+jhIzmhd8HReU5 OCNrFE3g2s7Hi86K0UgunsC1MQjLzujVMITz4gtAdW6M2DD5RHUSH4xrlE5RLTTP64v4 ROeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="I/QIvS2B"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t130si1028560oib.202.2019.12.10.13.09.44; Tue, 10 Dec 2019 13:09:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="I/QIvS2B"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728039AbfLJVJF (ORCPT + 99 others); Tue, 10 Dec 2019 16:09:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:56966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728008AbfLJVJA (ORCPT ); Tue, 10 Dec 2019 16:09:00 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 10086246A7; Tue, 10 Dec 2019 21:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576012139; bh=PX5vOMAe3WelCDyOsnCu/L2YTS9HO4Ui6SNmnp+WoH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I/QIvS2BK0N9r/embhaJ/eJbZxF1mLkDhIQ3fSsyhWtIckoV892rIQYKDaAKXBgCe z+ZdNMJ23e9lIGTBKDKtCfsf0MxidnWDjywOYr/EzNyRBX5jBGyMawlkaTcICB/3S8 GNaRZyMGzeYrmt+9p0L8UCoiAyKK1wJQO5P6riN0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexandru Ardelean , Matt Ranostay , Jonathan Cameron , Sasha Levin , linux-iio@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 105/350] iio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position Date: Tue, 10 Dec 2019 16:03:30 -0500 Message-Id: <20191210210735.9077-66-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191210210735.9077-1-sashal@kernel.org> References: <20191210210735.9077-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexandru Ardelean [ Upstream commit 0c8a6e72f3c04bfe92a64e5e0791bfe006aabe08 ] The iio_triggered_buffer_{predisable,postenable} functions attach/detach the poll functions. The iio_triggered_buffer_predisable() should be called last, to detach the poll func after the devices has been suspended. The position of iio_triggered_buffer_postenable() is correct. Note this is not stable material. It's a fix in the logical model rather fixing an actual bug. These are being tidied up throughout the subsystem to allow more substantial rework that was blocked by variations in how things were done. Signed-off-by: Alexandru Ardelean Acked-by: Matt Ranostay Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/chemical/atlas-ph-sensor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c index 3a20cb5d9bffc..6c175eb1c7a7f 100644 --- a/drivers/iio/chemical/atlas-ph-sensor.c +++ b/drivers/iio/chemical/atlas-ph-sensor.c @@ -323,16 +323,16 @@ static int atlas_buffer_predisable(struct iio_dev *indio_dev) struct atlas_data *data = iio_priv(indio_dev); int ret; - ret = iio_triggered_buffer_predisable(indio_dev); + ret = atlas_set_interrupt(data, false); if (ret) return ret; - ret = atlas_set_interrupt(data, false); + pm_runtime_mark_last_busy(&data->client->dev); + ret = pm_runtime_put_autosuspend(&data->client->dev); if (ret) return ret; - pm_runtime_mark_last_busy(&data->client->dev); - return pm_runtime_put_autosuspend(&data->client->dev); + return iio_triggered_buffer_predisable(indio_dev); } static const struct iio_trigger_ops atlas_interrupt_trigger_ops = { -- 2.20.1