diff mbox series

iio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position

Message ID 20190920073122.21713-1-alexandru.ardelean@analog.com (mailing list archive)
State New, archived
Headers show
Series iio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position | expand

Commit Message

Alexandru Ardelean Sept. 20, 2019, 7:31 a.m. UTC
The iio_triggered_buffer_{predisable,postenable} functions attach/detach
the poll functions.

The iio_triggered_buffer_predisable() should be called last, to detach the
poll func after the devices has been suspended.

The position of iio_triggered_buffer_postenable() is correct.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/chemical/atlas-ph-sensor.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Alexandru Ardelean Sept. 20, 2019, 7:37 a.m. UTC | #1
On Fri, 2019-09-20 at 10:31 +0300, Alexandru Ardelean wrote:
> The iio_triggered_buffer_{predisable,postenable} functions attach/detach
> the poll functions.
> 
> The iio_triggered_buffer_predisable() should be called last, to detach
> the
> poll func after the devices has been suspended.
> 

I just noticed this is a RESEND.
The original is here:
https://patchwork.kernel.org/patch/11032569/

I did not think that I probably already sent it before sending it again.

> The position of iio_triggered_buffer_postenable() is correct.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>  drivers/iio/chemical/atlas-ph-sensor.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/chemical/atlas-ph-sensor.c
> b/drivers/iio/chemical/atlas-ph-sensor.c
> index 3a20cb5d9bff..6c175eb1c7a7 100644
> --- a/drivers/iio/chemical/atlas-ph-sensor.c
> +++ b/drivers/iio/chemical/atlas-ph-sensor.c
> @@ -323,16 +323,16 @@ static int atlas_buffer_predisable(struct iio_dev
> *indio_dev)
>  	struct atlas_data *data = iio_priv(indio_dev);
>  	int ret;
>  
> -	ret = iio_triggered_buffer_predisable(indio_dev);
> +	ret = atlas_set_interrupt(data, false);
>  	if (ret)
>  		return ret;
>  
> -	ret = atlas_set_interrupt(data, false);
> +	pm_runtime_mark_last_busy(&data->client->dev);
> +	ret = pm_runtime_put_autosuspend(&data->client->dev);
>  	if (ret)
>  		return ret;
>  
> -	pm_runtime_mark_last_busy(&data->client->dev);
> -	return pm_runtime_put_autosuspend(&data->client->dev);
> +	return iio_triggered_buffer_predisable(indio_dev);
>  }
>  
>  static const struct iio_trigger_ops atlas_interrupt_trigger_ops = {
Jonathan Cameron Oct. 5, 2019, 3:12 p.m. UTC | #2
Matt! Looking for your input on this one if possible.

Thanks,

Jonathan


On Fri, 20 Sep 2019 07:37:56 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Fri, 2019-09-20 at 10:31 +0300, Alexandru Ardelean wrote:
> > The iio_triggered_buffer_{predisable,postenable} functions attach/detach
> > the poll functions.
> > 
> > The iio_triggered_buffer_predisable() should be called last, to detach
> > the
> > poll func after the devices has been suspended.
> >   
> 
> I just noticed this is a RESEND.
> The original is here:
> https://patchwork.kernel.org/patch/11032569/
> 
> I did not think that I probably already sent it before sending it again.
> 
> > The position of iio_triggered_buffer_postenable() is correct.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/chemical/atlas-ph-sensor.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/iio/chemical/atlas-ph-sensor.c
> > b/drivers/iio/chemical/atlas-ph-sensor.c
> > index 3a20cb5d9bff..6c175eb1c7a7 100644
> > --- a/drivers/iio/chemical/atlas-ph-sensor.c
> > +++ b/drivers/iio/chemical/atlas-ph-sensor.c
> > @@ -323,16 +323,16 @@ static int atlas_buffer_predisable(struct iio_dev
> > *indio_dev)
> >  	struct atlas_data *data = iio_priv(indio_dev);
> >  	int ret;
> >  
> > -	ret = iio_triggered_buffer_predisable(indio_dev);
> > +	ret = atlas_set_interrupt(data, false);
> >  	if (ret)
> >  		return ret;
> >  
> > -	ret = atlas_set_interrupt(data, false);
> > +	pm_runtime_mark_last_busy(&data->client->dev);
> > +	ret = pm_runtime_put_autosuspend(&data->client->dev);
> >  	if (ret)
> >  		return ret;
> >  
> > -	pm_runtime_mark_last_busy(&data->client->dev);
> > -	return pm_runtime_put_autosuspend(&data->client->dev);
> > +	return iio_triggered_buffer_predisable(indio_dev);
> >  }
> >  
> >  static const struct iio_trigger_ops atlas_interrupt_trigger_ops = {
Matt Ranostay Oct. 6, 2019, 1:56 a.m. UTC | #3
On Fri, Sep 20, 2019 at 12:31 AM Alexandru Ardelean
<alexandru.ardelean@analog.com> wrote:
>
> The iio_triggered_buffer_{predisable,postenable} functions attach/detach
> the poll functions.
>
> The iio_triggered_buffer_predisable() should be called last, to detach the
> poll func after the devices has been suspended.
>
> The position of iio_triggered_buffer_postenable() is correct.
>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

Sorry didn't notice this till now. Looks good to me.

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

> ---
>  drivers/iio/chemical/atlas-ph-sensor.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
> index 3a20cb5d9bff..6c175eb1c7a7 100644
> --- a/drivers/iio/chemical/atlas-ph-sensor.c
> +++ b/drivers/iio/chemical/atlas-ph-sensor.c
> @@ -323,16 +323,16 @@ static int atlas_buffer_predisable(struct iio_dev *indio_dev)
>         struct atlas_data *data = iio_priv(indio_dev);
>         int ret;
>
> -       ret = iio_triggered_buffer_predisable(indio_dev);
> +       ret = atlas_set_interrupt(data, false);
>         if (ret)
>                 return ret;
>
> -       ret = atlas_set_interrupt(data, false);
> +       pm_runtime_mark_last_busy(&data->client->dev);
> +       ret = pm_runtime_put_autosuspend(&data->client->dev);
>         if (ret)
>                 return ret;
>
> -       pm_runtime_mark_last_busy(&data->client->dev);
> -       return pm_runtime_put_autosuspend(&data->client->dev);
> +       return iio_triggered_buffer_predisable(indio_dev);
>  }
>
>  static const struct iio_trigger_ops atlas_interrupt_trigger_ops = {
> --
> 2.20.1
>
Jonathan Cameron Oct. 6, 2019, 9:27 a.m. UTC | #4
On Sat, 5 Oct 2019 18:56:48 -0700
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Fri, Sep 20, 2019 at 12:31 AM Alexandru Ardelean
> <alexandru.ardelean@analog.com> wrote:
> >
> > The iio_triggered_buffer_{predisable,postenable} functions attach/detach
> > the poll functions.
> >
> > The iio_triggered_buffer_predisable() should be called last, to detach the
> > poll func after the devices has been suspended.
> >
> > The position of iio_triggered_buffer_postenable() is correct.
> >
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>  
> 
> Sorry didn't notice this till now. Looks good to me.
> 
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> 
> > ---
> >  drivers/iio/chemical/atlas-ph-sensor.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
> > index 3a20cb5d9bff..6c175eb1c7a7 100644
> > --- a/drivers/iio/chemical/atlas-ph-sensor.c
> > +++ b/drivers/iio/chemical/atlas-ph-sensor.c
> > @@ -323,16 +323,16 @@ static int atlas_buffer_predisable(struct iio_dev *indio_dev)
> >         struct atlas_data *data = iio_priv(indio_dev);
> >         int ret;
> >
> > -       ret = iio_triggered_buffer_predisable(indio_dev);
> > +       ret = atlas_set_interrupt(data, false);
> >         if (ret)
> >                 return ret;
> >
> > -       ret = atlas_set_interrupt(data, false);
> > +       pm_runtime_mark_last_busy(&data->client->dev);
> > +       ret = pm_runtime_put_autosuspend(&data->client->dev);
> >         if (ret)
> >                 return ret;
> >
> > -       pm_runtime_mark_last_busy(&data->client->dev);
> > -       return pm_runtime_put_autosuspend(&data->client->dev);
> > +       return iio_triggered_buffer_predisable(indio_dev);
> >  }
> >
> >  static const struct iio_trigger_ops atlas_interrupt_trigger_ops = {
> > --
> > 2.20.1
> >
diff mbox series

Patch

diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
index 3a20cb5d9bff..6c175eb1c7a7 100644
--- a/drivers/iio/chemical/atlas-ph-sensor.c
+++ b/drivers/iio/chemical/atlas-ph-sensor.c
@@ -323,16 +323,16 @@  static int atlas_buffer_predisable(struct iio_dev *indio_dev)
 	struct atlas_data *data = iio_priv(indio_dev);
 	int ret;
 
-	ret = iio_triggered_buffer_predisable(indio_dev);
+	ret = atlas_set_interrupt(data, false);
 	if (ret)
 		return ret;
 
-	ret = atlas_set_interrupt(data, false);
+	pm_runtime_mark_last_busy(&data->client->dev);
+	ret = pm_runtime_put_autosuspend(&data->client->dev);
 	if (ret)
 		return ret;
 
-	pm_runtime_mark_last_busy(&data->client->dev);
-	return pm_runtime_put_autosuspend(&data->client->dev);
+	return iio_triggered_buffer_predisable(indio_dev);
 }
 
 static const struct iio_trigger_ops atlas_interrupt_trigger_ops = {