[PATCH v10 4/7] qcom-tgu: Add TGU decode support
Konrad Dybcio
konrad.dybcio at oss.qualcomm.com
Tue Jan 27 02:31:49 PST 2026
On 1/27/26 3:34 AM, Songwei Chai wrote:
>
>
> On 1/13/2026 7:13 PM, Konrad Dybcio wrote:
>> On 1/9/26 3:11 AM, Songwei Chai wrote:
>>> Decoding is when all the potential pieces for creating a trigger
>>> are brought together for a given step. Example - there may be a
>>> counter keeping track of some occurrences and a priority-group that
>>> is being used to detect a pattern on the sense inputs. These 2
>>> inputs to condition_decode must be programmed, for a given step,
>>> to establish the condition for the trigger, or movement to another
>>> steps.
>>>
>>> Signed-off-by: Songwei Chai <songwei.chai at oss.qualcomm.com>
>>> ---
[...]
>>> + switch (operation_index) {
>>> + case TGU_PRIORITY0:
>>> + case TGU_PRIORITY1:
>>> + case TGU_PRIORITY2:
>>> + case TGU_PRIORITY3:
>>> + ret = operation_index * (drvdata->max_step) *
>>> + (drvdata->max_reg) +
>>> + step_index * (drvdata->max_reg) + reg_index;
>>> + break;
>>> + case TGU_CONDITION_DECODE:
>>> + ret = step_index * (drvdata->max_condition_decode) +
>>> + reg_index;
>>> + break;
>>> + default:
>>> + break;
>>> + }
>>> + return ret;
>>
>> The only thing your switch statement is assign a value to ret and break
>> out. Change that to a direct return, and drop 'ret' altogether
>>
>
> I kept a single return intentionally so the function has a single exit
> point. This makes it easier to extend with common post-processing or
> debug logic later if needed.
>
> That said, I’m fine switching to direct returns if you prefer the simpler style here.
It's up to you. Do you expect you'll need more debugging or extending
of this function in near future?
Konrad
More information about the linux-arm-kernel
mailing list