summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNiklas Cassel <cassel@kernel.org>2025-08-14 20:32:18 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2025-08-19 05:08:30 +0300
commite5eb72c92eb724aa14c50c7d92d1a576dd50d7e6 (patch)
tree124feabad950c724972a11ca5d2f3b0867cad2f1 /include
parent251be2f6037fb7ab399f68cd7428ff274133d693 (diff)
downloadlinux-e5eb72c92eb724aa14c50c7d92d1a576dd50d7e6.tar.xz
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>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/libsas.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index ba460b6c0374..8d38565e99fa 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -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);