Skip to content

Commit

Permalink
Merge tag 'acpi-4.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
 "Two fixes for problems introduced recently (ACPICA and the ACPI
  backlight driver) and one fix for an older issue that prevents at
  least one system from booting.

  Specifics:

   - Fix an incorrect check introduced by recent ACPICA changes which
     causes problems with booting KVM guests to happen, among other
     things (Lv Zheng).

   - Fix a backlight issue introduced by recent changes to the ACPI
     video driver (Aaron Lu).

   - Fix the ACPI processor initialization which attempts to register an
     IO region without checking if that really is necessary and
     sometimes prevents drivers loaded subsequently from registering
     their resources which leads to boot issues (Rafael Wysocki)"

* tag 'acpi-4.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / processor: Avoid reserving IO regions too early
  ACPICA / Hardware: Fix old register check in acpi_hw_get_access_bit_width()
  ACPI / Thermal / video: fix max_level incorrect value
  • Loading branch information
torvalds committed Jun 4, 2016
2 parents 5016320 + 60c07f8 commit eb10a7b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
9 changes: 0 additions & 9 deletions drivers/acpi/acpi_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
pr->throttling.duty_width = acpi_gbl_FADT.duty_width;

pr->pblk = object.processor.pblk_address;

/*
* We don't care about error returns - we just try to mark
* these reserved so that nobody else is confused into thinking
* that this region might be unused..
*
* (In particular, allocating the IO range for Cardbus)
*/
request_region(pr->throttling.address, 6, "ACPI CPU throttle");
}

/*
Expand Down
9 changes: 6 additions & 3 deletions drivers/acpi/acpi_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,8 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,
}

int acpi_video_get_levels(struct acpi_device *device,
struct acpi_video_device_brightness **dev_br)
struct acpi_video_device_brightness **dev_br,
int *pmax_level)
{
union acpi_object *obj = NULL;
int i, max_level = 0, count = 0, level_ac_battery = 0;
Expand Down Expand Up @@ -841,6 +842,8 @@ int acpi_video_get_levels(struct acpi_device *device,

br->count = count;
*dev_br = br;
if (pmax_level)
*pmax_level = max_level;

out:
kfree(obj);
Expand Down Expand Up @@ -869,7 +872,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
struct acpi_video_device_brightness *br = NULL;
int result = -EINVAL;

result = acpi_video_get_levels(device->dev, &br);
result = acpi_video_get_levels(device->dev, &br, &max_level);
if (result)
return result;
device->brightness = br;
Expand Down Expand Up @@ -1737,7 +1740,7 @@ static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video)

mutex_lock(&video->device_list_lock);
list_for_each_entry(dev, &video->video_device_list, entry) {
if (!acpi_video_device_lcd_query_levels(dev, &levels))
if (!acpi_video_device_lcd_query_levels(dev->dev->handle, &levels))
kfree(levels);
}
mutex_unlock(&video->device_list_lock);
Expand Down
23 changes: 9 additions & 14 deletions drivers/acpi/acpica/hwregs.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,27 +83,22 @@ acpi_hw_write_multiple(u32 value,
static u8
acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)
{
u64 address;

if (!reg->access_width) {
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
max_bit_width = 32;
}

/*
* Detect old register descriptors where only the bit_width field
* makes senses. The target address is copied to handle possible
* alignment issues.
* makes senses.
*/
ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!reg->bit_offset && reg->bit_width &&
if (reg->bit_width < max_bit_width &&
!reg->bit_offset && reg->bit_width &&
ACPI_IS_POWER_OF_TWO(reg->bit_width) &&
ACPI_IS_ALIGNED(reg->bit_width, 8) &&
ACPI_IS_ALIGNED(address, reg->bit_width)) {
ACPI_IS_ALIGNED(reg->bit_width, 8)) {
return (reg->bit_width);
} else {
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
return (32);
} else {
return (max_bit_width);
}
}
return (max_bit_width);
} else {
return (1 << (reg->access_width + 2));
}
Expand Down
9 changes: 9 additions & 0 deletions drivers/acpi/processor_throttling.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,15 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
if (!pr->flags.throttling)
return -ENODEV;

/*
* We don't care about error returns - we just try to mark
* these reserved so that nobody else is confused into thinking
* that this region might be unused..
*
* (In particular, allocating the IO range for Cardbus)
*/
request_region(pr->throttling.address, 6, "ACPI CPU throttle");

pr->throttling.state = 0;

duty_mask = pr->throttling.state_count - 1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/int340x_thermal/int3406_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static int int3406_thermal_probe(struct platform_device *pdev)
return -ENODEV;
d->raw_bd = bd;

ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br);
ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br, NULL);
if (ret)
return ret;

Expand Down
6 changes: 4 additions & 2 deletions include/acpi/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
*/
extern bool acpi_video_handles_brightness_key_presses(void);
extern int acpi_video_get_levels(struct acpi_device *device,
struct acpi_video_device_brightness **dev_br);
struct acpi_video_device_brightness **dev_br,
int *pmax_level);
#else
static inline int acpi_video_register(void) { return 0; }
static inline void acpi_video_unregister(void) { return; }
Expand All @@ -72,7 +73,8 @@ static inline bool acpi_video_handles_brightness_key_presses(void)
return false;
}
static inline int acpi_video_get_levels(struct acpi_device *device,
struct acpi_video_device_brightness **dev_br)
struct acpi_video_device_brightness **dev_br,
int *pmax_level)
{
return -ENODEV;
}
Expand Down

0 comments on commit eb10a7b

Please sign in to comment.