net: dsa: be compatible with masters which unregister on shutdown
[platform/kernel/linux-rpi.git] / drivers / net / dsa / b53 / b53_mmap.c
index 82680e0..ae4c79d 100644 (file)
@@ -316,9 +316,21 @@ static int b53_mmap_remove(struct platform_device *pdev)
        if (dev)
                b53_switch_remove(dev);
 
+       platform_set_drvdata(pdev, NULL);
+
        return 0;
 }
 
+static void 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,