public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan@nvidia.com>
To: <wsa@the-dreams.de>
Cc: <linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i2c: core: add devm apis for i2c_new_dummy and i2c_unregister
Date: Wed, 24 Feb 2016 16:41:14 +0530	[thread overview]
Message-ID: <56CD8FD2.6080600@nvidia.com> (raw)
In-Reply-To: <1454938058-28457-1-git-send-email-ldewangan@nvidia.com>

Hi Wolfram,

On Monday 08 February 2016 06:57 PM, Laxman Dewangan wrote:
> Add device managed APIs for i2c_new_dummy() and
> i2c_unregister_device() so that it can be managed by
> device framework for freeing it.
>
> This helps on following:
> 1. Maintaining the resource allocation and deallocation
> 	i2c_dummy = i2c_new_dummy();
> 	devm_regmap_init_i2c(i2c_dummy, &regmap_config)
>
> 	On this case, the user of i2c_dummy which is
> 	devm_regmap_init_i2c() is managed allocation where
> 	i2c_new_dummy() is not.
> 	On Free path, we have
> 		i2c_unregister_device(i2c_dummy)
> 	and later, device framework release the regmap. In this
> 	case, client of i2c_dummy after the i2c_dummy.
>
> 	By using devm apis, the sequence can be maintain
> 		i2c_dummy = devm_i2c_new_dummy();
> 		devm_regmap_init_i2c(i2c_dummy, &regmap_config)
>
> 	and resource deallocation will be done in reverse order
> 	by device framework.
>
> 2. No need to release the i2c_client in error/remove path and hence
>     there is less code requirement.
>
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
>


Can you please review this?

      reply	other threads:[~2016-02-24 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 13:27 [PATCH] i2c: core: add devm apis for i2c_new_dummy and i2c_unregister Laxman Dewangan
2016-02-24 11:11 ` Laxman Dewangan [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=56CD8FD2.6080600@nvidia.com \
    --to=ldewangan@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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