On Sun, Jan 8, 2012 at 5:57 PM, Jack Wang [off-list ref] wrote:
quoted
+int isci_ata_check_ready(struct domain_device *dev)
+{
+ struct isci_port *iport = dev->port->lldd_port;
+ struct isci_host *ihost = dev_to_ihost(dev);
+ struct isci_remote_device *idev;
+ unsigned long flags;
+ int rc = 0;
+
+ spin_lock_irqsave(&ihost->scic_lock, flags);
+ idev = isci_lookup_device(dev);
+ spin_unlock_irqrestore(&ihost->scic_lock, flags);
+
+ if (!idev)
+ goto out;
+
+ if (test_bit(IPORT_RESET_PENDING, &iport->state))
+ goto out;
+
+ /* snapshot active phy mask */
+ spin_lock_irqsave(&ihost->scic_lock, flags);
+ rc = !!iport->active_phy_mask;
[Jack Wang]
Hi Dan,
Could you explain why here you not directly use "
rc = !!iport->active_phy_mask;
You are right, it can look at the field outside the lock... and since
we have already taken the lock to get a device reference we know we
have flushed any recent port events.
--
Dan