Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2235904ybg; Sun, 27 Oct 2019 14:04:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/z/yfUsujlTrnuOGqlblp4aTnRcNDu8BGbENmn/EQ30J8q/EDRv3pppem4aS60BlwtZsG X-Received: by 2002:aa7:d0c9:: with SMTP id u9mr15641918edo.217.1572210299238; Sun, 27 Oct 2019 14:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572210299; cv=none; d=google.com; s=arc-20160816; b=cdCTqT5uYb6xGZPEFjRuKKaeMidSNPxYOBRMcWorEuMwgi0xiSEr9wePOuk+o9WVx+ +yczW1T+fh3jaZKRY4pbWdMTanHArHw9CjkoC7kabLMgrR2KaTcPIdPZgYmEIr/fM3f6 bsya3srqvcAhkMPQ6+TGADFW2gbXL/5YYVOvmKNH9LmWWAMr7xy3/sb3FbuyEHsMZ24f GxiFhEOyMftab2qi7Y0beAz4JGs80s2eKA8c29G9eE03ESyx59UDzMwjes1nXpjQO2oc nUGs1bl9qfsufzhKtIUsoSt9Fcyv0veGFrbCzQ5C73gIG0rzMVbhYvmTiiR8dDBzuZ2W Lk+w== 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=W72JgsGPmmhNZtme6eDZdINe8MmHqALahwfmKP4ShyY=; b=tUJPUnMoJ+0pAuTrAAaPLN7FXTVpzkjDZSt1Ap4e0Zs9DLyCPhQudtenve2crdjzmr xw8rO1mAXNqoYdCaPBz7E+AloiAOKA5V2YElLQwJ9VjEyHtOjJbaQUzBuFlWY6XVOUfw VhelG5IviXGhwSYMt1LLa6DHrpf3Juj9LA98Jo60v80mXJBu+e05t4D6GgR4bTTbwsIE YzsXYuCVgI53TsQJplL7YJgc5N1foMqpk3Kq/7M64exfI67XiVzYc09XRxq1a504dNDo moaErCbLnuA0111TUj8YAC5ZayNchAjkvjb1fLdmNHTXrrUDW8XyiK9tOgvDTi/bOkiK /oXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@konsulko.com header.s=google header.b=nGexxOxc; 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 l14si895574ejc.221.2019.10.27.14.04.15; Sun, 27 Oct 2019 14:04:59 -0700 (PDT) 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=@konsulko.com header.s=google header.b=nGexxOxc; 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 S1727707AbfJ0Sh5 (ORCPT + 99 others); Sun, 27 Oct 2019 14:37:57 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:42717 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbfJ0Sh5 (ORCPT ); Sun, 27 Oct 2019 14:37:57 -0400 Received: by mail-io1-f67.google.com with SMTP id i26so7958818iog.9 for ; Sun, 27 Oct 2019 11:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W72JgsGPmmhNZtme6eDZdINe8MmHqALahwfmKP4ShyY=; b=nGexxOxcZS1qZt7/3zp5kR38mDu+QZrlelR9kgOjdQDmyEqBCURDadNT0ztc9FQwsx LKgMULOyAqSQ45pZs+UkKaPOnHYa0/TZeyAUa9q9UBSVZmmSu9uSEHPbM+/zMziMnmv5 Itoqh8yZLC0RBddUhglUSMdq17Fujs22/FMuc= 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=W72JgsGPmmhNZtme6eDZdINe8MmHqALahwfmKP4ShyY=; b=iOoFoKN6OzCFMZxtbK3pXqQGbGnvwJbHORuM41fjcGT7MrKrXP4QfW6vBroyYjnzJE Pc6UEE3bSPZZ4g8ZXXjgT4RWx14+OfTuP8JCiEexhsYrxm/saKrhS/5Tdeb6DzITB817 7aLudAiw2bQEiBNE6A8FMb8KJWOVgpOVItvV5xi12BTAXw4+whawAg6aWQLYERJHAtcC V9NA70RCnM0drgL2n+isxDCVzw8kBK5A3C8WWBhFv96FyCN1R1SrvoEf6AGnR/bE7RPp Ji5rQYfu5PowRzQ8dtZy6978babK1EiX+6Equdnxfv61V6wCwlRgh31y9cEcuCKzHCLq 1Nog== X-Gm-Message-State: APjAAAXntp47Cbp9PXLtHSP006TSVSIxFFCo6X0J6gm1McrboByCp/on MSQakgBbpVgDe6LNC9sge4Y+aJ8w3oLivEFGreXf0A== X-Received: by 2002:a6b:c305:: with SMTP id t5mr13106457iof.87.1572201476275; Sun, 27 Oct 2019 11:37:56 -0700 (PDT) MIME-Version: 1.0 References: <20191023082714.18681-1-alexandru.ardelean@analog.com> <20191027165813.5a5b0519@archlinux> In-Reply-To: <20191027165813.5a5b0519@archlinux> From: Matt Ranostay Date: Sun, 27 Oct 2019 20:37:45 +0200 Message-ID: Subject: Re: [PATCH] iio: hdc100x: fix iio_triggered_buffer_{predisable,postenable} positions To: Jonathan Cameron Cc: Alexandru Ardelean , "open list:IIO SUBSYSTEM AND DRIVERS" , open list 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 Sun, Oct 27, 2019 at 6:58 PM Jonathan Cameron wrote: > > On Wed, 23 Oct 2019 11:27:14 +0300 > Alexandru Ardelean wrote: > > > The iio_triggered_buffer_postenable() hook should be called first to > > attach the poll function and the iio_triggered_buffer_predisable() hook > > should be called last in the predisable hook. > > > > This change updates the driver to attach/detach the poll func in the > > correct order. > > > > Signed-off-by: Alexandru Ardelean > Seems fine, but should have cc'd Matt and I'd like to give him time > to take a quick look. > Reviewed-by: Matt Ranostay > +CC Matt. > > Thanks, > > Jonathan > > > --- > > drivers/iio/humidity/hdc100x.c | 19 +++++++++++-------- > > 1 file changed, 11 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c > > index bfe1cdb16846..963ff043eecf 100644 > > --- a/drivers/iio/humidity/hdc100x.c > > +++ b/drivers/iio/humidity/hdc100x.c > > @@ -278,31 +278,34 @@ static int hdc100x_buffer_postenable(struct iio_dev *indio_dev) > > struct hdc100x_data *data = iio_priv(indio_dev); > > int ret; > > > > + ret = iio_triggered_buffer_postenable(indio_dev); > > + if (ret) > > + return ret; > > + > > /* Buffer is enabled. First set ACQ Mode, then attach poll func */ > > mutex_lock(&data->lock); > > ret = hdc100x_update_config(data, HDC100X_REG_CONFIG_ACQ_MODE, > > HDC100X_REG_CONFIG_ACQ_MODE); > > mutex_unlock(&data->lock); > > if (ret) > > - return ret; > > + iio_triggered_buffer_predisable(indio_dev); > > > > - return iio_triggered_buffer_postenable(indio_dev); > > + return ret; > > } > > > > static int hdc100x_buffer_predisable(struct iio_dev *indio_dev) > > { > > struct hdc100x_data *data = iio_priv(indio_dev); > > - int ret; > > - > > - /* First detach poll func, then reset ACQ mode. OK to disable buffer */ > > - ret = iio_triggered_buffer_predisable(indio_dev); > > - if (ret) > > - return ret; > > + int ret, ret2; > > > > mutex_lock(&data->lock); > > ret = hdc100x_update_config(data, HDC100X_REG_CONFIG_ACQ_MODE, 0); > > mutex_unlock(&data->lock); > > > > + ret2 = iio_triggered_buffer_predisable(indio_dev); > > + if (ret == 0) > > + ret = ret2; > > + > > return ret; > > } > > >