RE: [PATCH v3 1/9] staging: fsl-mc: move bus driver out of staging
From: Stuart Yoder
Date: Fri Dec 09 2016 - 12:25:56 EST
> > > Where is the device freed? I see you trying to do some "odd" stuff in
> > > fsl_mc_device_remove() by deleting and then putting a device structure.
> > > I can't find a "release()" callback anywhere for your bus, where is it?
> > >
> > > What happens when the reference count falls to 0 for your struct device?
> >
> > Hrm...something seems wrong in free path, and I think this needs to
> > be refactored.
> >
> > IIRC, when German (former maintainer) wrote that code he loosely based
> > it on the register/unregister platform bus code:
> >
> > int platform_device_register(struct platform_device *pdev)
> > {
> > device_initialize(&pdev->dev);
> > arch_setup_pdev_archdata(pdev);
> > return platform_device_add(pdev);
> > }
> > void platform_device_unregister(struct platform_device *pdev)
> > {
> > platform_device_del(pdev);
> > platform_device_put(pdev);
> > }
> >
> > ...I'm puzzling over how that code handles a refcount of zero
> > as I see no 'release' callback anywhere, but I must be missing
> > something.
> >
> > In any case, we'll get this refactored.
>
> Have you tried removing a device? The kernel should complain loudly
> about there not being a release function for your device.
Yes, device removal has been working from day 1. A brief look
seems to indicate that the ref count never goes to zero, which
needs to be debugged.
Thanks,
Stuart