Skip to content

Commit 603f162

Browse files
committed
Merge tag 'acpi-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "The most significant change here is replacing msleep() in acpi_os_sleep() with usleep_range() to reduce spurious sleep time due to timer inaccuracy which may spectacularly reduce the duration of system suspend and resume transitions on some systems. All of the other changes fall into the fixes and cleanups category this time. Specifics: - Use usleep_range() instead of msleep() in acpi_os_sleep() to reduce excessive delays due to timer inaccuracy, mostly affecting system suspend and resume (Rafael Wysocki) - Use str_enabled_disabled() string helpers in the ACPI tables parsing code to make it easier to follow (Sunil V L) - Update device properties parsing on systems using ACPI so that data firmware nodes resulting from _DSD evaluation are treated as available in firmware nodes walks (Sakari Ailus) - Fix missing guid_t declaration in linux/prmt.h (Robert Richter) - Update the GHES handling code to follow the global panic= policy instead of overriding it by force-rebooting the system after a fatal HW error has been reported (Borislav Petkov) - Update messages printed by the ACPI battery driver to always refer to driver extensions as "hooks" to avoid confusion with similar functionality in the power supply subsystem in the future (Thomas Weißschuh) - Fix .probe() error path cleanup in the ACPI fan driver to avoid memory leaks (Joe Hattori) - Constify 'struct bin_attribute' in some places in the ACPI subsystem and mark it as __ro_after_init in one place to prevent binary blob attributes from being updated (Thomas Weißschuh) - Add empty stubs for several ACPI-related symbols so that they can be used when CONFIG_ACPI is unset and use them for removing unnecessary conditional compilation from the ipu-bridge driver (Ricardo Ribalda)" * tag 'acpi-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: APEI: GHES: Have GHES honor the panic= setting ACPI: PRM: Fix missing guid_t declaration in linux/prmt.h ACPI: tables: Use string choice helpers ACPI: property: Consider data nodes as being available media: ipu-bridge: Remove unneeded conditional compilations ACPI: bus: implement acpi_device_hid when !ACPI ACPI: bus: implement for_each_acpi_consumer_dev when !ACPI ACPI: header: implement acpi_device_handle when !ACPI ACPI: bus: implement acpi_get_physical_device_location when !ACPI ACPI: bus: implement for_each_acpi_dev_match when !ACPI ACPI: bus: change the prototype for acpi_get_physical_device_location ACPI: fan: cleanup resources in the error path of .probe() ACPI: battery: Rename extensions to hook in messages ACPI: OSL: Use usleep_range() in acpi_os_sleep() ACPI: sysfs: Constify 'struct bin_attribute' ACPI: BGRT: Constify 'struct bin_attribute' ACPI: BGRT: Mark bin_attribute as __ro_after_init
2 parents f4b9d3b + d1ddf94 commit 603f162

File tree

17 files changed

+93
-71
lines changed

17 files changed

+93
-71
lines changed

drivers/acpi/apei/ghes.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ static struct gen_pool *ghes_estatus_pool;
173173
static struct ghes_estatus_cache __rcu *ghes_estatus_caches[GHES_ESTATUS_CACHES_SIZE];
174174
static atomic_t ghes_estatus_cache_alloced;
175175

176-
static int ghes_panic_timeout __read_mostly = 30;
177-
178176
static void __iomem *ghes_map(u64 pfn, enum fixed_addresses fixmap_idx)
179177
{
180178
phys_addr_t paddr;
@@ -983,14 +981,16 @@ static void __ghes_panic(struct ghes *ghes,
983981
struct acpi_hest_generic_status *estatus,
984982
u64 buf_paddr, enum fixed_addresses fixmap_idx)
985983
{
984+
const char *msg = GHES_PFX "Fatal hardware error";
985+
986986
__ghes_print_estatus(KERN_EMERG, ghes->generic, estatus);
987987

988988
ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx);
989989

990-
/* reboot to log the error! */
991990
if (!panic_timeout)
992-
panic_timeout = ghes_panic_timeout;
993-
panic("Fatal hardware error!");
991+
pr_emerg("%s but panic disabled\n", msg);
992+
993+
panic(msg);
994994
}
995995

996996
static int ghes_proc(struct ghes *ghes)

drivers/acpi/battery.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook)
717717
}
718718
list_del_init(&hook->list);
719719

720-
pr_info("extension unregistered: %s\n", hook->name);
720+
pr_info("hook unregistered: %s\n", hook->name);
721721
}
722722

723723
void battery_hook_unregister(struct acpi_battery_hook *hook)
@@ -751,18 +751,18 @@ void battery_hook_register(struct acpi_battery_hook *hook)
751751
if (hook->add_battery(battery->bat, hook)) {
752752
/*
753753
* If a add-battery returns non-zero,
754-
* the registration of the extension has failed,
754+
* the registration of the hook has failed,
755755
* and we will not add it to the list of loaded
756756
* hooks.
757757
*/
758-
pr_err("extension failed to load: %s", hook->name);
758+
pr_err("hook failed to load: %s", hook->name);
759759
battery_hook_unregister_unlocked(hook);
760760
goto end;
761761
}
762762

763763
power_supply_changed(battery->bat);
764764
}
765-
pr_info("new extension: %s\n", hook->name);
765+
pr_info("new hook: %s\n", hook->name);
766766
end:
767767
mutex_unlock(&hook_mutex);
768768
}
@@ -805,10 +805,10 @@ static void battery_hook_add_battery(struct acpi_battery *battery)
805805
list_for_each_entry_safe(hook_node, tmp, &battery_hook_list, list) {
806806
if (hook_node->add_battery(battery->bat, hook_node)) {
807807
/*
808-
* The notification of the extensions has failed, to
809-
* prevent further errors we will unload the extension.
808+
* The notification of the hook has failed, to
809+
* prevent further errors we will unload the hook.
810810
*/
811-
pr_err("error in extension, unloading: %s",
811+
pr_err("error in hook, unloading: %s",
812812
hook_node->name);
813813
battery_hook_unregister_unlocked(hook_node);
814814
}

drivers/acpi/bgrt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ BGRT_SHOW(type, image_type);
2929
BGRT_SHOW(xoffset, image_offset_x);
3030
BGRT_SHOW(yoffset, image_offset_y);
3131

32-
static BIN_ATTR_SIMPLE_RO(image);
32+
static __ro_after_init BIN_ATTR_SIMPLE_RO(image);
3333

3434
static struct attribute *bgrt_attributes[] = {
3535
&bgrt_attr_version.attr,
@@ -40,14 +40,14 @@ static struct attribute *bgrt_attributes[] = {
4040
NULL,
4141
};
4242

43-
static struct bin_attribute *bgrt_bin_attributes[] = {
43+
static const struct bin_attribute *const bgrt_bin_attributes[] = {
4444
&bin_attr_image,
4545
NULL,
4646
};
4747

4848
static const struct attribute_group bgrt_attribute_group = {
4949
.attrs = bgrt_attributes,
50-
.bin_attrs = bgrt_bin_attributes,
50+
.bin_attrs_new = bgrt_bin_attributes,
5151
};
5252

5353
int __init acpi_parse_bgrt(struct acpi_table_header *table)

drivers/acpi/fan_core.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,19 +371,25 @@ static int acpi_fan_probe(struct platform_device *pdev)
371371
result = sysfs_create_link(&pdev->dev.kobj,
372372
&cdev->device.kobj,
373373
"thermal_cooling");
374-
if (result)
374+
if (result) {
375375
dev_err(&pdev->dev, "Failed to create sysfs link 'thermal_cooling'\n");
376+
goto err_unregister;
377+
}
376378

377379
result = sysfs_create_link(&cdev->device.kobj,
378380
&pdev->dev.kobj,
379381
"device");
380382
if (result) {
381383
dev_err(&pdev->dev, "Failed to create sysfs link 'device'\n");
382-
goto err_end;
384+
goto err_remove_link;
383385
}
384386

385387
return 0;
386388

389+
err_remove_link:
390+
sysfs_remove_link(&pdev->dev.kobj, "thermal_cooling");
391+
err_unregister:
392+
thermal_cooling_device_unregister(cdev);
387393
err_end:
388394
if (fan->acpi4)
389395
acpi_fan_delete_attributes(device);

drivers/acpi/mipi-disco-img.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,7 @@ static void init_crs_csi2_swnodes(struct crs_csi2 *csi2)
624624
if (!fwnode_property_present(adev_fwnode, "rotation")) {
625625
struct acpi_pld_info *pld;
626626

627-
status = acpi_get_physical_device_location(handle, &pld);
628-
if (ACPI_SUCCESS(status)) {
627+
if (acpi_get_physical_device_location(handle, &pld)) {
629628
swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] =
630629
PROPERTY_ENTRY_U32("rotation",
631630
pld->rotation * 45U);

drivers/acpi/osl.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,27 @@ acpi_status acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler handler)
607607

608608
void acpi_os_sleep(u64 ms)
609609
{
610-
msleep(ms);
610+
u64 usec = ms * USEC_PER_MSEC, delta_us = 50;
611+
612+
/*
613+
* Use a hrtimer because the timer wheel timers are optimized for
614+
* cancelation before they expire and this timer is not going to be
615+
* canceled.
616+
*
617+
* Set the delta between the requested sleep time and the effective
618+
* deadline to at least 50 us in case there is an opportunity for timer
619+
* coalescing.
620+
*
621+
* Moreover, longer sleeps can be assumed to need somewhat less timer
622+
* precision, so sacrifice some of it for making the timer a more likely
623+
* candidate for coalescing by setting the delta to 1% of the sleep time
624+
* if it is above 5 ms (this value is chosen so that the delta is a
625+
* continuous function of the sleep time).
626+
*/
627+
if (ms > 5)
628+
delta_us = (USEC_PER_MSEC / 100) * ms;
629+
630+
usleep_range(usec, usec + delta_us);
611631
}
612632

613633
void acpi_os_stall(u32 us)

drivers/acpi/property.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1492,7 +1492,7 @@ acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode)
14921492
static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)
14931493
{
14941494
if (!is_acpi_device_node(fwnode))
1495-
return false;
1495+
return true;
14961496

14971497
return acpi_device_is_present(to_acpi_device_node(fwnode));
14981498
}

drivers/acpi/scan.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,8 @@ int acpi_tie_acpi_dev(struct acpi_device *adev)
723723
static void acpi_store_pld_crc(struct acpi_device *adev)
724724
{
725725
struct acpi_pld_info *pld;
726-
acpi_status status;
727726

728-
status = acpi_get_physical_device_location(adev->handle, &pld);
729-
if (ACPI_FAILURE(status))
727+
if (!acpi_get_physical_device_location(adev->handle, &pld))
730728
return;
731729

732730
adev->pld_crc = crc32(~0, pld, sizeof(*pld));

drivers/acpi/sysfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ struct acpi_data_attr {
319319
};
320320

321321
static ssize_t acpi_table_show(struct file *filp, struct kobject *kobj,
322-
struct bin_attribute *bin_attr, char *buf,
322+
const struct bin_attribute *bin_attr, char *buf,
323323
loff_t offset, size_t count)
324324
{
325325
struct acpi_table_attr *table_attr =
@@ -372,7 +372,7 @@ static int acpi_table_attr_init(struct kobject *tables_obj,
372372
}
373373

374374
table_attr->attr.size = table_header->length;
375-
table_attr->attr.read = acpi_table_show;
375+
table_attr->attr.read_new = acpi_table_show;
376376
table_attr->attr.attr.name = table_attr->filename;
377377
table_attr->attr.attr.mode = 0400;
378378

@@ -412,7 +412,7 @@ acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context)
412412
}
413413

414414
static ssize_t acpi_data_show(struct file *filp, struct kobject *kobj,
415-
struct bin_attribute *bin_attr, char *buf,
415+
const struct bin_attribute *bin_attr, char *buf,
416416
loff_t offset, size_t count)
417417
{
418418
struct acpi_data_attr *data_attr;
@@ -495,7 +495,7 @@ static int acpi_table_data_init(struct acpi_table_header *th)
495495
if (!data_attr)
496496
return -ENOMEM;
497497
sysfs_attr_init(&data_attr->attr.attr);
498-
data_attr->attr.read = acpi_data_show;
498+
data_attr->attr.read_new = acpi_data_show;
499499
data_attr->attr.attr.mode = 0400;
500500
return acpi_data_objs[i].fn(th, data_attr);
501501
}

drivers/acpi/tables.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
5656
(struct acpi_madt_local_apic *)header;
5757
pr_debug("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
5858
p->processor_id, p->id,
59-
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
59+
str_enabled_disabled(p->lapic_flags & ACPI_MADT_ENABLED));
6060
}
6161
break;
6262

@@ -66,7 +66,7 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
6666
(struct acpi_madt_local_x2apic *)header;
6767
pr_debug("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
6868
p->local_apic_id, p->uid,
69-
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
69+
str_enabled_disabled(p->lapic_flags & ACPI_MADT_ENABLED));
7070
}
7171
break;
7272

@@ -160,7 +160,7 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
160160
(struct acpi_madt_local_sapic *)header;
161161
pr_debug("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
162162
p->processor_id, p->id, p->eid,
163-
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
163+
str_enabled_disabled(p->lapic_flags & ACPI_MADT_ENABLED));
164164
}
165165
break;
166166

@@ -183,7 +183,7 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
183183
pr_debug("GICC (acpi_id[0x%04x] address[%llx] MPIDR[0x%llx] %s)\n",
184184
p->uid, p->base_address,
185185
p->arm_mpidr,
186-
(p->flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
186+
str_enabled_disabled(p->flags & ACPI_MADT_ENABLED));
187187

188188
}
189189
break;
@@ -218,7 +218,7 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
218218

219219
pr_debug("CORE PIC (processor_id[0x%02x] core_id[0x%02x] %s)\n",
220220
p->processor_id, p->core_id,
221-
(p->flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
221+
str_enabled_disabled(p->flags & ACPI_MADT_ENABLED));
222222
}
223223
break;
224224

@@ -228,7 +228,7 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
228228

229229
pr_debug("RISC-V INTC (acpi_uid[0x%04x] hart_id[0x%llx] %s)\n",
230230
p->uid, p->hart_id,
231-
(p->flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
231+
str_enabled_disabled(p->flags & ACPI_MADT_ENABLED));
232232
}
233233
break;
234234

0 commit comments

Comments
 (0)