From patchwork Fri Jan 7 10:29:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 463251 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p07AVeIJ029064 for ; Fri, 7 Jan 2011 10:31:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752089Ab1AGKan (ORCPT ); Fri, 7 Jan 2011 05:30:43 -0500 Received: from cantor2.suse.de ([195.135.220.15]:38780 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579Ab1AGKaL (ORCPT ); Fri, 7 Jan 2011 05:30:11 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id ACEEB86391; Fri, 7 Jan 2011 11:30:06 +0100 (CET) From: Thomas Renninger Cc: linux-perf-users@vger.kernel.org, mingo@elte.hu, arjan@linux.intel.com, lenb@kernel.org, j-pihet@ti.com, Thomas Renninger , linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org, Frederic Weisbecker , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states Date: Fri, 7 Jan 2011 11:29:45 +0100 Message-Id: <1294396190-23031-5-git-send-email-trenn@suse.de> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1294396190-23031-1-git-send-email-trenn@suse.de> References: <1294396190-23031-1-git-send-email-trenn@suse.de> To: unlisted-recipients:; (no To-header on input) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 07 Jan 2011 10:31:41 +0000 (UTC) diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c index 1cfeac1..6cdeb42 100644 --- a/arch/arm/mach-at91/cpuidle.c +++ b/arch/arm/mach-at91/cpuidle.c @@ -73,16 +73,20 @@ static int at91_init_cpuidle(void) device->states[0].exit_latency = 1; device->states[0].target_residency = 10000; device->states[0].flags = CPUIDLE_FLAG_TIME_VALID; - strcpy(device->states[0].name, "WFI"); - strcpy(device->states[0].desc, "Wait for interrupt"); + snprintf(device->states[0].name, CPUIDLE_NAME_LEN, "WFI"); + snprintf(device->states[0].desc, CPUIDLE_DESC_LEN, + "Wait for interrupt"); + snprintf(device->states[0].abbr, CPUIDLE_ABBR_LEN, "W"); /* Wait for interrupt and RAM self refresh state */ device->states[1].enter = at91_enter_idle; device->states[1].exit_latency = 10; device->states[1].target_residency = 10000; device->states[1].flags = CPUIDLE_FLAG_TIME_VALID; - strcpy(device->states[1].name, "RAM_SR"); - strcpy(device->states[1].desc, "WFI and RAM Self Refresh"); + snprintf(device->states[1].name, CPUIDLE_NAME_LEN, "RAM SR"); + snprintf(device->states[1].desc, CPUIDLE_DESC_LEN, + "WFI and RAM Self Refresh"); + snprintf(device->states[1].abbr, CPUIDLE_ABBR_LEN, "WSR"); if (cpuidle_register_device(device)) { printk(KERN_ERR "at91_init_cpuidle: Failed registering\n"); diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c index bd59f31..42ad2d6 100644 --- a/arch/arm/mach-davinci/cpuidle.c +++ b/arch/arm/mach-davinci/cpuidle.c @@ -127,16 +127,21 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev) device->states[0].exit_latency = 1; device->states[0].target_residency = 10000; device->states[0].flags = CPUIDLE_FLAG_TIME_VALID; - strcpy(device->states[0].name, "WFI"); - strcpy(device->states[0].desc, "Wait for interrupt"); + snprintf(device->states[0].name, CPUIDLE_NAME_LEN, "WFI"); + snprintf(device->states[0].desc, CPUIDLE_DESC_LEN, + "Wait for interrupt"); + snprintf(device->states[0].abbr, CPUIDLE_ABBR_LEN, "W"); /* Wait for interrupt and DDR self refresh state */ device->states[1].enter = davinci_enter_idle; device->states[1].exit_latency = 10; device->states[1].target_residency = 10000; device->states[1].flags = CPUIDLE_FLAG_TIME_VALID; - strcpy(device->states[1].name, "DDR SR"); - strcpy(device->states[1].desc, "WFI and DDR Self Refresh"); + snprintf(device->states[1].name, CPUIDLE_NAME_LEN, "RAM SR"); + snprintf(device->states[1].desc, CPUIDLE_DESC_LEN, + "WFI and RAM Self Refresh"); + snprintf(device->states[1].abbr, CPUIDLE_ABBR_LEN, "WSR"); + if (pdata->ddr2_pdown) davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN; cpuidle_set_statedata(&device->states[1], &davinci_states[1]); diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c index f68d33f..48eaabb 100644 --- a/arch/arm/mach-kirkwood/cpuidle.c +++ b/arch/arm/mach-kirkwood/cpuidle.c @@ -75,16 +75,20 @@ static int kirkwood_init_cpuidle(void) device->states[0].exit_latency = 1; device->states[0].target_residency = 10000; device->states[0].flags = CPUIDLE_FLAG_TIME_VALID; - strcpy(device->states[0].name, "WFI"); - strcpy(device->states[0].desc, "Wait for interrupt"); + snprintf(device->states[0].name, CPUIDLE_NAME_LEN, "WFI"); + snprintf(device->states[0].desc, CPUIDLE_DESC_LEN, + "Wait for interrupt"); + snprintf(device->states[0].abbr, CPUIDLE_ABBR_LEN, "W"); /* Wait for interrupt and DDR self refresh state */ device->states[1].enter = kirkwood_enter_idle; device->states[1].exit_latency = 10; device->states[1].target_residency = 10000; device->states[1].flags = CPUIDLE_FLAG_TIME_VALID; - strcpy(device->states[1].name, "DDR SR"); - strcpy(device->states[1].desc, "WFI and DDR Self Refresh"); + snprintf(device->states[1].name, CPUIDLE_NAME_LEN, "RAM SR"); + snprintf(device->states[1].desc, CPUIDLE_DESC_LEN, + "WFI and RAM Self Refresh"); + snprintf(device->states[1].abbr, CPUIDLE_ABBR_LEN, "WSR"); if (cpuidle_register_device(device)) { printk(KERN_ERR "kirkwood_init_cpuidle: Failed registering\n"); diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index 0d50b45..a59ac39 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c @@ -496,7 +496,8 @@ int __init omap3_idle_init(void) omap3_enter_idle_bm : omap3_enter_idle; if (cx->type == OMAP3_STATE_C1) dev->safe_state = state; - sprintf(state->name, "C%d", count+1); + snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", count+1); + snprintf(state->abbr, CPUIDLE_ABBR_LEN, "C%d", count+1); count++; } diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c index 83972aa..9ad151d 100644 --- a/arch/sh/kernel/cpu/shmobile/cpuidle.c +++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c @@ -75,8 +75,9 @@ void sh_mobile_setup_cpuidle(void) i = CPUIDLE_DRIVER_STATE_START; state = &dev->states[i++]; - snprintf(state->name, CPUIDLE_NAME_LEN, "C0"); - strncpy(state->desc, "SuperH Sleep Mode", CPUIDLE_DESC_LEN); + snprintf(state->name, CPUIDLE_NAME_LEN, "SuperH"); + snprintf(state->desc, CPUIDLE_DESC_LEN, "SuperH Sleep Mode"); + snprintf(state->abbr, CPUIDLE_ABBR_LEN, "SH"); state->exit_latency = 1; state->target_residency = 1 * 2; state->power_usage = 3; @@ -89,9 +90,10 @@ void sh_mobile_setup_cpuidle(void) if (sh_mobile_sleep_supported & SUSP_SH_SF) { state = &dev->states[i++]; - snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); - strncpy(state->desc, "SuperH Sleep Mode [SF]", - CPUIDLE_DESC_LEN); + snprintf(state->name, CPUIDLE_NAME_LEN, "SuperH [SF]"); + snprintf(state->desc, CPUIDLE_DESC_LEN, + "SuperH Sleep Mode [SF]"); + snprintf(state->abbr, CPUIDLE_ABBR_LEN, "SHF"); state->exit_latency = 100; state->target_residency = 1 * 2; state->power_usage = 1; @@ -102,9 +104,10 @@ void sh_mobile_setup_cpuidle(void) if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) { state = &dev->states[i++]; - snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); - strncpy(state->desc, "SuperH Mobile Standby Mode [SF]", - CPUIDLE_DESC_LEN); + snprintf(state->name, CPUIDLE_NAME_LEN, "SuperH Standby [SF]"); + snprintf(state->desc, CPUIDLE_DESC_LEN, + "SuperH Mobile Standby Mode [SF]"); + snprintf(state->abbr, CPUIDLE_ABBR_LEN, "SHS"); state->exit_latency = 2300; state->target_residency = 1 * 2; state->power_usage = 1; diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 104ae77..b28693e 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1016,6 +1016,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) switch (cx->type) { case ACPI_STATE_C1: snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); + snprintf(state->abbr, CPUIDLE_ABBR_LEN, "C1"); state->flags |= CPUIDLE_FLAG_SHALLOW; if (cx->entry_method == ACPI_CSTATE_FFH) state->flags |= CPUIDLE_FLAG_TIME_VALID; @@ -1026,6 +1027,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) case ACPI_STATE_C2: snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); + snprintf(state->abbr, CPUIDLE_ABBR_LEN, "C2"); state->flags |= CPUIDLE_FLAG_BALANCED; state->flags |= CPUIDLE_FLAG_TIME_VALID; state->enter = acpi_idle_enter_simple; @@ -1034,6 +1036,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) case ACPI_STATE_C3: snprintf(state->name, CPUIDLE_NAME_LEN, "C3"); + snprintf(state->abbr, CPUIDLE_ABBR_LEN, "C3"); state->flags |= CPUIDLE_FLAG_DEEP; state->flags |= CPUIDLE_FLAG_TIME_VALID; state->flags |= CPUIDLE_FLAG_CHECK_BM; diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 4649495..b2d2b69 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -268,6 +268,7 @@ static void poll_idle_init(struct cpuidle_device *dev) snprintf(state->name, CPUIDLE_NAME_LEN, "POLL"); snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE"); + snprintf(state->abbr, CPUIDLE_ABBR_LEN, "P"); state->exit_latency = 0; state->target_residency = 0; state->power_usage = -1; diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c index 0310ffa..ca7a62c 100644 --- a/drivers/cpuidle/sysfs.c +++ b/drivers/cpuidle/sysfs.c @@ -249,9 +249,11 @@ define_show_state_ull_function(usage) define_show_state_ull_function(time) define_show_state_str_function(name) define_show_state_str_function(desc) +define_show_state_str_function(abbr) define_one_state_ro(name, show_state_name); define_one_state_ro(desc, show_state_desc); +define_one_state_ro(abbr, show_state_abbr); define_one_state_ro(latency, show_state_exit_latency); define_one_state_ro(power, show_state_power_usage); define_one_state_ro(usage, show_state_usage); @@ -260,6 +262,7 @@ define_one_state_ro(time, show_state_time); static struct attribute *cpuidle_state_default_attrs[] = { &attr_name.attr, &attr_desc.attr, + &attr_abbr.attr, &attr_latency.attr, &attr_power.attr, &attr_usage.attr, diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 60fa6ec..3bb1f2b 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -91,6 +91,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C1 */ .name = "NHM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 3, @@ -99,6 +100,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C2 */ .name = "NHM-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 20, @@ -107,6 +109,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C3 */ .name = "NHM-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 200, @@ -119,6 +122,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C1 */ .name = "SNB-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1, @@ -127,6 +131,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C2 */ .name = "SNB-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 80, @@ -135,6 +140,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C3 */ .name = "SNB-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 104, @@ -143,6 +149,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C4 */ .name = "SNB-C7", .desc = "MWAIT 0x30", + .abbr = "C7", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 109, @@ -155,6 +162,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C1 */ .name = "ATM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1, @@ -163,6 +171,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C2 */ .name = "ATM-C2", .desc = "MWAIT 0x10", + .abbr = "C2", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 20, @@ -172,6 +181,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C4 */ .name = "ATM-C4", .desc = "MWAIT 0x30", + .abbr = "C4", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 100, @@ -181,6 +191,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C6 */ .name = "ATM-C6", .desc = "MWAIT 0x52", + .abbr = "C6", .driver_data = (void *) 0x52, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 140, diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 1be416b..4763ef3 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -20,6 +20,7 @@ #define CPUIDLE_STATE_MAX 8 #define CPUIDLE_NAME_LEN 16 #define CPUIDLE_DESC_LEN 32 +#define CPUIDLE_ABBR_LEN 3 struct cpuidle_device; @@ -31,6 +32,7 @@ struct cpuidle_device; struct cpuidle_state { char name[CPUIDLE_NAME_LEN]; char desc[CPUIDLE_DESC_LEN]; + char abbr[CPUIDLE_ABBR_LEN]; void *driver_data; unsigned int flags;