Skip to content

Commit 637bf74

Browse files
Kuppuswamy Sathyanarayananrafaeljw
authored andcommitted
powercap: intel_rapl: Simplify rapl_compute_time_window_atom()
Restructure to use early return for to_raw case, eliminating redundant assignments and clarifying conversion paths. No functional changes. Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://patch.msgid.link/20260212233044.329790-5-sathyanarayanan.kuppuswamy@linux.intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent c64e89b commit 637bf74

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

drivers/powercap/intel_rapl_common.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,16 +1145,14 @@ static u64 rapl_compute_time_window_core(struct rapl_domain *rd, u64 value,
11451145
static u64 rapl_compute_time_window_atom(struct rapl_domain *rd, u64 value,
11461146
bool to_raw)
11471147
{
1148+
if (to_raw)
1149+
return div64_u64(value, rd->time_unit);
1150+
11481151
/*
11491152
* Atom time unit encoding is straight forward val * time_unit,
11501153
* where time_unit is default to 1 sec. Never 0.
11511154
*/
1152-
if (!to_raw)
1153-
return (value) ? value * rd->time_unit : rd->time_unit;
1154-
1155-
value = div64_u64(value, rd->time_unit);
1156-
1157-
return value;
1155+
return (value) ? value * rd->time_unit : rd->time_unit;
11581156
}
11591157

11601158
static int rapl_check_unit_tpmi(struct rapl_domain *rd)

0 commit comments

Comments
 (0)