Re: [PATCH 6/7] scsi: pm8001: use dev_and_phy_addr_same() instead of open coded

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

 



On 23/09/2022 11:13, Jason Yan wrote:

Please explain why.

I would assume that if those helpers were only used in libsas code (and not LLDDs) then they could be put in sas_internal.h and no need for export



Sorry, I did not make it clear. I mean we need to export sas_find_attathed_phy() below. Not the sas address comparation helpers.

That seems fine to me.

About sas_find_attathed_phy() implementation,

> +static inline int sas_find_attathed_phy(struct expander_device *ex_dev,
> +                                       struct domain_device *dev)
> +{
> +       struct ex_phy *phy;
> +       int phy_id;
> +
> +       for (phy_id = 0; phy_id < ex_dev->num_phys; phy_id++) {
> +               phy = &ex_dev->ex_phy[phy_id];
> +               if (SAS_ADDR(phy->attached_sas_addr)
> +                       == SAS_ADDR(dev->sas_addr))
> +                       return phy_id;
> +       }
> +
> +       return ex_dev->num_phys;

Returning ex_dev->num_phys would seem ok, but then the LLDD needs to check that return against ex_dev->num_phys. It seems ok, but I'm still not 100% comfortable with that. Maybe returning -ENODEV may be better.

Or return boolean and pass phy_id as pointer to be filled in when returning true.

> +}

Thanks,
John




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux