From: John Garry <john.garry@huawei.com>
To: Jason Yan <yanaijie@huawei.com>, <martin.petersen@oracle.com>,
<jejb@linux.ibm.com>
Cc: <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<hare@suse.com>, <hch@lst.de>, <bvanassche@acm.org>,
<jinpu.wang@cloud.ionos.com>
Subject: Re: [PATCH 6/7] scsi: pm8001: use dev_and_phy_addr_same() instead of open coded
Date: Fri, 23 Sep 2022 11:30:49 +0100 [thread overview]
Message-ID: <569cb47c-af63-cf70-ae1a-4c5116dd4877@huawei.com> (raw)
In-Reply-To: <d3c7285f-6318-8254-2bfa-d836f12fcd88@huawei.com>
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
next prev parent reply other threads:[~2022-09-23 10:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-17 10:43 [PATCH 0/7] scsi: libsas: sas address comparation refactor Jason Yan
2022-09-17 10:43 ` [PATCH 1/7] scsi: libsas: introduce sas address conversion and comparation helpers Jason Yan
2022-09-22 14:14 ` John Garry
2022-09-17 10:43 ` [PATCH 2/7] scsi: libsas: use dev_and_phy_addr_same() instead of open coded Jason Yan
2022-09-17 10:43 ` [PATCH 3/7] scsi: libsas: use ex_phy_addr_same() " Jason Yan
2022-09-17 10:43 ` [PATCH 4/7] scsi: libsas: use port_and_phy_addr_same() " Jason Yan
2022-09-17 10:43 ` [PATCH 5/7] scsi: hisi_sas: use dev_and_phy_addr_same() " Jason Yan
2022-09-17 10:43 ` [PATCH 6/7] scsi: pm8001: " Jason Yan
2022-09-22 14:24 ` John Garry
2022-09-23 1:55 ` Jason Yan
2022-09-23 9:44 ` Jason Yan
2022-09-23 10:00 ` John Garry
2022-09-23 10:10 ` Jason Yan
2022-09-23 10:13 ` Jason Yan
2022-09-23 10:30 ` John Garry [this message]
2022-09-24 3:22 ` Jason Yan
2022-09-17 10:43 ` [PATCH 7/7] scsi: mvsas: " Jason Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=569cb47c-af63-cf70-ae1a-4c5116dd4877@huawei.com \
--to=john.garry@huawei.com \
--cc=bvanassche@acm.org \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=jejb@linux.ibm.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=yanaijie@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®