mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Linus Walleij <linus.walleij@linaro.org>,
	Khouloud Touil <ktouil@baylibre.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH v3 7/7] nvmem: add a comment about resource management
Date: Wed, 19 Feb 2020 10:57:36 +0000	[thread overview]
Message-ID: <56f38e71-7572-55ac-d5ae-dfbe5c2345f7@linaro.org> (raw)
In-Reply-To: <20200219092218.18143-8-brgl@bgdev.pl>



On 19/02/2020 09:22, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> The fact that part of the resources associated with the nvmem resources
> is freed by the release() callback in device_type caused me some
> confusion. Add a comment explaining that to nvmem_register().

I see this patch totally unnecessary!

I expect people creating patch in this area to understand what exactly 
they are doing. This is not going to help them in anyway, other than 
misleading and re-documenting device_add which is already available at

https://www.kernel.org/doc/html/v5.5/driver-api/infrastructure.html


thanks,
srini


> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>   drivers/nvmem/core.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 40fe5913c264..6e28f3fddf53 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -397,6 +397,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
>   
>   	dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
>   
> +	/*
> +	 * After calling device_add() we can stop freeing previously
> +	 * allocated resources - they'll be freed from nvmem_release()
> +	 * when the device's reference count drops to 0.
> +	 */
>   	rval = device_add(&nvmem->dev);
>   	if (rval)
>   		goto err_put_device;
> 

  reply	other threads:[~2020-02-19 10:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  9:22 [PATCH v3 0/7] nvmem/gpio: fix " Bartosz Golaszewski
2020-02-19  9:22 ` [PATCH v3 1/7] nvmem: fix memory leak in error path Bartosz Golaszewski
2020-02-19 10:52   ` Srinivas Kandagatla
2020-02-19 10:53     ` Bartosz Golaszewski
2020-02-19  9:22 ` [PATCH v3 2/7] gpiolib: use kref in gpio_desc Bartosz Golaszewski
2020-02-21 13:40   ` Linus Walleij
2020-02-19  9:22 ` [PATCH v3 3/7] nvmem: increase the reference count of a gpio passed over config Bartosz Golaszewski
2020-02-19  9:22 ` [PATCH v3 4/7] nvmem: release the write-protect pin Bartosz Golaszewski
2020-02-19  9:22 ` [PATCH v3 5/7] nvmem: remove a stray newline in nvmem_register() Bartosz Golaszewski
2020-02-19  9:22 ` [PATCH v3 6/7] nvmem: add a newline for readability Bartosz Golaszewski
2020-02-19  9:22 ` [PATCH v3 7/7] nvmem: add a comment about resource management Bartosz Golaszewski
2020-02-19 10:57   ` Srinivas Kandagatla [this message]
2020-02-19 11:00 ` [PATCH v3 0/7] nvmem/gpio: fix " Srinivas Kandagatla

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=56f38e71-7572-55ac-d5ae-dfbe5c2345f7@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=geert@linux-m68k.org \
    --cc=ktouil@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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

all inboxes | Powered by JetHome®