[PATCH 10/15] pciehp: remove crit_sect mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The crit_sect mutex defined in struct controller is to serialize
hot-plug operations against multiple slots under the same bus. But,
since PCIe doesnstream port has only one slot at most, it is
meaningless and we don't need it.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>

---
 drivers/pci/hotplug/pciehp.h      |    1 -
 drivers/pci/hotplug/pciehp_ctrl.c |   14 --------------
 drivers/pci/hotplug/pciehp_hpc.c  |    1 -
 3 files changed, 16 deletions(-)

Index: 20090915/drivers/pci/hotplug/pciehp.h
===================================================================
--- 20090915.orig/drivers/pci/hotplug/pciehp.h
+++ 20090915/drivers/pci/hotplug/pciehp.h
@@ -88,7 +88,6 @@ struct event_info {
 };
 
 struct controller {
-	struct mutex crit_sect;		/* critical section mutex */
 	struct mutex ctrl_lock;		/* controller lock */
 	struct pci_dev *pci_dev;
 	struct pcie_device *pcie;	/* PCI Express port service */
Index: 20090915/drivers/pci/hotplug/pciehp_ctrl.c
===================================================================
--- 20090915.orig/drivers/pci/hotplug/pciehp_ctrl.c
+++ 20090915/drivers/pci/hotplug/pciehp_ctrl.c
@@ -519,13 +519,9 @@ int pciehp_enable_slot(struct slot *p_sl
 	int rc;
 	struct controller *ctrl = p_slot->ctrl;
 
-	/* Check to see if (latch closed, card present, power off) */
-	mutex_lock(&p_slot->ctrl->crit_sect);
-
 	rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
 	if (rc || !getstatus) {
 		ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
-		mutex_unlock(&p_slot->ctrl->crit_sect);
 		return -ENODEV;
 	}
 	if (MRL_SENS(p_slot->ctrl)) {
@@ -533,7 +529,6 @@ int pciehp_enable_slot(struct slot *p_sl
 		if (rc || getstatus) {
 			ctrl_info(ctrl, "Latch open on slot(%s)\n",
 				  slot_name(p_slot));
-			mutex_unlock(&p_slot->ctrl->crit_sect);
 			return -ENODEV;
 		}
 	}
@@ -543,7 +538,6 @@ int pciehp_enable_slot(struct slot *p_sl
 		if (rc || getstatus) {
 			ctrl_info(ctrl, "Already enabled on slot(%s)\n",
 				  slot_name(p_slot));
-			mutex_unlock(&p_slot->ctrl->crit_sect);
 			return -EINVAL;
 		}
 	}
@@ -557,7 +551,6 @@ int pciehp_enable_slot(struct slot *p_sl
 
 	update_slot_info(p_slot);
 
-	mutex_unlock(&p_slot->ctrl->crit_sect);
 	return rc;
 }
 
@@ -571,15 +564,11 @@ int pciehp_disable_slot(struct slot *p_s
 	if (!p_slot->ctrl)
 		return 1;
 
-	/* Check to see if (latch closed, card present, power on) */
-	mutex_lock(&p_slot->ctrl->crit_sect);
-
 	if (!HP_SUPR_RM(p_slot->ctrl)) {
 		ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
 		if (ret || !getstatus) {
 			ctrl_info(ctrl, "No adapter on slot(%s)\n",
 				  slot_name(p_slot));
-			mutex_unlock(&p_slot->ctrl->crit_sect);
 			return -ENODEV;
 		}
 	}
@@ -589,7 +578,6 @@ int pciehp_disable_slot(struct slot *p_s
 		if (ret || getstatus) {
 			ctrl_info(ctrl, "Latch open on slot(%s)\n",
 				  slot_name(p_slot));
-			mutex_unlock(&p_slot->ctrl->crit_sect);
 			return -ENODEV;
 		}
 	}
@@ -599,7 +587,6 @@ int pciehp_disable_slot(struct slot *p_s
 		if (ret || !getstatus) {
 			ctrl_info(ctrl, "Already disabled on slot(%s)\n",
 				  slot_name(p_slot));
-			mutex_unlock(&p_slot->ctrl->crit_sect);
 			return -EINVAL;
 		}
 	}
@@ -607,7 +594,6 @@ int pciehp_disable_slot(struct slot *p_s
 	ret = remove_board(p_slot);
 	update_slot_info(p_slot);
 
-	mutex_unlock(&p_slot->ctrl->crit_sect);
 	return ret;
 }
 
Index: 20090915/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- 20090915.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ 20090915/drivers/pci/hotplug/pciehp_hpc.c
@@ -1017,7 +1017,6 @@ struct controller *pcie_init(struct pcie
 
 	ctrl->slot_cap = slot_cap;
 	ctrl->hpc_ops = &pciehp_hpc_ops;
-	mutex_init(&ctrl->crit_sect);
 	mutex_init(&ctrl->ctrl_lock);
 	init_waitqueue_head(&ctrl->queue);
 	dbg_ctrl(ctrl);

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux