From: Xiang Chen chenxiang66@hisilicon.com
For spinlock sas_ha->phy_port_lock, some places use spin_lock_irq() / spin_unlock_irq() and other places use spin_lock_irqsave() / spin_unlock_irqrestore(). Actually all those places are called in process context (workqueue), so use spin_lock/unlock() instead.
Signed-off-by: Xiang Chen chenxiang66@hisilicon.com --- drivers/scsi/libsas/sas_ata.c | 4 ++-- drivers/scsi/libsas/sas_discover.c | 4 ++-- drivers/scsi/libsas/sas_port.c | 12 +++++------- drivers/scsi/libsas/sas_scsi_host.c | 10 ++++------ 4 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 6bd00f3809c0..937fc3d72611 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -774,7 +774,7 @@ void sas_ata_strategy_handler(struct Scsi_Host *shost) */ sas_disable_revalidation(sas_ha);
- spin_lock_irq(&sas_ha->phy_port_lock); + spin_lock(&sas_ha->phy_port_lock); for (i = 0; i < sas_ha->num_phys; i++) { struct asd_sas_port *port = sas_ha->sas_port[i]; struct domain_device *dev; @@ -794,7 +794,7 @@ void sas_ata_strategy_handler(struct Scsi_Host *shost) } spin_unlock(&port->dev_list_lock); } - spin_unlock_irq(&sas_ha->phy_port_lock); + spin_unlock(&sas_ha->phy_port_lock);
async_synchronize_full_domain(&async);
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 7773b0e59877..db1e1cfbdd94 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -407,12 +407,12 @@ void sas_device_set_phy(struct domain_device *dev, struct sas_port *port) new_phy = sas_port_get_phy(port);
/* pin and record last seen phy */ - spin_lock_irq(&ha->phy_port_lock); + spin_lock(&ha->phy_port_lock); if (new_phy) { sas_port_put_phy(dev->phy); dev->phy = new_phy; } - spin_unlock_irq(&ha->phy_port_lock); + spin_unlock(&ha->phy_port_lock); }
/* ---------- Discovery and Revalidation ---------- */ diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index 67b429dcf1ff..dc17674034a3 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c @@ -82,7 +82,6 @@ static void sas_form_port(struct asd_sas_phy *phy) struct domain_device *port_dev; struct sas_internal *si = to_sas_internal(sas_ha->core.shost->transportt); - unsigned long flags;
if (port) { if (!phy_is_wideport_member(port, phy)) @@ -103,7 +102,7 @@ static void sas_form_port(struct asd_sas_phy *phy) }
/* see if the phy should be part of a wide port */ - spin_lock_irqsave(&sas_ha->phy_port_lock, flags); + spin_lock(&sas_ha->phy_port_lock); for (i = 0; i < sas_ha->num_phys; i++) { port = sas_ha->sas_port[i]; spin_lock(&port->phy_list_lock); @@ -133,7 +132,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
if (i >= sas_ha->num_phys) { pr_err("%s: couldn't find a free port, bug?\n", __func__); - spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); + spin_unlock(&sas_ha->phy_port_lock); return; }
@@ -156,7 +155,7 @@ static void sas_form_port(struct asd_sas_phy *phy) } else port->linkrate = max(port->linkrate, phy->linkrate); spin_unlock(&port->phy_list_lock); - spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); + spin_unlock(&sas_ha->phy_port_lock);
if (!port->port) { port->port = sas_port_alloc(phy->phy->dev.parent, port->id); @@ -203,7 +202,6 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) struct sas_internal *si = to_sas_internal(sas_ha->core.shost->transportt); struct domain_device *dev; - unsigned long flags;
if (!port) return; /* done by a phy event */ @@ -225,7 +223,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) if (si->dft->lldd_port_deformed) si->dft->lldd_port_deformed(phy);
- spin_lock_irqsave(&sas_ha->phy_port_lock, flags); + spin_lock(&sas_ha->phy_port_lock); spin_lock(&port->phy_list_lock);
list_del_init(&phy->port_phy_el); @@ -245,7 +243,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) port->phy_mask = 0; } spin_unlock(&port->phy_list_lock); - spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); + spin_unlock(&sas_ha->phy_port_lock);
/* Only insert revalidate event if the port still has members */ if (port->port && dev && dev_is_expander(dev->dev_type)) { diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index d337fdf1b9ca..7e135ad91cdc 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -371,17 +371,16 @@ struct sas_phy *sas_get_local_phy(struct domain_device *dev) { struct sas_ha_struct *ha = dev->port->ha; struct sas_phy *phy; - unsigned long flags;
/* a published domain device always has a valid phy, it may be * stale, but it is never NULL */ BUG_ON(!dev->phy);
- spin_lock_irqsave(&ha->phy_port_lock, flags); + spin_lock(&ha->phy_port_lock); phy = dev->phy; get_device(&phy->dev); - spin_unlock_irqrestore(&ha->phy_port_lock, flags); + spin_unlock(&ha->phy_port_lock);
return phy; } @@ -801,9 +800,8 @@ struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy) struct sas_ha_struct *ha = SHOST_TO_SAS_HA(shost); struct domain_device *found_dev = NULL; int i; - unsigned long flags;
- spin_lock_irqsave(&ha->phy_port_lock, flags); + spin_lock(&ha->phy_port_lock); for (i = 0; i < ha->num_phys; i++) { struct asd_sas_port *port = ha->sas_port[i]; struct domain_device *dev; @@ -819,7 +817,7 @@ struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy) spin_unlock(&port->dev_list_lock); } found: - spin_unlock_irqrestore(&ha->phy_port_lock, flags); + spin_unlock(&ha->phy_port_lock);
return found_dev; }