intel_idle: clean up intel_idle_init_cstates_icpu()
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thu, 20 Apr 2023 06:47:18 +0000 (09:47 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 27 Apr 2023 17:37:36 +0000 (19:37 +0200)
commita78032e94bf16e9c53238cd83c82095b4a251d4b
treee13e00543484fcee9919e245d61e36c4f9e7d2cd
parent91048ce4227868000bfe624707e42274ef2198aa
intel_idle: clean up intel_idle_init_cstates_icpu()

The intel_idle_init_cstates_icpu() function includes a loop that iterates
over every C-state. Inside the loop, the same C-state data is referenced 2
ways:
 1. as cpuidle_state_table[cstate]
 2. as drv->states[drv->state_count] (but it is a copy of #1, not the same
    object).

Make the code be more consistent and easier to read by using only the 2nd
way. So the code structure would be as follows:

 1. Use cpuidle_state_table[cstate]
 2. Copy cpuidle_state_table[cstate] to drv->states[drv->state_count]
 3. Use only drv->states[drv->state_count] from this point.

Note, this change introduces a checkpatch.pl warning (too long line), but it
will be addressed in the next patch.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/idle/intel_idle.c