Skip to content

Commit

Permalink
PCI: pciehp: Drop enable/disable lock
Browse files Browse the repository at this point in the history
Previously slot enablement and disablement could happen concurrently.
But now it's under the exclusive control of the IRQ thread, rendering
the locking obsolete.  Drop it.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Lukas Wunner authored and Bjorn Helgaas committed Jul 23, 2018
1 parent 32a8cef commit 1656716
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 15 deletions.
3 changes: 0 additions & 3 deletions drivers/pci/hotplug/pciehp.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,13 @@ do { \
* an Attention Button press
* @lock: protects reads and writes of @state;
* protects scheduling, execution and cancellation of @work
* @hotplug_lock: serializes calls to pciehp_enable_slot() and
* pciehp_disable_slot()
*/
struct slot {
u8 state;
struct controller *ctrl;
struct hotplug_slot *hotplug_slot;
struct delayed_work work;
struct mutex lock;
struct mutex hotplug_lock;
};

/**
Expand Down
11 changes: 0 additions & 11 deletions drivers/pci/hotplug/pciehp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,6 @@ void pciehp_handle_presence_change(struct slot *slot)
}
}

/*
* Note: This function must be called with slot->hotplug_lock held
*/
static int __pciehp_enable_slot(struct slot *p_slot)
{
u8 getstatus = 0;
Expand Down Expand Up @@ -316,10 +313,7 @@ int pciehp_enable_slot(struct slot *slot)
struct controller *ctrl = slot->ctrl;
int ret;

mutex_lock(&slot->hotplug_lock);
ret = __pciehp_enable_slot(slot);
mutex_unlock(&slot->hotplug_lock);

if (ret && ATTN_BUTTN(ctrl))
pciehp_green_led_off(slot); /* may be blinking */

Expand All @@ -330,9 +324,6 @@ int pciehp_enable_slot(struct slot *slot)
return ret;
}

/*
* Note: This function must be called with slot->hotplug_lock held
*/
static int __pciehp_disable_slot(struct slot *p_slot)
{
u8 getstatus = 0;
Expand All @@ -355,9 +346,7 @@ int pciehp_disable_slot(struct slot *slot)
{
int ret;

mutex_lock(&slot->hotplug_lock);
ret = __pciehp_disable_slot(slot);
mutex_unlock(&slot->hotplug_lock);

mutex_lock(&slot->lock);
slot->state = OFF_STATE;
Expand Down
1 change: 0 additions & 1 deletion drivers/pci/hotplug/pciehp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,6 @@ static int pcie_init_slot(struct controller *ctrl)

slot->ctrl = ctrl;
mutex_init(&slot->lock);
mutex_init(&slot->hotplug_lock);
INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
ctrl->slot = slot;
return 0;
Expand Down

0 comments on commit 1656716

Please sign in to comment.