From a7cdc47c78a5716a0bbbd1a70a89adde52be145c Mon Sep 17 00:00:00 2001 From: Bojun Pan Date: Mon, 9 Sep 2019 16:36:51 -0700 Subject: [PATCH] msm: ipa: add the version check for FnR stats ioctl Add version check for FnR stats ioctl and error return, since only IPA4.5+ HW will support this feature. Change-Id: If5c5021d16bc1ee6af516d9e2200c3e6b5081d27 Signed-off-by: Bojun Pan --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 84a61a7184f5..ea4e9b1b220e 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -2668,10 +2668,22 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; case IPA_IOC_FNR_COUNTER_ALLOC: + if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { + IPAERR("FNR stats not supported on IPA ver %d", + ipa3_ctx->ipa_hw_type); + retval = -EFAULT; + break; + } retval = ipa3_ioctl_fnr_counter_alloc(arg); break; case IPA_IOC_FNR_COUNTER_DEALLOC: + if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { + IPAERR("FNR stats not supported on IPA ver %d", + ipa3_ctx->ipa_hw_type); + retval = -EFAULT; + break; + } hdl = (int)arg; if (hdl < 0) { IPAERR("IPA_FNR_COUNTER_DEALLOC failed: hdl %d\n", @@ -2683,10 +2695,22 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; case IPA_IOC_FNR_COUNTER_QUERY: + if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { + IPAERR("FNR stats not supported on IPA ver %d", + ipa3_ctx->ipa_hw_type); + retval = -EFAULT; + break; + } retval = ipa3_ioctl_fnr_counter_query(arg); break; case IPA_IOC_SET_FNR_COUNTER_INFO: + if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { + IPAERR("FNR stats not supported on IPA ver %d", + ipa3_ctx->ipa_hw_type); + retval = -EFAULT; + break; + } retval = ipa3_ioctl_fnr_counter_set(arg); break;