Re: [PATCH v3 08/14] isci: kill iphy->isci_port lookups

Dan Williams
2012-01-23T23:45:13Z

On Thu, Jan 5, 2012 at 4:59 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> This field is a holdover from the OS abstraction conversion.  The stable
> phy to port lookups are done via iphy->ownining_port under scic_lock.
> After this conversion to use port->lldd_port the only volatile lookup is
> the initial lookup in isci_port_formed().  After that point any lookup
> via a successfully notified domain_device is guaranteed to be valid
> until the domain_device is destroyed.
>
> Delete ->start_complete as it is only set once and is set as a
> consequence of the port going link up, by definition of getting a port
> formed event the port is "ready".
>
> While we are correcting port lookups also move the asd_sas_port table
> out from under the isci_port.  This is to preclude any temptation to use
> container_of() to convert an asd_sas_port to an isci_port, the
> association is dynamic and under libsas control.
>
> Tested-by: Maciej Trela <maciej.trela@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
[..]
> @@ -1714,24 +1721,55 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor
>        return ret;
>  }
>
> -/**
> - * isci_port_deformed() - This function is called by libsas when a port becomes
> - *    inactive.
> - * @phy: This parameter specifies the libsas phy with the inactive port.
> - *
> - */
>  void isci_port_deformed(struct asd_sas_phy *phy)
>  {
> -       pr_debug("%s: sas_phy = %p\n", __func__, phy);
> +       struct isci_host *ihost = phy->ha->lldd_ha;
> +       struct isci_port *iport = phy->port->lldd_port;
> +       unsigned long flags;
> +       int i;
> +
> +       /* we got a port notification on a port that was subsequently
> +        * torn down and libsas is just now catching up
> +        */
> +       if (!iport)
> +               return;
> +
> +       spin_lock_irqsave(&ihost->scic_lock, flags);
> +       for (i = 0; i < SCI_MAX_PHYS; i++) {
> +               if (iport->active_phy_mask & 1 << i)
> +                       break;
> +       }
> +       spin_unlock_irqrestore(&ihost->scic_lock, flags);
> +
> +       if (i >= SCI_MAX_PHYS)
> +               dev_dbg(&ihost->pdev->dev, "%s: port: %ld\n",
> +                       __func__, iport - &ihost->ports[0]);
>  }

As spotted by David this causes 32-bit build breakage. I'll fold in
the fix, rebase, and re-post for the next round of libsas fixups.

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