Skip to content

Commit ce474ae

Browse files
committed
Merge tag 'acpi-6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "This fixes a recently introduced build issue on ARM32 and a NULL pointer dereference in the ACPI backlight driver due to a design issue exposed by a recent change in the ACPI bus type code. Specifics: - Fix a recently introduced build issue on ARM32 platforms caused by an inadvertent header file breakage (Dave Jiang) - Eliminate questionable usage of acpi_driver_data() in the ACPI backlight cooling device code that leads to NULL pointer dereferences after recent ACPI core changes (Hans de Goede)" * tag 'acpi-6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: video: Use acpi_video_device for cooling-dev driver data ACPI: Fix ARM32 platforms compile issue introduced by fw_table changes
2 parents 35f8458 + 7d4c44a commit ce474ae

File tree

4 files changed

+17
-24
lines changed

4 files changed

+17
-24
lines changed

drivers/acpi/acpi_video.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ static const struct backlight_ops acpi_backlight_ops = {
253253
static int video_get_max_state(struct thermal_cooling_device *cooling_dev,
254254
unsigned long *state)
255255
{
256-
struct acpi_device *device = cooling_dev->devdata;
257-
struct acpi_video_device *video = acpi_driver_data(device);
256+
struct acpi_video_device *video = cooling_dev->devdata;
258257

259258
*state = video->brightness->count - ACPI_VIDEO_FIRST_LEVEL - 1;
260259
return 0;
@@ -263,8 +262,7 @@ static int video_get_max_state(struct thermal_cooling_device *cooling_dev,
263262
static int video_get_cur_state(struct thermal_cooling_device *cooling_dev,
264263
unsigned long *state)
265264
{
266-
struct acpi_device *device = cooling_dev->devdata;
267-
struct acpi_video_device *video = acpi_driver_data(device);
265+
struct acpi_video_device *video = cooling_dev->devdata;
268266
unsigned long long level;
269267
int offset;
270268

@@ -283,8 +281,7 @@ static int video_get_cur_state(struct thermal_cooling_device *cooling_dev,
283281
static int
284282
video_set_cur_state(struct thermal_cooling_device *cooling_dev, unsigned long state)
285283
{
286-
struct acpi_device *device = cooling_dev->devdata;
287-
struct acpi_video_device *video = acpi_driver_data(device);
284+
struct acpi_video_device *video = cooling_dev->devdata;
288285
int level;
289286

290287
if (state >= video->brightness->count - ACPI_VIDEO_FIRST_LEVEL)
@@ -1125,7 +1122,6 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg)
11251122

11261123
strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
11271124
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
1128-
device->driver_data = data;
11291125

11301126
data->device_id = device_id;
11311127
data->video = video;
@@ -1747,8 +1743,8 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
17471743
device->backlight->props.brightness =
17481744
acpi_video_get_brightness(device->backlight);
17491745

1750-
device->cooling_dev = thermal_cooling_device_register("LCD",
1751-
device->dev, &video_cooling_ops);
1746+
device->cooling_dev = thermal_cooling_device_register("LCD", device,
1747+
&video_cooling_ops);
17521748
if (IS_ERR(device->cooling_dev)) {
17531749
/*
17541750
* Set cooling_dev to NULL so we don't crash trying to free it.

include/linux/acpi.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/mod_devicetable.h>
1616
#include <linux/property.h>
1717
#include <linux/uuid.h>
18-
#include <linux/fw_table.h>
1918

2019
struct irq_domain;
2120
struct irq_domain_ops;
@@ -25,29 +24,30 @@ struct irq_domain_ops;
2524
#endif
2625
#include <acpi/acpi.h>
2726

28-
#ifdef CONFIG_ACPI_TABLE_LIB
29-
#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI)
30-
#define __init_or_acpilib
31-
#define __initdata_or_acpilib
32-
#else
33-
#define EXPORT_SYMBOL_ACPI_LIB(x)
34-
#define __init_or_acpilib __init
35-
#define __initdata_or_acpilib __initdata
36-
#endif
37-
3827
#ifdef CONFIG_ACPI
3928

4029
#include <linux/list.h>
4130
#include <linux/dynamic_debug.h>
4231
#include <linux/module.h>
4332
#include <linux/mutex.h>
33+
#include <linux/fw_table.h>
4434

4535
#include <acpi/acpi_bus.h>
4636
#include <acpi/acpi_drivers.h>
4737
#include <acpi/acpi_numa.h>
4838
#include <acpi/acpi_io.h>
4939
#include <asm/acpi.h>
5040

41+
#ifdef CONFIG_ACPI_TABLE_LIB
42+
#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI)
43+
#define __init_or_acpilib
44+
#define __initdata_or_acpilib
45+
#else
46+
#define EXPORT_SYMBOL_ACPI_LIB(x)
47+
#define __init_or_acpilib __init
48+
#define __initdata_or_acpilib __initdata
49+
#endif
50+
5151
static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
5252
{
5353
return adev ? adev->handle : NULL;

include/linux/fw_table.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ struct acpi_subtable_proc {
2525
int count;
2626
};
2727

28-
#include <linux/acpi.h>
29-
#include <acpi/acpi.h>
30-
3128
union acpi_subtable_headers {
3229
struct acpi_subtable_header common;
3330
struct acpi_hmat_structure hmat;

lib/fw_table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (C) 2023 Intel Corp.
88
*/
99
#include <linux/errno.h>
10-
#include <linux/fw_table.h>
10+
#include <linux/acpi.h>
1111
#include <linux/init.h>
1212
#include <linux/kernel.h>
1313
#include <linux/string.h>

0 commit comments

Comments
 (0)