Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular

From: Paul Gortmaker
Date: Tue Nov 27 2018 - 10:05:47 EST


[Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On 27/11/2018 (Tue 13:07) Lee Jones wrote:

> On Fri, 23 Nov 2018, Paul Gortmaker wrote:

[...]

> > My other pending MFD patches have a trivial runtime behavior change;
> > deleting a ".remove" field/function - that will never be used for a
> > non-module case, but in theory could be (pointlessly) triggered by
> > forcing a driver unbind. (see mainline 98b72b94def9 as an example)
> > Patches like this were left behind for a future send batch.
>
> What about when .remove() is invoked during shutdown?

It is my understanding that .remove is not invoked during shutdown.

If we step outside of MFD and look at mainline commit 7aa8619a66aea5
("iommu/arm-smmu-v3: Implement shutdown method") -- you can see it adds
a shutdown that is just a wrapper around the remove function.

If shutdown called remove, then this commit would cause the remove
function to get called *twice* on a shutdown.

I also don't see any obvious coupling in drivers/base/platform.c - they
seem independent, but it is possible I've overlooked something?

Thanks,
Paul.

----------
static int platform_drv_remove(struct device *_dev)
{
struct platform_driver *drv = to_platform_driver(_dev->driver);
struct platform_device *dev = to_platform_device(_dev);
int ret = 0;

if (drv->remove)
ret = drv->remove(dev);
dev_pm_domain_detach(_dev, true);

return ret;
}

static void platform_drv_shutdown(struct device *_dev)
{
struct platform_driver *drv = to_platform_driver(_dev->driver);
struct platform_device *dev = to_platform_device(_dev);

if (drv->shutdown)
drv->shutdown(dev);
}
----------