summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2017-04-20 16:36:25 -0400
committerBjorn Helgaas <bhelgaas@google.com>2017-04-28 11:38:00 -0400
commita5f40e8098fe6d983fdb3beb7b50a8067c136141 (patch)
treea98617d22761b5b620ac2af829e15f9afe6d00ea
parentef1b5dad5a386885998d11eb45ca7fd183079965 (diff)
PCI: Don't allow unbinding host controllers that aren't prepared
Many PCI host controller drivers aren't prepared to have their devices unbound from them forcefully (e.g., through /sys/.../<driver>/unbind), as they don't provide any driver .remove callback, where they'd detach the root bus, release resources, etc. Keeping the driver built in (i.e., not a loadable module) is not enough; and providing no .remove callback just means we don't do any teardown. To rule out the possibility of unbinding a device via sysfs, we need to set the ".suppress_bind_attrs" field. I found the suspect drivers via the following search: git grep -l platform_driver $(git grep -L -e '\.remove' -e suppress_bind_attrs drivers/pci/) Then I inspected them to ensure that (a) they set up a PCI bus in their probe() and (b) they don't have a remove() callback for undoing the setup Suggested-by: Bjorn Helgaas <helgaas@kernel.org> Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/dwc/pci-imx6.c1
-rw-r--r--drivers/pci/dwc/pci-layerscape.c1
-rw-r--r--drivers/pci/dwc/pcie-armada8k.c1
-rw-r--r--drivers/pci/dwc/pcie-artpec6.c1
-rw-r--r--drivers/pci/dwc/pcie-designware-plat.c1
-rw-r--r--drivers/pci/dwc/pcie-hisi.c2
-rw-r--r--drivers/pci/dwc/pcie-spear13xx.c1
-rw-r--r--drivers/pci/host/pci-ftpci100.c1
-rw-r--r--drivers/pci/host/pci-host-generic.c1
-rw-r--r--drivers/pci/host/pci-thunder-ecam.c1
-rw-r--r--drivers/pci/host/pci-thunder-pem.c1
-rw-r--r--drivers/pci/host/pci-versatile.c1
-rw-r--r--drivers/pci/host/pci-xgene.c1
13 files changed, 14 insertions, 0 deletions
diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c
index 129717ae5022..a98cba55c7f0 100644
--- a/drivers/pci/dwc/pci-imx6.c
+++ b/drivers/pci/dwc/pci-imx6.c
@@ -804,6 +804,7 @@ static struct platform_driver imx6_pcie_driver = {
804 .driver = { 804 .driver = {
805 .name = "imx6q-pcie", 805 .name = "imx6q-pcie",
806 .of_match_table = imx6_pcie_of_match, 806 .of_match_table = imx6_pcie_of_match,
807 .suppress_bind_attrs = true,
807 }, 808 },
808 .probe = imx6_pcie_probe, 809 .probe = imx6_pcie_probe,
809 .shutdown = imx6_pcie_shutdown, 810 .shutdown = imx6_pcie_shutdown,
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index 8f0ee0d8129c..27d638c4e134 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -305,6 +305,7 @@ static struct platform_driver ls_pcie_driver = {
305 .driver = { 305 .driver = {
306 .name = "layerscape-pcie", 306 .name = "layerscape-pcie",
307 .of_match_table = ls_pcie_of_match, 307 .of_match_table = ls_pcie_of_match,
308 .suppress_bind_attrs = true,
308 }, 309 },
309}; 310};
310builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe); 311builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
diff --git a/drivers/pci/dwc/pcie-armada8k.c b/drivers/pci/dwc/pcie-armada8k.c
index 3ff31301323b..495b023042b3 100644
--- a/drivers/pci/dwc/pcie-armada8k.c
+++ b/drivers/pci/dwc/pcie-armada8k.c
@@ -262,6 +262,7 @@ static struct platform_driver armada8k_pcie_driver = {
262 .driver = { 262 .driver = {
263 .name = "armada8k-pcie", 263 .name = "armada8k-pcie",
264 .of_match_table = of_match_ptr(armada8k_pcie_of_match), 264 .of_match_table = of_match_ptr(armada8k_pcie_of_match),
265 .suppress_bind_attrs = true,
265 }, 266 },
266}; 267};
267builtin_platform_driver(armada8k_pcie_driver); 268builtin_platform_driver(armada8k_pcie_driver);
diff --git a/drivers/pci/dwc/pcie-artpec6.c b/drivers/pci/dwc/pcie-artpec6.c
index 5b3b3afc0edb..82a04acc42fd 100644
--- a/drivers/pci/dwc/pcie-artpec6.c
+++ b/drivers/pci/dwc/pcie-artpec6.c
@@ -295,6 +295,7 @@ static struct platform_driver artpec6_pcie_driver = {
295 .driver = { 295 .driver = {
296 .name = "artpec6-pcie", 296 .name = "artpec6-pcie",
297 .of_match_table = artpec6_pcie_of_match, 297 .of_match_table = artpec6_pcie_of_match,
298 .suppress_bind_attrs = true,
298 }, 299 },
299}; 300};
300builtin_platform_driver(artpec6_pcie_driver); 301builtin_platform_driver(artpec6_pcie_driver);
diff --git a/drivers/pci/dwc/pcie-designware-plat.c b/drivers/pci/dwc/pcie-designware-plat.c
index f20d494922ab..32091b32f6e1 100644
--- a/drivers/pci/dwc/pcie-designware-plat.c
+++ b/drivers/pci/dwc/pcie-designware-plat.c
@@ -133,6 +133,7 @@ static struct platform_driver dw_plat_pcie_driver = {
133 .driver = { 133 .driver = {
134 .name = "dw-pcie", 134 .name = "dw-pcie",
135 .of_match_table = dw_plat_pcie_of_match, 135 .of_match_table = dw_plat_pcie_of_match,
136 .suppress_bind_attrs = true,
136 }, 137 },
137 .probe = dw_plat_pcie_probe, 138 .probe = dw_plat_pcie_probe,
138}; 139};
diff --git a/drivers/pci/dwc/pcie-hisi.c b/drivers/pci/dwc/pcie-hisi.c
index 1606de5bf757..18af8057cdc4 100644
--- a/drivers/pci/dwc/pcie-hisi.c
+++ b/drivers/pci/dwc/pcie-hisi.c
@@ -333,6 +333,7 @@ static struct platform_driver hisi_pcie_driver = {
333 .driver = { 333 .driver = {
334 .name = "hisi-pcie", 334 .name = "hisi-pcie",
335 .of_match_table = hisi_pcie_of_match, 335 .of_match_table = hisi_pcie_of_match,
336 .suppress_bind_attrs = true,
336 }, 337 },
337}; 338};
338builtin_platform_driver(hisi_pcie_driver); 339builtin_platform_driver(hisi_pcie_driver);
@@ -390,6 +391,7 @@ static struct platform_driver hisi_pcie_almost_ecam_driver = {
390 .driver = { 391 .driver = {
391 .name = "hisi-pcie-almost-ecam", 392 .name = "hisi-pcie-almost-ecam",
392 .of_match_table = hisi_pcie_almost_ecam_of_match, 393 .of_match_table = hisi_pcie_almost_ecam_of_match,
394 .suppress_bind_attrs = true,
393 }, 395 },
394}; 396};
395builtin_platform_driver(hisi_pcie_almost_ecam_driver); 397builtin_platform_driver(hisi_pcie_almost_ecam_driver);
diff --git a/drivers/pci/dwc/pcie-spear13xx.c b/drivers/pci/dwc/pcie-spear13xx.c
index 3ae59de5c043..8ff36b3dbbdf 100644
--- a/drivers/pci/dwc/pcie-spear13xx.c
+++ b/drivers/pci/dwc/pcie-spear13xx.c
@@ -308,6 +308,7 @@ static struct platform_driver spear13xx_pcie_driver = {
308 .driver = { 308 .driver = {
309 .name = "spear-pcie", 309 .name = "spear-pcie",
310 .of_match_table = of_match_ptr(spear13xx_pcie_of_match), 310 .of_match_table = of_match_ptr(spear13xx_pcie_of_match),
311 .suppress_bind_attrs = true,
311 }, 312 },
312}; 313};
313 314
diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c
index c0f29d1de341..d26501c4145a 100644
--- a/drivers/pci/host/pci-ftpci100.c
+++ b/drivers/pci/host/pci-ftpci100.c
@@ -556,6 +556,7 @@ static struct platform_driver faraday_pci_driver = {
556 .driver = { 556 .driver = {
557 .name = "ftpci100", 557 .name = "ftpci100",
558 .of_match_table = of_match_ptr(faraday_pci_of_match), 558 .of_match_table = of_match_ptr(faraday_pci_of_match),
559 .suppress_bind_attrs = true,
559 }, 560 },
560 .probe = faraday_pci_probe, 561 .probe = faraday_pci_probe,
561}; 562};
diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
index c05ea9d72f69..7d709a7e0aa8 100644
--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -60,6 +60,7 @@ static struct platform_driver gen_pci_driver = {
60 .driver = { 60 .driver = {
61 .name = "pci-host-generic", 61 .name = "pci-host-generic",
62 .of_match_table = gen_pci_of_match, 62 .of_match_table = gen_pci_of_match,
63 .suppress_bind_attrs = true,
63 }, 64 },
64 .probe = gen_pci_probe, 65 .probe = gen_pci_probe,
65}; 66};
diff --git a/drivers/pci/host/pci-thunder-ecam.c b/drivers/pci/host/pci-thunder-ecam.c
index 3f54a43bbbea..fc0ca03f280e 100644
--- a/drivers/pci/host/pci-thunder-ecam.c
+++ b/drivers/pci/host/pci-thunder-ecam.c
@@ -373,6 +373,7 @@ static struct platform_driver thunder_ecam_driver = {
373 .driver = { 373 .driver = {
374 .name = KBUILD_MODNAME, 374 .name = KBUILD_MODNAME,
375 .of_match_table = thunder_ecam_of_match, 375 .of_match_table = thunder_ecam_of_match,
376 .suppress_bind_attrs = true,
376 }, 377 },
377 .probe = thunder_ecam_probe, 378 .probe = thunder_ecam_probe,
378}; 379};
diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
index 6e031b522529..6e066f8b74df 100644
--- a/drivers/pci/host/pci-thunder-pem.c
+++ b/drivers/pci/host/pci-thunder-pem.c
@@ -474,6 +474,7 @@ static struct platform_driver thunder_pem_driver = {
474 .driver = { 474 .driver = {
475 .name = KBUILD_MODNAME, 475 .name = KBUILD_MODNAME,
476 .of_match_table = thunder_pem_of_match, 476 .of_match_table = thunder_pem_of_match,
477 .suppress_bind_attrs = true,
477 }, 478 },
478 .probe = thunder_pem_probe, 479 .probe = thunder_pem_probe,
479}; 480};
diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c
index 85e773661bc8..9281eee2d000 100644
--- a/drivers/pci/host/pci-versatile.c
+++ b/drivers/pci/host/pci-versatile.c
@@ -222,6 +222,7 @@ static struct platform_driver versatile_pci_driver = {
222 .driver = { 222 .driver = {
223 .name = "versatile-pci", 223 .name = "versatile-pci",
224 .of_match_table = versatile_pci_of_match, 224 .of_match_table = versatile_pci_of_match,
225 .suppress_bind_attrs = true,
225 }, 226 },
226 .probe = versatile_pci_probe, 227 .probe = versatile_pci_probe,
227}; 228};
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index de198980432e..8cae013e7188 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -697,6 +697,7 @@ static struct platform_driver xgene_pcie_driver = {
697 .driver = { 697 .driver = {
698 .name = "xgene-pcie", 698 .name = "xgene-pcie",
699 .of_match_table = of_match_ptr(xgene_pcie_match_table), 699 .of_match_table = of_match_ptr(xgene_pcie_match_table),
700 .suppress_bind_attrs = true,
700 }, 701 },
701 .probe = xgene_pcie_probe_bridge, 702 .probe = xgene_pcie_probe_bridge,
702}; 703};