Skip to content

Commit eb10a7b

Browse files
committed
Merge tag 'acpi-4.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/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
2 parents 5016320 + 60c07f8 commit eb10a7b

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

drivers/acpi/acpi_processor.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
331331
pr->throttling.duty_width = acpi_gbl_FADT.duty_width;
332332

333333
pr->pblk = object.processor.pblk_address;
334-
335-
/*
336-
* We don't care about error returns - we just try to mark
337-
* these reserved so that nobody else is confused into thinking
338-
* that this region might be unused..
339-
*
340-
* (In particular, allocating the IO range for Cardbus)
341-
*/
342-
request_region(pr->throttling.address, 6, "ACPI CPU throttle");
343334
}
344335

345336
/*

drivers/acpi/acpi_video.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,
754754
}
755755

756756
int acpi_video_get_levels(struct acpi_device *device,
757-
struct acpi_video_device_brightness **dev_br)
757+
struct acpi_video_device_brightness **dev_br,
758+
int *pmax_level)
758759
{
759760
union acpi_object *obj = NULL;
760761
int i, max_level = 0, count = 0, level_ac_battery = 0;
@@ -841,6 +842,8 @@ int acpi_video_get_levels(struct acpi_device *device,
841842

842843
br->count = count;
843844
*dev_br = br;
845+
if (pmax_level)
846+
*pmax_level = max_level;
844847

845848
out:
846849
kfree(obj);
@@ -869,7 +872,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
869872
struct acpi_video_device_brightness *br = NULL;
870873
int result = -EINVAL;
871874

872-
result = acpi_video_get_levels(device->dev, &br);
875+
result = acpi_video_get_levels(device->dev, &br, &max_level);
873876
if (result)
874877
return result;
875878
device->brightness = br;
@@ -1737,7 +1740,7 @@ static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video)
17371740

17381741
mutex_lock(&video->device_list_lock);
17391742
list_for_each_entry(dev, &video->video_device_list, entry) {
1740-
if (!acpi_video_device_lcd_query_levels(dev, &levels))
1743+
if (!acpi_video_device_lcd_query_levels(dev->dev->handle, &levels))
17411744
kfree(levels);
17421745
}
17431746
mutex_unlock(&video->device_list_lock);

drivers/acpi/acpica/hwregs.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,22 @@ acpi_hw_write_multiple(u32 value,
8383
static u8
8484
acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)
8585
{
86-
u64 address;
87-
8886
if (!reg->access_width) {
87+
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
88+
max_bit_width = 32;
89+
}
90+
8991
/*
9092
* Detect old register descriptors where only the bit_width field
91-
* makes senses. The target address is copied to handle possible
92-
* alignment issues.
93+
* makes senses.
9394
*/
94-
ACPI_MOVE_64_TO_64(&address, &reg->address);
95-
if (!reg->bit_offset && reg->bit_width &&
95+
if (reg->bit_width < max_bit_width &&
96+
!reg->bit_offset && reg->bit_width &&
9697
ACPI_IS_POWER_OF_TWO(reg->bit_width) &&
97-
ACPI_IS_ALIGNED(reg->bit_width, 8) &&
98-
ACPI_IS_ALIGNED(address, reg->bit_width)) {
98+
ACPI_IS_ALIGNED(reg->bit_width, 8)) {
9999
return (reg->bit_width);
100-
} else {
101-
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
102-
return (32);
103-
} else {
104-
return (max_bit_width);
105-
}
106100
}
101+
return (max_bit_width);
107102
} else {
108103
return (1 << (reg->access_width + 2));
109104
}

drivers/acpi/processor_throttling.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,15 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
676676
if (!pr->flags.throttling)
677677
return -ENODEV;
678678

679+
/*
680+
* We don't care about error returns - we just try to mark
681+
* these reserved so that nobody else is confused into thinking
682+
* that this region might be unused..
683+
*
684+
* (In particular, allocating the IO range for Cardbus)
685+
*/
686+
request_region(pr->throttling.address, 6, "ACPI CPU throttle");
687+
679688
pr->throttling.state = 0;
680689

681690
duty_mask = pr->throttling.state_count - 1;

drivers/thermal/int340x_thermal/int3406_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static int int3406_thermal_probe(struct platform_device *pdev)
177177
return -ENODEV;
178178
d->raw_bd = bd;
179179

180-
ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br);
180+
ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br, NULL);
181181
if (ret)
182182
return ret;
183183

include/acpi/video.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
5151
*/
5252
extern bool acpi_video_handles_brightness_key_presses(void);
5353
extern int acpi_video_get_levels(struct acpi_device *device,
54-
struct acpi_video_device_brightness **dev_br);
54+
struct acpi_video_device_brightness **dev_br,
55+
int *pmax_level);
5556
#else
5657
static inline int acpi_video_register(void) { return 0; }
5758
static inline void acpi_video_unregister(void) { return; }
@@ -72,7 +73,8 @@ static inline bool acpi_video_handles_brightness_key_presses(void)
7273
return false;
7374
}
7475
static inline int acpi_video_get_levels(struct acpi_device *device,
75-
struct acpi_video_device_brightness **dev_br)
76+
struct acpi_video_device_brightness **dev_br,
77+
int *pmax_level)
7678
{
7779
return -ENODEV;
7880
}

0 commit comments

Comments
 (0)