diff mbox series

[RESEND] PCI: endpoint: Fix clearing start entry in configfs

Message ID 1576844677-24933-1-git-send-email-hayashi.kunihiko@socionext.com
State Accepted
Commit f58d5f53c89479c12ad719c1960176442add5aaa
Headers show
Series [RESEND] PCI: endpoint: Fix clearing start entry in configfs | expand

Commit Message

Kunihiko Hayashi Dec. 20, 2019, 12:24 p.m. UTC
The value of 'start' entry is no change whenever writing 0 to configfs.
So the endpoint that stopped once can't restart.

The following command lines are an example restarting endpoint and
reprogramming configurations after receiving bus-reset.

    echo 0 > controllers/66000000.pcie-ep/start
    rm controllers/66000000.pcie-ep/func1
    ln -s functions/pci_epf_test/func1 controllers/66000000.pcie-ep/
    echo 1 > controllers/66000000.pcie-ep/start

However, the first 'echo' can't set 0 to 'start', so the last 'echo' can't
restart endpoint.

Fixes: d74679911610 ("PCI: endpoint: Introduce configfs entry for configuring EP functions")
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

---
 drivers/pci/endpoint/pci-ep-cfs.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.7.4
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
index d1288a0..4fead88 100644
--- a/drivers/pci/endpoint/pci-ep-cfs.c
+++ b/drivers/pci/endpoint/pci-ep-cfs.c
@@ -58,6 +58,7 @@  static ssize_t pci_epc_start_store(struct config_item *item, const char *page,
 
 	if (!start) {
 		pci_epc_stop(epc);
+		epc_group->start = 0;
 		return len;
 	}