scsi: libsas: Add dev_parent_is_expander() helper
[ Upstream commit e5eb72c92eb724aa14c50c7d92d1a576dd50d7e6 ] Many libsas drivers check if the parent of the device is an expander. Create a helper that the libsas drivers will use in follow up commits. Suggested-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Niklas Cassel <cassel@kernel.org> Link: https://lore.kernel.org/r/20250814173215.1765055-15-cassel@kernel.org Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Stable-dep-of: ad70c6bc776b ("scsi: pm80xx: Fix pm8001_abort_task() for chip_8006 when using an expander") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
83ced3c206
commit
7a2719b122
@@ -1313,10 +1313,7 @@ static int sas_check_parent_topology(struct domain_device *child)
|
||||
int i;
|
||||
int res = 0;
|
||||
|
||||
if (!child->parent)
|
||||
return 0;
|
||||
|
||||
if (!dev_is_expander(child->parent->dev_type))
|
||||
if (!dev_parent_is_expander(child))
|
||||
return 0;
|
||||
|
||||
parent_ex = &child->parent->ex_dev;
|
||||
|
||||
@@ -203,6 +203,14 @@ static inline bool dev_is_expander(enum sas_device_type type)
|
||||
type == SAS_FANOUT_EXPANDER_DEVICE;
|
||||
}
|
||||
|
||||
static inline bool dev_parent_is_expander(struct domain_device *dev)
|
||||
{
|
||||
if (!dev->parent)
|
||||
return false;
|
||||
|
||||
return dev_is_expander(dev->parent->dev_type);
|
||||
}
|
||||
|
||||
static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *))
|
||||
{
|
||||
INIT_WORK(&sw->work, fn);
|
||||
|
||||
Reference in New Issue
Block a user