lkml.org 
[lkml]   [2014]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 5/6] base: platform: name the device already during allocation
On Mon, Jul 14, 2014 at 07:55:43AM -0700, Greg Kroah-Hartman wrote:
> > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> > > index 9e9227e..e856bc4 100644
> > > --- a/drivers/base/platform.c
> > > +++ b/drivers/base/platform.c
> > > @@ -177,11 +177,45 @@ struct platform_object {
> > > */
> > > void platform_device_put(struct platform_device *pdev)
> > > {
> > > - if (pdev)
> > > - put_device(&pdev->dev);
> > > + if (!pdev)
> > > + return;
> > > +
> > > + if (pdev->id_auto) {
> > > + ida_simple_remove(&platform_devid_ida, pdev->id);
> > > + pdev->id = PLATFORM_DEVID_AUTO;
> > > + }
> > > +
> > > + put_device(&pdev->dev);
> > > }
> > > EXPORT_SYMBOL_GPL(platform_device_put);
>
> Why would a single call to this function remove an id? That seems
> really wrong, you should be able to call get and put on a device
> numerous times, only the "last" reference should cause the device to be
> cleaned up.
>
> Shouldn't this be in the release function instead?

I'll fix this.

Thanks Greg.

--
heikki


\
 
 \ /
  Last update: 2014-08-05 09:02    [W:1.006 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site