Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3352005ybl; Sun, 15 Dec 2019 08:02:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyAdpQzand2tT3tQ47ZLcLjp/coeW7zxkXgASW2N5s/xHKz0Ya3qWnLi++IFF+4DzomOXLE X-Received: by 2002:a9d:798e:: with SMTP id h14mr25886655otm.257.1576425764734; Sun, 15 Dec 2019 08:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576425764; cv=none; d=google.com; s=arc-20160816; b=a5ewVE96WteW1Jafpka81YZHLxHElhedjreZuWfbMVfKgBP1jJxIp0V3VCGy96n2aj vydNGsclJJ+ENLDTGw0lKP+AYAkN/Bu9uNevVAtZJNH8KxXzjVnC2aEH/UTz68m79Dbs Tux1hGmG8wh7oMTTMoL0ZcTtxBW1LUHWo5swZJF9cjKTTDuHPAOTPcjNViw/SqvaJhPt tU1SWqIegDrk0fKMRgaGgjmtVhYnMCTqavHWEsqDsVS8tdKFMEkkIqyqNj+gOT3OdAg7 g/p892t4H5F/EXrbbocshxlifbNaxH0RemNhI/Ne5h1xN/pOleV8pTtpMvL/zboDUye/ QGxA== 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:subject:cc:to:from:date; bh=0OeZm+Q1NJ+1ymPfCeY/sYJwyCuiFbaO6GD4mvzPZZQ=; b=XYXVxPsdc6cw0leUKmMlWlTmWL6NiMSyF74gx35QWGQ1iMXimscNIMXQ1wk8BouEGr la/1/bN2MZ069n17WG3nxDXoppxbm4oYrEiJGRL/cp9GG2ePLfoob66/7UQVXAgaeMr/ cb5aG5cW6Z2i+wXDIjF6qhod/+9keKsNwP/PI0Wwr6MPubxLr+piUYE2GIdeEjYZJQXE Ra3CjEKnGkvvWl2roHhbaxW+qYy7Qm4l0oM71CbYIE4R6yOd3+CKUePyOTLj5Al6PZIB JuJ/Ebd6brqJv2oWoZu6II6WZjgg9xDch+ErW/sck2GLev1RV5EWcRU1tBbyVzMgRLGV lGww== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x207si8597682oif.30.2019.12.15.08.02.32; Sun, 15 Dec 2019 08:02:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726695AbfLOQBU (ORCPT + 99 others); Sun, 15 Dec 2019 11:01:20 -0500 Received: from saturn.retrosnub.co.uk ([46.235.226.198]:44506 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726219AbfLOQBU (ORCPT ); Sun, 15 Dec 2019 11:01:20 -0500 X-Greylist: delayed 552 seconds by postgrey-1.27 at vger.kernel.org; Sun, 15 Dec 2019 11:01:19 EST Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) by saturn.retrosnub.co.uk (Postfix; Retrosnub mail submission) with ESMTPSA id C746B9E7C73; Sun, 15 Dec 2019 15:52:48 +0000 (GMT) Date: Sun, 15 Dec 2019 15:52:47 +0000 From: Jonathan Cameron To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Alexandru Ardelean , Jonathan Cameron , linux-iio@vger.kernel.org Subject: Re: [PATCH AUTOSEL 5.4 074/350] iio: proximity: sx9500: fix iio_triggered_buffer_{predisable,postenable} positions Message-ID: <20191215155247.66ea5412@archlinux> In-Reply-To: <20191210210735.9077-35-sashal@kernel.org> References: <20191210210735.9077-1-sashal@kernel.org> <20191210210735.9077-35-sashal@kernel.org> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 10 Dec 2019 16:02:59 -0500 Sasha Levin wrote: > From: Alexandru Ardelean > > [ Upstream commit 3cfd6464fe23deb45bb688df66184b3f32fefc16 ] > > The iio_triggered_buffer_predisable() should be called last, to detach the > poll func after the devices has been suspended. > > This change re-organizes things a bit so that the postenable & predisable > are symmetrical. It also converts the preenable() to a postenable(). > > Not stable material as there is no known problem with the current > code, it's just not consistent with the form we would like all the > IIO drivers to adopt so as to allow subsystem wide changes. See comment. Jonathan > > Signed-off-by: Alexandru Ardelean > Signed-off-by: Jonathan Cameron > Signed-off-by: Sasha Levin > --- > drivers/iio/proximity/sx9500.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c > index 612f79c53cfc6..287d288e40c27 100644 > --- a/drivers/iio/proximity/sx9500.c > +++ b/drivers/iio/proximity/sx9500.c > @@ -675,11 +675,15 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private) > return IRQ_HANDLED; > } > > -static int sx9500_buffer_preenable(struct iio_dev *indio_dev) > +static int sx9500_buffer_postenable(struct iio_dev *indio_dev) > { > struct sx9500_data *data = iio_priv(indio_dev); > int ret = 0, i; > > + ret = iio_triggered_buffer_postenable(indio_dev); > + if (ret) > + return ret; > + > mutex_lock(&data->mutex); > > for (i = 0; i < SX9500_NUM_CHANNELS; i++) > @@ -696,6 +700,9 @@ static int sx9500_buffer_preenable(struct iio_dev *indio_dev) > > mutex_unlock(&data->mutex); > > + if (ret) > + iio_triggered_buffer_predisable(indio_dev); > + > return ret; > } > > @@ -704,8 +711,6 @@ static int sx9500_buffer_predisable(struct iio_dev *indio_dev) > struct sx9500_data *data = iio_priv(indio_dev); > int ret = 0, i; > > - iio_triggered_buffer_predisable(indio_dev); > - > mutex_lock(&data->mutex); > > for (i = 0; i < SX9500_NUM_CHANNELS; i++) > @@ -722,12 +727,13 @@ static int sx9500_buffer_predisable(struct iio_dev *indio_dev) > > mutex_unlock(&data->mutex); > > + iio_triggered_buffer_predisable(indio_dev); > + > return ret; > } > > static const struct iio_buffer_setup_ops sx9500_buffer_setup_ops = { > - .preenable = sx9500_buffer_preenable, > - .postenable = iio_triggered_buffer_postenable, > + .postenable = sx9500_buffer_postenable, > .predisable = sx9500_buffer_predisable, > }; >