From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6762CC433E2 for ; Fri, 19 Jun 2020 16:31:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E91D21919 for ; Fri, 19 Jun 2020 16:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395060AbgFSQbx (ORCPT ); Fri, 19 Jun 2020 12:31:53 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2346 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2395042AbgFSQbv (ORCPT ); Fri, 19 Jun 2020 12:31:51 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 8C2554A4460EE215B62C; Fri, 19 Jun 2020 17:31:50 +0100 (IST) Received: from localhost (10.52.127.178) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 19 Jun 2020 17:31:50 +0100 Date: Fri, 19 Jun 2020 17:31:01 +0100 From: Jonathan Cameron To: Sasha Levin CC: , , "Alexandru Ardelean" , Subject: Re: [PATCH AUTOSEL 4.4 03/60] iio: light: isl29125: fix iio_triggered_buffer_{predisable,postenable} positions Message-ID: <20200619173101.000045a2@Huawei.com> In-Reply-To: <20200618013004.610532-3-sashal@kernel.org> References: <20200618013004.610532-1-sashal@kernel.org> <20200618013004.610532-3-sashal@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.127.178] X-ClientProxiedBy: lhreml725-chm.china.huawei.com (10.201.108.76) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Wed, 17 Jun 2020 21:29:07 -0400 Sasha Levin wrote: > From: Alexandru Ardelean > > [ Upstream commit 9b7a12c3e090cf3fba6f66f1f23abbc6e0e86021 ] > > 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. > > This change reworks the predisable/postenable hooks so that the pollfunc is > attached/detached in the correct position. > It also balances the calls a bit, by grouping the preenable and the > iio_triggered_buffer_postenable() into a single > isl29125_buffer_postenable() function. > This is really part of some rework. It doesn't 'fix' a bug as such (I think), but rather a bit of logical inconsistency. Shouldn't do any harm though beyond adding noise to stable. I added notes to some of these to mark them as not stable material, but clearly missed this one. Sorry about that. Jonathan > Signed-off-by: Alexandru Ardelean > Signed-off-by: Jonathan Cameron > Signed-off-by: Sasha Levin > --- > drivers/iio/light/isl29125.c | 28 +++++++++++++++++++--------- > 1 file changed, 19 insertions(+), 9 deletions(-) > > diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c > index e2945a20e5f6..60388a41ec8c 100644 > --- a/drivers/iio/light/isl29125.c > +++ b/drivers/iio/light/isl29125.c > @@ -215,13 +215,24 @@ static const struct iio_info isl29125_info = { > .driver_module = THIS_MODULE, > }; > > -static int isl29125_buffer_preenable(struct iio_dev *indio_dev) > +static int isl29125_buffer_postenable(struct iio_dev *indio_dev) > { > struct isl29125_data *data = iio_priv(indio_dev); > + int err; > + > + err = iio_triggered_buffer_postenable(indio_dev); > + if (err) > + return err; > > data->conf1 |= ISL29125_MODE_RGB; > - return i2c_smbus_write_byte_data(data->client, ISL29125_CONF1, > + err = i2c_smbus_write_byte_data(data->client, ISL29125_CONF1, > data->conf1); > + if (err) { > + iio_triggered_buffer_predisable(indio_dev); > + return err; > + } > + > + return 0; > } > > static int isl29125_buffer_predisable(struct iio_dev *indio_dev) > @@ -229,19 +240,18 @@ static int isl29125_buffer_predisable(struct iio_dev *indio_dev) > struct isl29125_data *data = iio_priv(indio_dev); > int ret; > > - ret = iio_triggered_buffer_predisable(indio_dev); > - if (ret < 0) > - return ret; > - > data->conf1 &= ~ISL29125_MODE_MASK; > data->conf1 |= ISL29125_MODE_PD; > - return i2c_smbus_write_byte_data(data->client, ISL29125_CONF1, > + ret = i2c_smbus_write_byte_data(data->client, ISL29125_CONF1, > data->conf1); > + > + iio_triggered_buffer_predisable(indio_dev); > + > + return ret; > } > > static const struct iio_buffer_setup_ops isl29125_buffer_setup_ops = { > - .preenable = isl29125_buffer_preenable, > - .postenable = &iio_triggered_buffer_postenable, > + .postenable = isl29125_buffer_postenable, > .predisable = isl29125_buffer_predisable, > }; >