public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] staging: iio: ad5933: attach life-cycle of kfifo buffer to parent device
Date: Sun, 10 May 2020 11:18:17 +0100	[thread overview]
Message-ID: <20200510111817.07e6bf72@archlinux> (raw)
In-Reply-To: <20200508143936.17845-1-alexandru.ardelean@analog.com>

On Fri, 8 May 2020 17:39:35 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> This change makes the use of devm_iio_kfifo_allocate() to attach the
> life-cycle of the kfifo buffer to the parent (client->dev) object.
> 
> This removes the need to explicitly free 'indio_dev->buffer' via
> iio_kfifo_free(), which is the main intent.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
*mutters darkly*.  Technically this patch adds a non obvious ordering
issue in remove, but then you fix it in the next one so I'll let that go.

However, you've not tried building patch 1 on it's own..

drivers/staging/iio/impedance-analyzer/ad5933.c:752:17: error: label 'error_unreg_ring' was not declared
drivers/staging/iio/impedance-analyzer/ad5933.c:756:17: error: label 'error_unreg_ring' was not declared
  CC [M]  drivers/staging/iio/impedance-analyzer/ad5933.o
drivers/staging/iio/impedance-analyzer/ad5933.c: In function ‘ad5933_probe’:
drivers/staging/iio/impedance-analyzer/ad5933.c:756:3: error: label ‘error_unreg_ring’ used but not defined
  756 |   goto error_unreg_ring;
      |   ^~~~
make[4]: *** [scripts/Makefile.build:267: drivers/staging/iio/impedance-analyzer/ad5933.o] Error 1
make[3]: *** [scripts/Makefile.build:488: drivers/staging/iio/impedance-analyzer] Error 2
make[2]: *** [scripts/Makefile.build:488: drivers/staging/iio] Error 2
make[1]: *** [scripts/Makefile.build:488: drivers/staging] Error 2
make: *** [Makefile:1722: drivers] Error 2

Easiest option here is just to merge the two patches into one. I've
done that and mashed the two commit messages into one semi-coherent whole.

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

thanks,

Jonathan

> ---
>  drivers/staging/iio/impedance-analyzer/ad5933.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
> index af0bcf95ee8a..633adf1a08c1 100644
> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> @@ -602,11 +602,12 @@ static const struct iio_buffer_setup_ops ad5933_ring_setup_ops = {
>  	.postdisable = ad5933_ring_postdisable,
>  };
>  
> -static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
> +static int ad5933_register_ring_funcs_and_init(struct device *dev,
> +					       struct iio_dev *indio_dev)
>  {
>  	struct iio_buffer *buffer;
>  
> -	buffer = iio_kfifo_allocate();
> +	buffer = devm_iio_kfifo_allocate(dev);
>  	if (!buffer)
>  		return -ENOMEM;
>  
> @@ -742,7 +743,7 @@ static int ad5933_probe(struct i2c_client *client,
>  	indio_dev->channels = ad5933_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(ad5933_channels);
>  
> -	ret = ad5933_register_ring_funcs_and_init(indio_dev);
> +	ret = ad5933_register_ring_funcs_and_init(&client->dev, indio_dev);
>  	if (ret)
>  		goto error_disable_mclk;
>  
> @@ -756,8 +757,6 @@ static int ad5933_probe(struct i2c_client *client,
>  
>  	return 0;
>  
> -error_unreg_ring:
> -	iio_kfifo_free(indio_dev->buffer);
>  error_disable_mclk:
>  	clk_disable_unprepare(st->mclk);
>  error_disable_reg:
> @@ -772,7 +771,6 @@ static int ad5933_remove(struct i2c_client *client)
>  	struct ad5933_state *st = iio_priv(indio_dev);
>  
>  	iio_device_unregister(indio_dev);
> -	iio_kfifo_free(indio_dev->buffer);
>  	regulator_disable(st->reg);
>  	clk_disable_unprepare(st->mclk);
>  


      parent reply	other threads:[~2020-05-10 10:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 14:39 [PATCH 1/2] staging: iio: ad5933: attach life-cycle of kfifo buffer to parent device Alexandru Ardelean
2020-05-08 14:39 ` [PATCH 2/2] staging: iio: ad5933: convert probe init to use device managed callbacks Alexandru Ardelean
2020-05-10 10:18 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200510111817.07e6bf72@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox