Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4914057ybf; Wed, 4 Mar 2020 13:19:26 -0800 (PST) X-Google-Smtp-Source: ADFU+vtR8JA93GI3g+AGmRO0Ft6zwOruBXjPHtcf4FjQYYXOs1GUM9RFn/k5Fs+e1Xz2BV6CnuWR X-Received: by 2002:a9d:66d9:: with SMTP id t25mr4135694otm.92.1583356766339; Wed, 04 Mar 2020 13:19:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583356766; cv=none; d=google.com; s=arc-20160816; b=FSHZeT5ALbsxHKIOmzC9MluANh3kjcSXcWwvtzElkrpg6Q/nPFuhU7mC0hoR7eb7ja 4svnNHEe4ELO5RTtvWgcrqATq4JLh2mPf7Ky3N4YGFsO8FJZgCceYPj7pOv8W9lNtzQ+ h5aKQljgtIcDOcWC5uOzzpQ43y/RtHHa0vi/3EQBMP4rdRY84r05XchY5AvCq+X6urNo eZT37ZthlenDI8OahvLRPFsd1SzNXE3NP1Fjpi9B9Md6unXw6clxd916MfFwxiezlk0O CGCrdq5VeapluW49qfkESL77yId3OBeK2cDzrlMQ42lhEvfdnnhjJ+qVFYYtYbzwR36f Pihw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=btFxI1AY902XfnaAbQ65M1jnLtqbJ2OeOdebXmzbiT8=; b=Jl2YUJcccoMunLIYAV02LIu5x9aWcSpoIDpyA2p7RGHDaUA7WqCgZNrOHYXF7TUMH4 KULNrWZmFaELSwSuVQhPfD0ZcMQXrr58HnipA8Bjr3TnlRJvJLQE+Dkpqy4zUYcsbypj H0W9J545IvG3MogUgyICV2JqO19NBTmQGC+SBt6eqlNbIBX1yEGobNWCFJpBvCMvEH5f HqE2DSyiRC62w+wD1r2dz5uSsG9fadpDcGLCOeKY0tmyYhWgl8h607y1E3ZGMGyPvXGs dkpIz9VOTImGLznerwLuOTytXeOz3lis0UJcXVhH6G/7TdolJIGRhldT/cOMn+wgJdkW 4CqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HrgFjRhW; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y25si1866821oih.73.2020.03.04.13.19.13; Wed, 04 Mar 2020 13:19:26 -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=@gmail.com header.s=20161025 header.b=HrgFjRhW; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729543AbgCDVSO (ORCPT + 99 others); Wed, 4 Mar 2020 16:18:14 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:45519 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbgCDVSN (ORCPT ); Wed, 4 Mar 2020 16:18:13 -0500 Received: by mail-ot1-f67.google.com with SMTP id f21so3502986otp.12; Wed, 04 Mar 2020 13:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=btFxI1AY902XfnaAbQ65M1jnLtqbJ2OeOdebXmzbiT8=; b=HrgFjRhWzaQHkAI3vNc7+HytZ01Wr0Dz4sMaw2UVaZFnuBjfR4TEcv4rhqM+ZLsI5/ GK7CHt4XYQmlabtfqTHhMAPpOZYDA2eS35+9dNCJumVMrzQLUFhd7dpT1tiIDpgWxtkE zRNGmLDrwoO5x1UCOvcv/V25aCRb2Gt3Mzu/RPFKdNdviZG1/jdfdeAbYPlxefCuItpY 74508y7QtZUQx04AmAbPC6ss1g/skvPHZAWGznrEaME1lAba508HB+N0xH4pMLb5jC3l QBXyTyDIV4jJyxDlL9CBJQZG9xamQCVxNVETHIOFBx41eWFzSotNemL9TB9D2O7Ts8l1 RDBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=btFxI1AY902XfnaAbQ65M1jnLtqbJ2OeOdebXmzbiT8=; b=uDI1uAcxgJVB59oYUJ2dnw0shkHn92toW/27BGH9gN/KkXo4ZSBdIfmjdDXSKEhLVW Ti/H8CVPIJuTwC6DyrB5XxSfrL5s76AkNh5AeWUO5oVzDwZGLBY0gWagybkBlLKXXY6v fNIaP8akUop+CP0KK5ks4fMk12m803Vp0tvnL4mffeHhoV3eYQSCKhs07G5sd11rtAqn eT0IQTRg/qHPwDiRw4IvzveyvgbZTCF4hnkPzHaSddEPo3y3w6ohFH7XJWd/8OzEmbuV 6kKMyqzkkoOuQIf555reStNGGrV7iUtrL1Hyo5kIhmHFgBP1ANoYeM1rDQREWQG/pgXS os8g== X-Gm-Message-State: ANhLgQ1C4c9/2qNZyeZBuNNu0F2/AePOUbWuNz2L3tMVJ4Gns0huIncN x+AhU5TP3uY1WrJqdJZduXHQXee4FuKRyfC/ATriV/b1 X-Received: by 2002:a9d:6a06:: with SMTP id g6mr3674841otn.305.1583356692708; Wed, 04 Mar 2020 13:18:12 -0800 (PST) MIME-Version: 1.0 References: <20200304093633.32264-1-alexandru.ardelean@analog.com> <20200304094105.2586-1-alexandru.ardelean@analog.com> In-Reply-To: <20200304094105.2586-1-alexandru.ardelean@analog.com> From: Matt Ranostay Date: Wed, 4 Mar 2020 13:17:36 -0800 Message-ID: Subject: Re: [PATCH v2] iio: potentiostat: lmp9100: fix iio_triggered_buffer_{predisable,postenable} positions To: Alexandru Ardelean Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Cameron , matt.ranostay@konsulko.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > > 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 >