Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752931AbcDFNt2 (ORCPT ); Wed, 6 Apr 2016 09:49:28 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33180 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752200AbcDFNtZ (ORCPT ); Wed, 6 Apr 2016 09:49:25 -0400 MIME-Version: 1.0 In-Reply-To: <1459938668-9180-1-git-send-email-ldewangan@nvidia.com> References: <1459938668-9180-1-git-send-email-ldewangan@nvidia.com> Date: Wed, 6 Apr 2016 16:49:23 +0300 Message-ID: Subject: Re: [PATCH 1/3] iio: core: Add devm_ APIs for iio_channel_{get,release} From: Daniel Baluta To: Laxman Dewangan Cc: Jonathan Cameron , Jonathan Corbet , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-doc@vger.kernel.org, Linux Kernel Mailing List , "linux-iio@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 665 Lines: 14 On Wed, Apr 6, 2016 at 1:31 PM, Laxman Dewangan wrote: > Some of kernel driver uses the IIO framework to get the sensor > value via ADC or IIO HW driver. The client driver get iio channel > by iio_channel_get() and release it by calling iio_channel_release(). > > Add resource managed version (devm_*) of these APIs so that if client > calls the devm_iio_channel_get() then it need not to release it explicitly, > it can be done by managed device framework when driver get un-binded. > > This reduces the code in error path and also need of .remove callback in > some cases. > Please provide at least one example of code that uses this API.