Skip to content

Commit 62374ce

Browse files
Tao ZhangSuzuki K Poulose
authored andcommitted
coresight: Add a helper to check if a device is source
Since there are a lot of places in the code to check whether the device is source, add a helper to check it. Signed-off-by: Tao Zhang <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2a0bc21 commit 62374ce

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

drivers/hwtracing/coresight/coresight-tpda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ DEFINE_CORESIGHT_DEVLIST(tpda_devs, "tpda");
2424

2525
static bool coresight_device_is_tpdm(struct coresight_device *csdev)
2626
{
27-
return (csdev->type == CORESIGHT_DEV_TYPE_SOURCE) &&
27+
return (coresight_is_device_source(csdev)) &&
2828
(csdev->subtype.source_subtype ==
2929
CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM);
3030
}

include/linux/coresight.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,14 @@ static inline void csdev_access_write64(struct csdev_access *csa, u64 val, u32 o
588588
}
589589
#endif /* CONFIG_64BIT */
590590

591+
static inline bool coresight_is_device_source(struct coresight_device *csdev)
592+
{
593+
return csdev && (csdev->type == CORESIGHT_DEV_TYPE_SOURCE);
594+
}
595+
591596
static inline bool coresight_is_percpu_source(struct coresight_device *csdev)
592597
{
593-
return csdev && (csdev->type == CORESIGHT_DEV_TYPE_SOURCE) &&
598+
return csdev && coresight_is_device_source(csdev) &&
594599
(csdev->subtype.source_subtype == CORESIGHT_DEV_SUBTYPE_SOURCE_PROC);
595600
}
596601

0 commit comments

Comments
 (0)