From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757361AbcBXLXh (ORCPT ); Wed, 24 Feb 2016 06:23:37 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:4960 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751760AbcBXLXe (ORCPT ); Wed, 24 Feb 2016 06:23:34 -0500 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 24 Feb 2016 03:23:26 -0800 Message-ID: <56CD8FD2.6080600@nvidia.com> Date: Wed, 24 Feb 2016 16:41:14 +0530 From: Laxman Dewangan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: CC: , Subject: Re: [PATCH] i2c: core: add devm apis for i2c_new_dummy and i2c_unregister References: <1454938058-28457-1-git-send-email-ldewangan@nvidia.com> In-Reply-To: <1454938058-28457-1-git-send-email-ldewangan@nvidia.com> X-Originating-IP: [10.19.65.30] X-ClientProxiedBy: DRHKMAIL102.nvidia.com (10.25.59.16) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, ®map_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, ®map_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 > Can you please review this?