Commit 773792e4 authored by Jason Yan's avatar Jason Yan Committed by Martin K. Petersen

scsi: libsas: Introduce SAS address comparison helpers

SAS address comparison is widely used in libsas. However they are all
opencoded and to avoid the line spill over 80 columns, are mostly split
into multi-lines. Introduce some helpers to prepare for some refactoring.
Signed-off-by: default avatarJason Yan <yanaijie@huawei.com>
Link: https://lore.kernel.org/r/20220928070130.3657183-2-yanaijie@huawei.comReviewed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f93ed747
......@@ -115,6 +115,23 @@ static inline void sas_smp_host_handler(struct bsg_job *job,
}
#endif
static inline bool sas_phy_match_dev_addr(struct domain_device *dev,
struct ex_phy *phy)
{
return SAS_ADDR(dev->sas_addr) == SAS_ADDR(phy->attached_sas_addr);
}
static inline bool sas_phy_match_port_addr(struct asd_sas_port *port,
struct ex_phy *phy)
{
return SAS_ADDR(port->sas_addr) == SAS_ADDR(phy->attached_sas_addr);
}
static inline bool sas_phy_addr_match(struct ex_phy *p1, struct ex_phy *p2)
{
return SAS_ADDR(p1->attached_sas_addr) == SAS_ADDR(p2->attached_sas_addr);
}
static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err)
{
pr_warn("%s: for %s device %016llx returned %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment