Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp669316ybh; Sat, 7 Mar 2020 07:26:17 -0800 (PST) X-Google-Smtp-Source: ADFU+vsWPCecCtCp7JQpKSUatfBiALM4Recvf5YejyH0WSV53V5qB2n+92IwxnAUtQrvVgGsKqK8 X-Received: by 2002:a05:6830:1c6d:: with SMTP id s13mr6329516otg.47.1583594777249; Sat, 07 Mar 2020 07:26:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583594777; cv=none; d=google.com; s=arc-20160816; b=iActhOVtPrK0gYgXF2oeBTeiK1iL7pH0yehRC8iaaOM25O0Kv+OsBskXVCiCaWxJq6 pPrBfVuTxD2UKm8GsI1PaqJ7lv4ZKcdwH9ew76tF0Xs6hxCEOkKcsms7hbzfrgRD/LPn 94epupqNXVBMLY/v+TFTGrbHfRv+J3SvP9siPDOsjMAV2X1Ad11pRwWBwnP2solcezs+ D/XUpf9w/cKWG7vVi54I6sX6wFtVriFIk50RgNlFaAfy8LhPIwRVp53ZpoJ1HZvSi4mn cA+xcHELKVBZa0NbFXAiySf+q8/TUNLvdEGvEVASXg5WOzpgh2YS7KfLRJEnu/oO//g2 eHXA== 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 :dkim-signature; bh=7KzlOnEwaHV/n0ITv9J6q6lVzLXRiVcKvJeFF1eZKUo=; b=aHp4LWfa1rf4sbatADIG/R8OeHH4idRETZzMNHWU875n4K34Kh+BZCtjx276PU/T/q EMLhCDwOW24hf2vFSQ0FRw3ZsLCqx5X6aRVG+t+AUIbyedZed3e+Qi4pbdob0LDr5ETV YyExDnZ1MfW5MJq2UqXDDozWTtoq6cEbN103qZgas94RpTPwGhIcxfXGfxLhdO7Cta7a 7c3ZzIsHiU7sqzKVOrvoFsj9rGGJM1lErycC4GBLRUieon6KCxZEK9KJTCh1QQQRbWg6 yoXUMX39idKiGvltVb5a89UdxxTWPCUSBs6mtcEnL9MEBuf1wQnHgTi5ybtt2F+DVWkC syMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gsGxyz+O; 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 z2si3372056otp.263.2020.03.07.07.26.05; Sat, 07 Mar 2020 07:26:17 -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=gsGxyz+O; 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 S1726174AbgCGPZg (ORCPT + 99 others); Sat, 7 Mar 2020 10:25:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:54706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbgCGPZg (ORCPT ); Sat, 7 Mar 2020 10:25:36 -0500 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9A3D920656; Sat, 7 Mar 2020 15:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583594735; bh=jTfoDTpBht4Oo/wm8OLluLVKnLxr7/DLRPtg/24rA6c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gsGxyz+O+VogMCFWxY3SocOCsWoXO/Jf3bCMTr09LZGu9hvriHha288PP0urxzqGD uWGG1j/wauuukU3doF14pEC2pV2Dc0NsI/wa12hw9dk3qH0vX5TOla/N2cyZu1yEAx TwdcaOh2SW+nLDliZ1zKVG/nDJDm30Sc5ZYB5raE= Date: Sat, 7 Mar 2020 15:25:31 +0000 From: Jonathan Cameron To: Matt Ranostay Cc: Alexandru Ardelean , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, matt.ranostay@konsulko.com Subject: Re: [PATCH v2] iio: potentiostat: lmp9100: fix iio_triggered_buffer_{predisable,postenable} positions Message-ID: <20200307152531.159f14fb@archlinux> In-Reply-To: References: <20200304093633.32264-1-alexandru.ardelean@analog.com> <20200304094105.2586-1-alexandru.ardelean@analog.com> 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 Wed, 4 Mar 2020 13:17:36 -0800 Matt Ranostay wrote: > On Wed, Mar 4, 2020 at 1:38 AM Alexandru Ardelean > wrote: > > > > The iio_triggered_buffer_{predisable,postenable} functions attach/detach > > the poll functions. > > > > For the predisable hook, the disable code should occur before detaching > > the poll func, and for the postenable hook, the poll func should be > > attached before the enable code. > > > > The lmp9100 was attaching a poll function but never detaching it via any > > IIO disable hook. > > > > This change adds the detaching of the poll function, and moves/renames > > lmp91000_buffer_preenable() function to lmp91000_buffer_postenable(). > > The idea is to make it more symmetrical, so that when the > > iio_triggered_buffer_{predisable,postenable} functions get removed, it's > > easier to see. > > > > Fixes: 67e17300dc1d7 ("iio: potentiostat: add LMP91000 support") > > Signed-off-by: Alexandru Ardelean > > Acked-by: Matt Ranostay I'm not going to rush this one in as it's been like this for a while Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it, Thanks, Jonathan > > > --- > > > > Changelog v1 -> v2: > > * forgot to call iio_triggered_buffer_postenable() in > > lmp91000_buffer_postenable() in v1 > > > > drivers/iio/potentiostat/lmp91000.c | 18 +++++++++++++----- > > 1 file changed, 13 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c > > index a0e5f530faa9..2cb11da18e0f 100644 > > --- a/drivers/iio/potentiostat/lmp91000.c > > +++ b/drivers/iio/potentiostat/lmp91000.c > > @@ -275,11 +275,20 @@ static int lmp91000_buffer_cb(const void *val, void *private) > > static const struct iio_trigger_ops lmp91000_trigger_ops = { > > }; > > > > -static int lmp91000_buffer_preenable(struct iio_dev *indio_dev) > > +static int lmp91000_buffer_postenable(struct iio_dev *indio_dev) > > { > > struct lmp91000_data *data = iio_priv(indio_dev); > > + int err; > > > > - return iio_channel_start_all_cb(data->cb_buffer); > > + err = iio_triggered_buffer_postenable(indio_dev); > > + if (err) > > + return err; > > + > > + err = iio_channel_start_all_cb(data->cb_buffer); > > + if (err) > > + iio_triggered_buffer_predisable(indio_dev); > > + > > + return err; > > } > > > > static int lmp91000_buffer_predisable(struct iio_dev *indio_dev) > > @@ -288,12 +297,11 @@ static int lmp91000_buffer_predisable(struct iio_dev *indio_dev) > > > > iio_channel_stop_all_cb(data->cb_buffer); > > > > - return 0; > > + return iio_triggered_buffer_predisable(indio_dev); > > } > > > > static const struct iio_buffer_setup_ops lmp91000_buffer_setup_ops = { > > - .preenable = lmp91000_buffer_preenable, > > - .postenable = iio_triggered_buffer_postenable, > > + .postenable = lmp91000_buffer_postenable, > > .predisable = lmp91000_buffer_predisable, > > }; > > > > -- > > 2.20.1 > >