diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-09-24 07:30:44 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-09-24 07:30:44 -0400 |
commit | 721b50ee48ab65cea30c940951145afc11f3e362 (patch) | |
tree | a450a4d52f439512f76122d3f2756dc1cdac7757 /drivers/acpi | |
parent | 59f3b797c50ad078cde59050cd1a7c4cb8e5a8e5 (diff) | |
parent | ed953472d181e1d149f17d85d82de9634db296c3 (diff) |
Merge branch 'pm-cpuidle'
* pm-cpuidle:
cpuidle: rename function name "__cpuidle_register_driver", v2
cpuidle: remove some empty lines
cpuidle / ACPI : move cpuidle_device field out of the acpi_processor_power structure
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/processor_idle.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index c46a44a8c860..3655ab923812 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -79,6 +79,8 @@ module_param(bm_check_disable, uint, 0000); | |||
79 | static unsigned int latency_factor __read_mostly = 2; | 79 | static unsigned int latency_factor __read_mostly = 2; |
80 | module_param(latency_factor, uint, 0644); | 80 | module_param(latency_factor, uint, 0644); |
81 | 81 | ||
82 | static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); | ||
83 | |||
82 | static int disabled_by_idle_boot_param(void) | 84 | static int disabled_by_idle_boot_param(void) |
83 | { | 85 | { |
84 | return boot_option_idle_override == IDLE_POLL || | 86 | return boot_option_idle_override == IDLE_POLL || |
@@ -998,7 +1000,7 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr) | |||
998 | int i, count = CPUIDLE_DRIVER_STATE_START; | 1000 | int i, count = CPUIDLE_DRIVER_STATE_START; |
999 | struct acpi_processor_cx *cx; | 1001 | struct acpi_processor_cx *cx; |
1000 | struct cpuidle_state_usage *state_usage; | 1002 | struct cpuidle_state_usage *state_usage; |
1001 | struct cpuidle_device *dev = &pr->power.dev; | 1003 | struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); |
1002 | 1004 | ||
1003 | if (!pr->flags.power_setup_done) | 1005 | if (!pr->flags.power_setup_done) |
1004 | return -EINVAL; | 1006 | return -EINVAL; |
@@ -1130,6 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) | |||
1130 | int acpi_processor_hotplug(struct acpi_processor *pr) | 1132 | int acpi_processor_hotplug(struct acpi_processor *pr) |
1131 | { | 1133 | { |
1132 | int ret = 0; | 1134 | int ret = 0; |
1135 | struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); | ||
1133 | 1136 | ||
1134 | if (disabled_by_idle_boot_param()) | 1137 | if (disabled_by_idle_boot_param()) |
1135 | return 0; | 1138 | return 0; |
@@ -1145,11 +1148,11 @@ int acpi_processor_hotplug(struct acpi_processor *pr) | |||
1145 | return -ENODEV; | 1148 | return -ENODEV; |
1146 | 1149 | ||
1147 | cpuidle_pause_and_lock(); | 1150 | cpuidle_pause_and_lock(); |
1148 | cpuidle_disable_device(&pr->power.dev); | 1151 | cpuidle_disable_device(dev); |
1149 | acpi_processor_get_power_info(pr); | 1152 | acpi_processor_get_power_info(pr); |
1150 | if (pr->flags.power) { | 1153 | if (pr->flags.power) { |
1151 | acpi_processor_setup_cpuidle_cx(pr); | 1154 | acpi_processor_setup_cpuidle_cx(pr); |
1152 | ret = cpuidle_enable_device(&pr->power.dev); | 1155 | ret = cpuidle_enable_device(dev); |
1153 | } | 1156 | } |
1154 | cpuidle_resume_and_unlock(); | 1157 | cpuidle_resume_and_unlock(); |
1155 | 1158 | ||
@@ -1160,6 +1163,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1160 | { | 1163 | { |
1161 | int cpu; | 1164 | int cpu; |
1162 | struct acpi_processor *_pr; | 1165 | struct acpi_processor *_pr; |
1166 | struct cpuidle_device *dev; | ||
1163 | 1167 | ||
1164 | if (disabled_by_idle_boot_param()) | 1168 | if (disabled_by_idle_boot_param()) |
1165 | return 0; | 1169 | return 0; |
@@ -1190,7 +1194,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1190 | _pr = per_cpu(processors, cpu); | 1194 | _pr = per_cpu(processors, cpu); |
1191 | if (!_pr || !_pr->flags.power_setup_done) | 1195 | if (!_pr || !_pr->flags.power_setup_done) |
1192 | continue; | 1196 | continue; |
1193 | cpuidle_disable_device(&_pr->power.dev); | 1197 | dev = per_cpu(acpi_cpuidle_device, cpu); |
1198 | cpuidle_disable_device(dev); | ||
1194 | } | 1199 | } |
1195 | 1200 | ||
1196 | /* Populate Updated C-state information */ | 1201 | /* Populate Updated C-state information */ |
@@ -1204,7 +1209,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1204 | acpi_processor_get_power_info(_pr); | 1209 | acpi_processor_get_power_info(_pr); |
1205 | if (_pr->flags.power) { | 1210 | if (_pr->flags.power) { |
1206 | acpi_processor_setup_cpuidle_cx(_pr); | 1211 | acpi_processor_setup_cpuidle_cx(_pr); |
1207 | cpuidle_enable_device(&_pr->power.dev); | 1212 | dev = per_cpu(acpi_cpuidle_device, cpu); |
1213 | cpuidle_enable_device(dev); | ||
1208 | } | 1214 | } |
1209 | } | 1215 | } |
1210 | put_online_cpus(); | 1216 | put_online_cpus(); |
@@ -1220,6 +1226,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) | |||
1220 | { | 1226 | { |
1221 | acpi_status status = 0; | 1227 | acpi_status status = 0; |
1222 | int retval; | 1228 | int retval; |
1229 | struct cpuidle_device *dev; | ||
1223 | static int first_run; | 1230 | static int first_run; |
1224 | 1231 | ||
1225 | if (disabled_by_idle_boot_param()) | 1232 | if (disabled_by_idle_boot_param()) |
@@ -1265,11 +1272,18 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) | |||
1265 | printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", | 1272 | printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", |
1266 | acpi_idle_driver.name); | 1273 | acpi_idle_driver.name); |
1267 | } | 1274 | } |
1275 | |||
1276 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
1277 | if (!dev) | ||
1278 | return -ENOMEM; | ||
1279 | per_cpu(acpi_cpuidle_device, pr->id) = dev; | ||
1280 | |||
1281 | acpi_processor_setup_cpuidle_cx(pr); | ||
1282 | |||
1268 | /* Register per-cpu cpuidle_device. Cpuidle driver | 1283 | /* Register per-cpu cpuidle_device. Cpuidle driver |
1269 | * must already be registered before registering device | 1284 | * must already be registered before registering device |
1270 | */ | 1285 | */ |
1271 | acpi_processor_setup_cpuidle_cx(pr); | 1286 | retval = cpuidle_register_device(dev); |
1272 | retval = cpuidle_register_device(&pr->power.dev); | ||
1273 | if (retval) { | 1287 | if (retval) { |
1274 | if (acpi_processor_registered == 0) | 1288 | if (acpi_processor_registered == 0) |
1275 | cpuidle_unregister_driver(&acpi_idle_driver); | 1289 | cpuidle_unregister_driver(&acpi_idle_driver); |
@@ -1282,11 +1296,13 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) | |||
1282 | 1296 | ||
1283 | int acpi_processor_power_exit(struct acpi_processor *pr) | 1297 | int acpi_processor_power_exit(struct acpi_processor *pr) |
1284 | { | 1298 | { |
1299 | struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); | ||
1300 | |||
1285 | if (disabled_by_idle_boot_param()) | 1301 | if (disabled_by_idle_boot_param()) |
1286 | return 0; | 1302 | return 0; |
1287 | 1303 | ||
1288 | if (pr->flags.power) { | 1304 | if (pr->flags.power) { |
1289 | cpuidle_unregister_device(&pr->power.dev); | 1305 | cpuidle_unregister_device(dev); |
1290 | acpi_processor_registered--; | 1306 | acpi_processor_registered--; |
1291 | if (acpi_processor_registered == 0) | 1307 | if (acpi_processor_registered == 0) |
1292 | cpuidle_unregister_driver(&acpi_idle_driver); | 1308 | cpuidle_unregister_driver(&acpi_idle_driver); |