Skip to content

Commit 5bf46fe

Browse files
committed
Merge branches 'acpi-video', 'acpi-platform-profile' and 'acpi-misc'
Merge an ACPI backlight (video) driver fix, an ACPI platform-profile driver optimization, and a miscellaneous ACPI-related cleanup for 6.15-rc1: - Make the ACPI backlight driver handle fetching EDID as ACPI_TYPE_PACKAGE which is not specification-compliant, but has been encountered in the field (Gergo Koteles). - Simplify the aggregation of choices in the ACPI platform-profile driver which has become possible after recent modifications of that driver (Kurt Borja). - Use str_enabled_disabled() instead of hardcoded strings in the ACPI code related to NUMA (Thorsten Blum). * acpi-video: ACPI: video: Handle fetching EDID as ACPI_TYPE_PACKAGE * acpi-platform-profile: ACPI: platform_profile: Optimize _aggregate_choices() * acpi-misc: ACPI: NUMA: Use str_enabled_disabled() helper function
4 parents a984d06 + ebca08f + 3035a6d + 359595b commit 5bf46fe

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

drivers/acpi/acpi_video.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,13 @@ acpi_video_device_EDID(struct acpi_video_device *device, void **edid, int length
649649

650650
obj = buffer.pointer;
651651

652+
/*
653+
* Some buggy implementations incorrectly return the EDID buffer in an ACPI package.
654+
* In this case, extract the buffer from the package.
655+
*/
656+
if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 1)
657+
obj = &obj->package.elements[0];
658+
652659
if (obj && obj->type == ACPI_TYPE_BUFFER) {
653660
*edid = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL);
654661
ret = *edid ? obj->buffer.length : -ENOMEM;
@@ -658,7 +665,7 @@ acpi_video_device_EDID(struct acpi_video_device *device, void **edid, int length
658665
ret = -EFAULT;
659666
}
660667

661-
kfree(obj);
668+
kfree(buffer.pointer);
662669
return ret;
663670
}
664671

drivers/acpi/numa/srat.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/nodemask.h>
1919
#include <linux/topology.h>
2020
#include <linux/numa_memblks.h>
21+
#include <linux/string_choices.h>
2122

2223
static nodemask_t nodes_found_map = NODE_MASK_NONE;
2324

@@ -188,8 +189,7 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
188189
pr_debug("SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
189190
p->apic_id, p->local_sapic_eid,
190191
p->proximity_domain_lo,
191-
(p->flags & ACPI_SRAT_CPU_ENABLED) ?
192-
"enabled" : "disabled");
192+
str_enabled_disabled(p->flags & ACPI_SRAT_CPU_ENABLED));
193193
}
194194
break;
195195

@@ -201,8 +201,7 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
201201
(unsigned long long)p->base_address,
202202
(unsigned long long)p->length,
203203
p->proximity_domain,
204-
(p->flags & ACPI_SRAT_MEM_ENABLED) ?
205-
"enabled" : "disabled",
204+
str_enabled_disabled(p->flags & ACPI_SRAT_MEM_ENABLED),
206205
(p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) ?
207206
" hot-pluggable" : "",
208207
(p->flags & ACPI_SRAT_MEM_NON_VOLATILE) ?
@@ -217,8 +216,7 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
217216
pr_debug("SRAT Processor (x2apicid[0x%08x]) in proximity domain %d %s\n",
218217
p->apic_id,
219218
p->proximity_domain,
220-
(p->flags & ACPI_SRAT_CPU_ENABLED) ?
221-
"enabled" : "disabled");
219+
str_enabled_disabled(p->flags & ACPI_SRAT_CPU_ENABLED));
222220
}
223221
break;
224222

@@ -229,8 +227,7 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
229227
pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n",
230228
p->acpi_processor_uid,
231229
p->proximity_domain,
232-
(p->flags & ACPI_SRAT_GICC_ENABLED) ?
233-
"enabled" : "disabled");
230+
str_enabled_disabled(p->flags & ACPI_SRAT_GICC_ENABLED));
234231
}
235232
break;
236233

@@ -248,8 +245,7 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
248245
*(u16 *)(&p->device_handle[0]),
249246
*(u16 *)(&p->device_handle[2]),
250247
p->proximity_domain,
251-
(p->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED) ?
252-
"enabled" : "disabled");
248+
str_enabled_disabled(p->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED));
253249
} else {
254250
/*
255251
* In this case we can rely on the device having a
@@ -259,8 +255,7 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
259255
(char *)(&p->device_handle[0]),
260256
(char *)(&p->device_handle[8]),
261257
p->proximity_domain,
262-
(p->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED) ?
263-
"enabled" : "disabled");
258+
str_enabled_disabled(p->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED));
264259
}
265260
}
266261
break;
@@ -272,8 +267,7 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
272267
pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n",
273268
p->acpi_processor_uid,
274269
p->proximity_domain,
275-
(p->flags & ACPI_SRAT_RINTC_ENABLED) ?
276-
"enabled" : "disabled");
270+
str_enabled_disabled(p->flags & ACPI_SRAT_RINTC_ENABLED));
277271
}
278272
break;
279273

drivers/acpi/platform_profile.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ static const struct class platform_profile_class = {
245245
/**
246246
* _aggregate_choices - Aggregate the available profile choices
247247
* @dev: The device
248-
* @arg: struct aggregate_choices_data
248+
* @arg: struct aggregate_choices_data, with it's aggregate member bitmap
249+
* initially filled with ones
249250
*
250251
* Return: 0 on success, -errno on failure
251252
*/
@@ -256,12 +257,10 @@ static int _aggregate_choices(struct device *dev, void *arg)
256257
struct platform_profile_handler *handler;
257258

258259
lockdep_assert_held(&profile_lock);
260+
259261
handler = to_pprof_handler(dev);
260262
bitmap_or(tmp, handler->choices, handler->hidden_choices, PLATFORM_PROFILE_LAST);
261-
if (test_bit(PLATFORM_PROFILE_LAST, data->aggregate))
262-
bitmap_copy(data->aggregate, tmp, PLATFORM_PROFILE_LAST);
263-
else
264-
bitmap_and(data->aggregate, tmp, data->aggregate, PLATFORM_PROFILE_LAST);
263+
bitmap_and(data->aggregate, tmp, data->aggregate, PLATFORM_PROFILE_LAST);
265264
data->count++;
266265

267266
return 0;
@@ -305,7 +304,6 @@ static ssize_t platform_profile_choices_show(struct kobject *kobj,
305304
};
306305
int err;
307306

308-
set_bit(PLATFORM_PROFILE_LAST, data.aggregate);
309307
scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) {
310308
err = class_for_each_device(&platform_profile_class, NULL,
311309
&data, _aggregate_choices);
@@ -422,7 +420,7 @@ static ssize_t platform_profile_store(struct kobject *kobj,
422420
i = sysfs_match_string(profile_names, buf);
423421
if (i < 0 || i == PLATFORM_PROFILE_CUSTOM)
424422
return -EINVAL;
425-
set_bit(PLATFORM_PROFILE_LAST, data.aggregate);
423+
426424
scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) {
427425
ret = class_for_each_device(&platform_profile_class, NULL,
428426
&data, _aggregate_choices);
@@ -502,7 +500,6 @@ int platform_profile_cycle(void)
502500
enum platform_profile_option profile = PLATFORM_PROFILE_LAST;
503501
int err;
504502

505-
set_bit(PLATFORM_PROFILE_LAST, data.aggregate);
506503
scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) {
507504
err = class_for_each_device(&platform_profile_class, NULL,
508505
&profile, _aggregate_profiles);

0 commit comments

Comments
 (0)