[PATCH v6 3/9] PCI: endpoint: Return error if EPC is started/stopped multiple times

Manivannan Sadhasivam posted 9 patches 2 years, 8 months ago
[PATCH v6 3/9] PCI: endpoint: Return error if EPC is started/stopped multiple times
Posted by Manivannan Sadhasivam 2 years, 8 months ago
When the EPC is started or stopped multiple times from configfs, just
return -EALREADY. There is no need to call the EPC start/stop functions
in those cases.

Reviewed-by: Kishon Vijay Abraham I <kishon@kernel.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/endpoint/pci-ep-cfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
index 4b8ac0ac84d5..7e0e430e4ceb 100644
--- a/drivers/pci/endpoint/pci-ep-cfs.c
+++ b/drivers/pci/endpoint/pci-ep-cfs.c
@@ -178,6 +178,9 @@ static ssize_t pci_epc_start_store(struct config_item *item, const char *page,
 	if (kstrtobool(page, &start) < 0)
 		return -EINVAL;
 
+	if (start == epc_group->start)
+		return -EALREADY;
+
 	if (!start) {
 		pci_epc_stop(epc);
 		epc_group->start = 0;
-- 
2.25.1
Re: [PATCH v6 3/9] PCI: endpoint: Return error if EPC is started/stopped multiple times
Posted by Damien Le Moal 2 years, 8 months ago
On 6/2/23 20:47, Manivannan Sadhasivam wrote:
> When the EPC is started or stopped multiple times from configfs, just
> return -EALREADY. There is no need to call the EPC start/stop functions
> in those cases.
> 
> Reviewed-by: Kishon Vijay Abraham I <kishon@kernel.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research