Skip to content

Commit eba682a

Browse files
bzolnierrafaeljw
authored andcommitted
intel_idle: shrink states tables
There is no reason to define CPUIDLE_STATE_MAX (currently 10) entries in states tables if the driver always stops iterating over table when it encounters first .enter == NULL entry. $ size drivers/idle/intel_idle.o.* text data bss dec hex filename 2886 5440 32 8358 20a6 drivers/idle/intel_idle.o.before 2886 3752 32 6670 1a0e drivers/idle/intel_idle.o.after Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Acked-by: Daniel Lezcano <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 4a10c2a commit eba682a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/idle/intel_idle.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static struct cpuidle_state *cpuidle_state_table;
123123
* which is also the index into the MWAIT hint array.
124124
* Thus C0 is a dummy.
125125
*/
126-
static struct cpuidle_state nehalem_cstates[CPUIDLE_STATE_MAX] = {
126+
static struct cpuidle_state nehalem_cstates[] = {
127127
{
128128
.name = "C1-NHM",
129129
.desc = "MWAIT 0x00",
@@ -156,7 +156,7 @@ static struct cpuidle_state nehalem_cstates[CPUIDLE_STATE_MAX] = {
156156
.enter = NULL }
157157
};
158158

159-
static struct cpuidle_state snb_cstates[CPUIDLE_STATE_MAX] = {
159+
static struct cpuidle_state snb_cstates[] = {
160160
{
161161
.name = "C1-SNB",
162162
.desc = "MWAIT 0x00",
@@ -196,7 +196,7 @@ static struct cpuidle_state snb_cstates[CPUIDLE_STATE_MAX] = {
196196
.enter = NULL }
197197
};
198198

199-
static struct cpuidle_state ivb_cstates[CPUIDLE_STATE_MAX] = {
199+
static struct cpuidle_state ivb_cstates[] = {
200200
{
201201
.name = "C1-IVB",
202202
.desc = "MWAIT 0x00",
@@ -236,7 +236,7 @@ static struct cpuidle_state ivb_cstates[CPUIDLE_STATE_MAX] = {
236236
.enter = NULL }
237237
};
238238

239-
static struct cpuidle_state hsw_cstates[CPUIDLE_STATE_MAX] = {
239+
static struct cpuidle_state hsw_cstates[] = {
240240
{
241241
.name = "C1-HSW",
242242
.desc = "MWAIT 0x00",
@@ -297,7 +297,7 @@ static struct cpuidle_state hsw_cstates[CPUIDLE_STATE_MAX] = {
297297
.enter = NULL }
298298
};
299299

300-
static struct cpuidle_state atom_cstates[CPUIDLE_STATE_MAX] = {
300+
static struct cpuidle_state atom_cstates[] = {
301301
{
302302
.name = "C1E-ATM",
303303
.desc = "MWAIT 0x00",
@@ -628,7 +628,7 @@ static int intel_idle_cpu_init(int cpu)
628628
int num_substates, mwait_hint, mwait_cstate, mwait_substate;
629629

630630
if (cpuidle_state_table[cstate].enter == NULL)
631-
continue;
631+
break;
632632

633633
if (cstate + 1 > max_cstate) {
634634
printk(PREFIX "max_cstate %d reached\n", max_cstate);

0 commit comments

Comments
 (0)