Re: [RFC PATCH net 2/5] net: dsa: be compatible with masters which unregister on shutdown

From: Vladimir Oltean
Date: Sun Sep 12 2021 - 09:18:46 EST


On Sun, Sep 12, 2021 at 03:09:29PM +0300, Vladimir Oltean wrote:
> +static int b53_mmap_shutdown(struct platform_device *pdev)
> +{
> + struct b53_device *dev = platform_get_drvdata(pdev);
> +
> + if (dev)
> + b53_switch_shutdown(dev);
> +
> + platform_set_drvdata(pdev, NULL);
> +}
> +
> static const struct of_device_id b53_mmap_of_table[] = {
> { .compatible = "brcm,bcm3384-switch" },
> { .compatible = "brcm,bcm6328-switch" },
> @@ -331,6 +343,7 @@ MODULE_DEVICE_TABLE(of, b53_mmap_of_table);
> static struct platform_driver b53_mmap_driver = {
> .probe = b53_mmap_probe,
> .remove = b53_mmap_remove,
> + .shutdown = b53_mmap_shutdown,
> .driver = {
> .name = "b53-switch",
> .of_match_table = b53_mmap_of_table,

I forgot to enable all variants of the b53 driver, and as such, the mmap
version fails to build (the shutdown function should return void, not int).

I will fix this when I send the v2 patch, but I will not send that now,
as I would like to get some feedback on the approach first.