Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull ACPI and Power Management changes from Len Brown.

This does an evil merge to fix up what I think is a mismerge by Len to
the gma500 driver, and restore it to the mainline state.

In that driver, both branches had commented out the call to
acpi_video_register(), and Len resolved the merge to that commented-out
version.

However, in mainline, further changes by Alan (commit d839ede47a:
"gma500: opregion and ACPI" to be exact) had re-enabled the ACPI video
registration, so the current state of the driver seems to want it.

Alan is apparently still feeling the effects of partying with the Queen,
so he didn't reply to my query, but I'll do the evil merge anyway.

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  ACPI: fix acpi_bus.h build warnings when ACPI is not enabled
  drivers: acpi: Fix dependency for ACPI_HOTPLUG_CPU
  tools/power turbostat: fix IVB support
  tools/power turbostat: fix un-intended affinity of forked program
  ACPI video: use after input_unregister_device()
  gma500: don't register the ACPI video bus
  acpi_video: Intel video is not always i915
  acpi_video: fix leaking PCI references
  ACPI: Ignore invalid _PSS entries, but use valid ones
  ACPI battery: only refresh the sysfs files when pertinent information changes
This commit is contained in:
Linus Torvalds 2012-06-06 10:47:15 -07:00
commit ff39d0e8f0
6 changed files with 87 additions and 22 deletions

View File

@ -208,7 +208,7 @@ config ACPI_IPMI
config ACPI_HOTPLUG_CPU
bool
depends on ACPI_PROCESSOR && HOTPLUG_CPU
depends on EXPERIMENTAL && ACPI_PROCESSOR && HOTPLUG_CPU
select ACPI_CONTAINER
default y

View File

@ -643,11 +643,19 @@ static int acpi_battery_update(struct acpi_battery *battery)
static void acpi_battery_refresh(struct acpi_battery *battery)
{
int power_unit;
if (!battery->bat.dev)
return;
power_unit = battery->power_unit;
acpi_battery_get_info(battery);
/* The battery may have changed its reporting units. */
if (power_unit == battery->power_unit)
return;
/* The battery has changed its reporting units. */
sysfs_remove_battery(battery);
sysfs_add_battery(battery);
}

View File

@ -333,6 +333,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
struct acpi_buffer state = { 0, NULL };
union acpi_object *pss = NULL;
int i;
int last_invalid = -1;
status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
@ -394,14 +395,33 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
((u32)(px->core_frequency * 1000) !=
(px->core_frequency * 1000))) {
printk(KERN_ERR FW_BUG PREFIX
"Invalid BIOS _PSS frequency: 0x%llx MHz\n",
px->core_frequency);
"Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n",
pr->id, px->core_frequency);
if (last_invalid == -1)
last_invalid = i;
} else {
if (last_invalid != -1) {
/*
* Copy this valid entry over last_invalid entry
*/
memcpy(&(pr->performance->states[last_invalid]),
px, sizeof(struct acpi_processor_px));
++last_invalid;
}
}
}
if (last_invalid == 0) {
printk(KERN_ERR FW_BUG PREFIX
"No valid BIOS _PSS frequency found for processor %d\n", pr->id);
result = -EFAULT;
kfree(pr->performance->states);
goto end;
}
pr->performance->states = NULL;
}
if (last_invalid > 0)
pr->performance->state_count = last_invalid;
end:
kfree(buffer.pointer);

View File

@ -1687,10 +1687,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
set_bit(KEY_DISPLAY_OFF, input->keybit);
error = input_register_device(input);
if (error)
goto err_stop_video;
printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n",
ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
video->flags.multihead ? "yes" : "no",
@ -1701,12 +1697,16 @@ static int acpi_video_bus_add(struct acpi_device *device)
video->pm_nb.priority = 0;
error = register_pm_notifier(&video->pm_nb);
if (error)
goto err_unregister_input_dev;
goto err_stop_video;
error = input_register_device(input);
if (error)
goto err_unregister_pm_notifier;
return 0;
err_unregister_input_dev:
input_unregister_device(input);
err_unregister_pm_notifier:
unregister_pm_notifier(&video->pm_nb);
err_stop_video:
acpi_video_bus_stop_devices(video);
err_free_input_dev:
@ -1743,9 +1743,18 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
return 0;
}
static int __init is_i740(struct pci_dev *dev)
{
if (dev->device == 0x00D1)
return 1;
if (dev->device == 0x7000)
return 1;
return 0;
}
static int __init intel_opregion_present(void)
{
#if defined(CONFIG_DRM_I915) || defined(CONFIG_DRM_I915_MODULE)
int opregion = 0;
struct pci_dev *dev = NULL;
u32 address;
@ -1754,13 +1763,15 @@ static int __init intel_opregion_present(void)
continue;
if (dev->vendor != PCI_VENDOR_ID_INTEL)
continue;
/* We don't want to poke around undefined i740 registers */
if (is_i740(dev))
continue;
pci_read_config_dword(dev, 0xfc, &address);
if (!address)
continue;
return 1;
opregion = 1;
}
#endif
return 0;
return opregion;
}
int acpi_video_register(void)

View File

@ -440,8 +440,8 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
#else /* CONFIG_ACPI */
static int register_acpi_bus_type(struct acpi_bus_type *bus) { return 0; }
static int unregister_acpi_bus_type(struct acpi_bus_type *bus) { return 0; }
static inline int register_acpi_bus_type(void *bus) { return 0; }
static inline int unregister_acpi_bus_type(void *bus) { return 0; }
#endif /* CONFIG_ACPI */

View File

@ -73,8 +73,8 @@ int backwards_count;
char *progname;
int num_cpus;
cpu_set_t *cpu_mask;
size_t cpu_mask_size;
cpu_set_t *cpu_present_set, *cpu_mask;
size_t cpu_present_setsize, cpu_mask_size;
struct counters {
unsigned long long tsc; /* per thread */
@ -103,6 +103,12 @@ struct timeval tv_even;
struct timeval tv_odd;
struct timeval tv_delta;
int mark_cpu_present(int pkg, int core, int cpu)
{
CPU_SET_S(cpu, cpu_present_setsize, cpu_present_set);
return 0;
}
/*
* cpu_mask_init(ncpus)
*
@ -118,6 +124,18 @@ void cpu_mask_init(int ncpus)
}
cpu_mask_size = CPU_ALLOC_SIZE(ncpus);
CPU_ZERO_S(cpu_mask_size, cpu_mask);
/*
* Allocate and initialize cpu_present_set
*/
cpu_present_set = CPU_ALLOC(ncpus);
if (cpu_present_set == NULL) {
perror("CPU_ALLOC");
exit(3);
}
cpu_present_setsize = CPU_ALLOC_SIZE(ncpus);
CPU_ZERO_S(cpu_present_setsize, cpu_present_set);
for_all_cpus(mark_cpu_present);
}
void cpu_mask_uninit()
@ -125,6 +143,9 @@ void cpu_mask_uninit()
CPU_FREE(cpu_mask);
cpu_mask = NULL;
cpu_mask_size = 0;
CPU_FREE(cpu_present_set);
cpu_present_set = NULL;
cpu_present_setsize = 0;
}
int cpu_migrate(int cpu)
@ -912,6 +933,8 @@ int is_snb(unsigned int family, unsigned int model)
switch (model) {
case 0x2A:
case 0x2D:
case 0x3A: /* IVB */
case 0x3D: /* IVB Xeon */
return 1;
}
return 0;
@ -1047,6 +1070,9 @@ int fork_it(char **argv)
int retval;
pid_t child_pid;
get_counters(cnt_even);
/* clear affinity side-effect of get_counters() */
sched_setaffinity(0, cpu_present_setsize, cpu_present_set);
gettimeofday(&tv_even, (struct timezone *)NULL);
child_pid = fork();