mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
scsi: libsas: Add dev_parent_is_expander() helper
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>
This commit is contained in:
committed by
Martin K. Petersen
parent
251be2f603
commit
e5eb72c92e
@@ -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