]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/pf: Simplify IS_SRIOV_PF macro
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 28 Jan 2026 22:27:13 +0000 (23:27 +0100)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Mon, 2 Feb 2026 21:22:57 +0000 (22:22 +0100)
Instead of two having variants of the IS_SRIOV_PF macro, move the
CONFIG_PCI_IOV check to the xe_device_is_sriov_pf() function and
let the compiler optimize that. This will help us drop poor man's
type check of the macro parameter that fails on const xe pointer.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Link: https://patch.msgid.link/20260128222714.3056-1-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_sriov.h

index 6db45df556158ad76404e03ec0119188b93e0d4b..72e55543c30e4c287b687a003dc3ec8e7959cc23 100644 (file)
@@ -28,7 +28,8 @@ static inline enum xe_sriov_mode xe_device_sriov_mode(const struct xe_device *xe
 
 static inline bool xe_device_is_sriov_pf(const struct xe_device *xe)
 {
-       return xe_device_sriov_mode(xe) == XE_SRIOV_MODE_PF;
+       return IS_ENABLED(CONFIG_PCI_IOV) &&
+               xe_device_sriov_mode(xe) == XE_SRIOV_MODE_PF;
 }
 
 static inline bool xe_device_is_sriov_vf(const struct xe_device *xe)
@@ -36,11 +37,7 @@ static inline bool xe_device_is_sriov_vf(const struct xe_device *xe)
        return xe_device_sriov_mode(xe) == XE_SRIOV_MODE_VF;
 }
 
-#ifdef CONFIG_PCI_IOV
 #define IS_SRIOV_PF(xe) xe_device_is_sriov_pf(xe)
-#else
-#define IS_SRIOV_PF(xe) (typecheck(struct xe_device *, (xe)) && false)
-#endif
 #define IS_SRIOV_VF(xe) xe_device_is_sriov_vf(xe)
 
 #define IS_SRIOV(xe) (IS_SRIOV_PF(xe) || IS_SRIOV_VF(xe))