]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
coresight: Add a helper to check if a device is source
authorTao Zhang <quic_taozha@quicinc.com>
Fri, 13 Dec 2024 10:07:29 +0000 (18:07 +0800)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Fri, 13 Dec 2024 10:25:14 +0000 (10:25 +0000)
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 <quic_taozha@quicinc.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20241213100731.25914-3-quic_taozha@quicinc.com
drivers/hwtracing/coresight/coresight-tpda.c
include/linux/coresight.h

index 4ec676bea1ceadabe6ca6cf3da8548e2f232062f..ab94067c0ed326ea7eff9c0f6ab871f5439b3d15 100644 (file)
@@ -24,7 +24,7 @@ DEFINE_CORESIGHT_DEVLIST(tpda_devs, "tpda");
 
 static bool coresight_device_is_tpdm(struct coresight_device *csdev)
 {
-       return (csdev->type == CORESIGHT_DEV_TYPE_SOURCE) &&
+       return (coresight_is_device_source(csdev)) &&
               (csdev->subtype.source_subtype ==
                        CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM);
 }
index 055ce5cd5c4443f760a2948ca5ef662453d33248..c50d128e8d9387f11f0607180bcf38da72c69700 100644 (file)
@@ -588,9 +588,14 @@ static inline void csdev_access_write64(struct csdev_access *csa, u64 val, u32 o
 }
 #endif /* CONFIG_64BIT */
 
+static inline bool coresight_is_device_source(struct coresight_device *csdev)
+{
+       return csdev && (csdev->type == CORESIGHT_DEV_TYPE_SOURCE);
+}
+
 static inline bool coresight_is_percpu_source(struct coresight_device *csdev)
 {
-       return csdev && (csdev->type == CORESIGHT_DEV_TYPE_SOURCE) &&
+       return csdev && coresight_is_device_source(csdev) &&
               (csdev->subtype.source_subtype == CORESIGHT_DEV_SUBTYPE_SOURCE_PROC);
 }