From patchwork Thu Jul 12 21:03:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1190601 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 22B3C40B20 for ; Thu, 12 Jul 2012 21:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934006Ab2GLVD4 (ORCPT ); Thu, 12 Jul 2012 17:03:56 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:40466 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933922Ab2GLVDx (ORCPT ); Thu, 12 Jul 2012 17:03:53 -0400 Received: by weyx8 with SMTP id x8so2012396wey.19 for ; Thu, 12 Jul 2012 14:03:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=A3VcP8HsiIbLgPVe151SY+Eju+s0wbEJFAmF8dMVyvY=; b=eRJF8296Jlv7n8LZF5AENYzjhmzoKmXEdWGiB6ZURzlG3Baujp4vmwbvu4EWiUu6q4 Dyg/ZkYuGRwOsD8Hd+HDms8CHzspwkQBfA7ZreUA1uFoNDQguQ3hNLL+2loRm93p3zUS +jz7F0DKDYrITS95ztQvBgnWPDisbw+HUbcjGvDx/VVQkQZlb52PvQwn+C1RXcICO8TB eoYbQFYca8FSG/zDmyTHf71nPhfqVbgwWIfDUBUqH4cMvD2seBvIcVRdzWecW2HI2Ll7 1iESltG7/zvkU3p/l4PJy6Jhr0FhXNc+fagOpvWFkNwY9GGBvMVuCw95NevaBqcApHCb RetA== Received: by 10.180.107.2 with SMTP id gy2mr39559861wib.2.1342127031891; Thu, 12 Jul 2012 14:03:51 -0700 (PDT) Received: from localhost.localdomain (AToulouse-651-1-167-180.w90-11.abo.wanadoo.fr. [90.11.50.180]) by mx.google.com with ESMTPS id fb20sm1239619wid.1.2012.07.12.14.03.50 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Jul 2012 14:03:51 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl, lenb@kernel.org Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH 2/5] acpi : remove index from acpi_processor_cx structure Date: Thu, 12 Jul 2012 23:03:43 +0200 Message-Id: <1342127026-1526-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1342127026-1526-1-git-send-email-daniel.lezcano@linaro.org> References: <1342127026-1526-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQlIRYWEhoy72jvl12JQHy21tsbpOxtsFpA4ZMsT0xQBMQfA+CrGHoKjnlI9vbOtiXLcxi0j Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Remove the index field. It could be given without adding extra information in the cx structure. Signed-off-by: Daniel Lezcano --- arch/x86/kernel/acpi/cstate.c | 18 +++++++++--------- drivers/acpi/processor_idle.c | 15 +++++++-------- include/acpi/processor.h | 11 +++++------ 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index d2b7f27..faa7f50 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c @@ -112,8 +112,8 @@ out: return retval; } -int acpi_processor_ffh_cstate_probe(unsigned int cpu, - struct acpi_processor_cx *cx, struct acpi_power_register *reg) +int acpi_processor_ffh_cstate_probe(unsigned int cpu, struct acpi_processor_cx *cx, + int index, struct acpi_power_register *reg) { struct cstate_entry *percpu_entry; struct cpuinfo_x86 *c = &cpu_data(cpu); @@ -126,16 +126,16 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, return -1; percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu); - percpu_entry->states[cx->index].eax = 0; - percpu_entry->states[cx->index].ecx = 0; + percpu_entry->states[index].eax = 0; + percpu_entry->states[index].ecx = 0; /* Make sure we are running on right CPU */ retval = work_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx); if (retval == 0) { /* Use the hint in CST */ - percpu_entry->states[cx->index].eax = cx->address; - percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK; + percpu_entry->states[index].eax = cx->address; + percpu_entry->states[index].ecx = MWAIT_ECX_INTERRUPT_BREAK; } /* @@ -173,14 +173,14 @@ void mwait_idle_with_hints(unsigned long ax, unsigned long cx) } } -void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx) +void acpi_processor_ffh_cstate_enter(int index) { unsigned int cpu = smp_processor_id(); struct cstate_entry *percpu_entry; percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu); - mwait_idle_with_hints(percpu_entry->states[cx->index].eax, - percpu_entry->states[cx->index].ecx); + mwait_idle_with_hints(percpu_entry->states[index].eax, + percpu_entry->states[index].ecx); } EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_enter); diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index da92c65..9808e60 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -433,12 +433,11 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) current_count++; cx.address = reg->address; - cx.index = current_count + 1; cx.entry_method = ACPI_CSTATE_SYSTEMIO; if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) { - if (acpi_processor_ffh_cstate_probe - (pr->id, &cx, reg) == 0) { + if (acpi_processor_ffh_cstate_probe( + pr->id, &cx, current_count + 1, reg) == 0) { cx.entry_method = ACPI_CSTATE_FFH; } else if (cx.type == ACPI_STATE_C1) { /* @@ -707,13 +706,13 @@ static int acpi_idle_bm_check(void) * * Caller disables interrupt before call and enables interrupt after return. */ -static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx) +static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx, int index) { /* Don't trace irqs off for idle */ stop_critical_timings(); if (cx->entry_method == ACPI_CSTATE_FFH) { /* Call into architectural FFH based C-state */ - acpi_processor_ffh_cstate_enter(cx); + acpi_processor_ffh_cstate_enter(index); } else if (cx->entry_method == ACPI_CSTATE_HALT) { acpi_safe_halt(); } else { @@ -754,7 +753,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, lapic_timer_state_broadcast(pr, cx, 1); kt1 = ktime_get_real(); - acpi_idle_do_entry(cx); + acpi_idle_do_entry(cx, index); kt2 = ktime_get_real(); idle_time = ktime_to_us(ktime_sub(kt2, kt1)); @@ -848,7 +847,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, kt1 = ktime_get_real(); /* Tell the scheduler that we are going deep-idle: */ sched_clock_idle_sleep_event(); - acpi_idle_do_entry(cx); + acpi_idle_do_entry(cx, index); kt2 = ktime_get_real(); idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1)); idle_time = idle_time_ns; @@ -960,7 +959,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, ACPI_FLUSH_CPU_CACHE(); } - acpi_idle_do_entry(cx); + acpi_idle_do_entry(cx, index); /* Re-enable bus master arbitration */ if (pr->flags.bm_check && pr->flags.bm_control) { diff --git a/include/acpi/processor.h b/include/acpi/processor.h index a70cbcc..d09c94f 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -57,7 +57,6 @@ struct acpi_processor_cx { u8 type; u32 address; u8 entry_method; - u8 index; u32 latency; u32 power; u32 usage; @@ -249,8 +248,9 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, unsigned int cpu); int acpi_processor_ffh_cstate_probe(unsigned int cpu, struct acpi_processor_cx *cx, + int index, struct acpi_power_register *reg); -void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate); +void acpi_processor_ffh_cstate_enter(int index); #else static inline void acpi_processor_power_init_bm_check(struct acpi_processor_flags @@ -261,13 +261,12 @@ static inline void acpi_processor_power_init_bm_check(struct } static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu, struct acpi_processor_cx *cx, - struct acpi_power_register - *reg) + int index, + struct acpi_power_register *reg) { return -1; } -static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx - *cstate) +static inline void acpi_processor_ffh_cstate_enter(int index) { return; }