Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1380550 > unrolled thread

Re: [PATCH 1/3] iio: core: Add devm_ APIs for iio_channel_{get,release}

Started byJonathan Cameron <jic23@kernel.org>
First post2016-04-16 15:30 +0200
Last post2016-04-16 18:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/3] iio: core: Add devm_ APIs for  iio_channel_{get,release} Jonathan Cameron <jic23@kernel.org> - 2016-04-16 15:30 +0200
    Re: [PATCH 1/3] iio: core: Add devm_ APIs for iio_channel_{get,release} Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-16 18:00 +0200

#1380550 — Re: [PATCH 1/3] iio: core: Add devm_ APIs for iio_channel_{get,release}

FromJonathan Cameron <jic23@kernel.org>
Date2016-04-16 15:30 +0200
SubjectRe: [PATCH 1/3] iio: core: Add devm_ APIs for iio_channel_{get,release}
Message-ID<roysp-431-1@gated-at.bofh.it>
On 10/04/16 18:35, Laxman Dewangan wrote:
> 
> On Sunday 10 April 2016 07:35 PM, Jonathan Cameron wrote:
>> On 06/04/16 15:58, Laxman Dewangan wrote:
>>> Hi Daniel,
>>>
>>>
>>> On Wednesday 06 April 2016 07:19 PM, Daniel Baluta wrote:
>>>> On Wed, Apr 6, 2016 at 1:31 PM, Laxman Dewangan <ldewangan@nvidia.com> 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.
>>> Most of client for this APIs are in other subsystem.
>>> When I was working on the patch
>>> [PATCH 2/2] thermal: generic-adc: Add ADC based thermal sensor driver
>>>
>>> if I have devm_iio_channel_get() then I can get .remove callback at all.
>>>
>>> I did not use this new APIs in my patch because they are in different subsystem.
>> It's actually worse than that having taken a quick look at the generic-adc thermal patch
>> you reference above.
>> (perhaps worth cc'ing linux-iio for next version of that).
> Sure. I will CC.
> 
>>
>> Without this devm function set you have a race in remove in which I think you can
>> get attempts to access the channels after they have been released...
> Yaah, possibly race for very small time possible.
> 
> The limitation of devm_ api usage is that, we can keep using this
> till we have devm_ api continuous and if some resource are not there
> for devm_ then we can not use further. Possibly, I need to wait for
> the devm_iio_channel_get() to merge and available for all subsystem
> to use (next release) and then only I can use
> devm_thermal_zone_of_sensor_register().
> 
The alternative would be to merge this devm_ support as a prerequisite for your thermal
patches and have it go through that tree.  As it's self contained I have
no particular problem with that if you'd prefer to do it that way.

Otherwise, you will need to do as you say above (not use
devm_thermal_zone_of_sensor_register) to make sure it isn't broken in the meantime.

Jonathan

[toc] | [next] | [standalone]


#1380566 — Re: [PATCH 1/3] iio: core: Add devm_ APIs for iio_channel_{get,release}

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-04-16 18:00 +0200
SubjectRe: [PATCH 1/3] iio: core: Add devm_ APIs for iio_channel_{get,release}
Message-ID<roANA-5YB-13@gated-at.bofh.it>
In reply to#1380550
On Saturday 16 April 2016 06:55 PM, Jonathan Cameron wrote:
> On 10/04/16 18:35, Laxman Dewangan wrote:
>>
>> Yaah, possibly race for very small time possible.
>>
>> The limitation of devm_ api usage is that, we can keep using this
>> till we have devm_ api continuous and if some resource are not there
>> for devm_ then we can not use further. Possibly, I need to wait for
>> the devm_iio_channel_get() to merge and available for all subsystem
>> to use (next release) and then only I can use
>> devm_thermal_zone_of_sensor_register().
>>
> The alternative would be to merge this devm_ support as a prerequisite for your thermal
> patches and have it go through that tree.  As it's self contained I have
> no particular problem with that if you'd prefer to do it that way.
>
> Otherwise, you will need to do as you say above (not use
> devm_thermal_zone_of_sensor_register) to make sure it isn't broken in the meantime.
>
>

I have recycled patch of thermal driver to not use devm_ for sensor 
registration.

I will post another patch in future once these changes will be available 
for all, most probably next release.

I think there is no further comment now on the series so you can 
consider for next step.

Thanks,
Laxman

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web