Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 5533525

Browse files
committed
Merge tag 'acpi-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These fix the ACPI EC and AC drivers, the ACPI APEI error injection driver and build issues related to the dev_is_pnp() macro referring to pnp_bus_type that is not exported to modules. Specifics: - Fix error handling during EC operation region accesses in the ACPI EC driver (Armin Wolf) - Fix a memory leak in the APEI error injection driver introduced during its converion to a platform driver (Dan Williams) - Fix build failures related to the dev_is_pnp() macro by redefining it as a proper function and exporting it to modules as appropriate and unexport pnp_bus_type which need not be exported any more (Andy Shevchenko) - Update the ACPI AC driver to use power_supply_changed() to let the power supply core handle configuration changes properly (Thomas Weißschuh)" * tag 'acpi-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: AC: Properly notify powermanagement core about changes PNP: Hide pnp_bus_type from the non-PNP code PNP: Make dev_is_pnp() to be a function and export it for modules ACPI: EC: Avoid returning AE_OK on errors in address space handler ACPI: EC: Abort address space access upon error ACPI: APEI: EINJ: Fix einj_dev release leak
2 parents 64c6a36 + 1bfc083 commit 5533525

File tree

7 files changed

+21
-11
lines changed

7 files changed

+21
-11
lines changed

drivers/acpi/ac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
145145
dev_name(&adev->dev), event,
146146
(u32) ac->state);
147147
acpi_notifier_call_chain(adev, event, (u32) ac->state);
148-
kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
148+
power_supply_changed(ac->charger);
149149
}
150150
}
151151

@@ -268,7 +268,7 @@ static int acpi_ac_resume(struct device *dev)
268268
if (acpi_ac_get_state(ac))
269269
return 0;
270270
if (old_state != ac->state)
271-
kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
271+
power_supply_changed(ac->charger);
272272

273273
return 0;
274274
}

drivers/acpi/apei/einj-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ static void __exit einj_exit(void)
909909
if (einj_initialized)
910910
platform_driver_unregister(&einj_driver);
911911

912-
platform_device_del(einj_dev);
912+
platform_device_unregister(einj_dev);
913913
}
914914

915915
module_init(einj_init);

drivers/acpi/ec.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,10 +1333,13 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
13331333
if (ec->busy_polling || bits > 8)
13341334
acpi_ec_burst_enable(ec);
13351335

1336-
for (i = 0; i < bytes; ++i, ++address, ++value)
1336+
for (i = 0; i < bytes; ++i, ++address, ++value) {
13371337
result = (function == ACPI_READ) ?
13381338
acpi_ec_read(ec, address, value) :
13391339
acpi_ec_write(ec, address, *value);
1340+
if (result < 0)
1341+
break;
1342+
}
13401343

13411344
if (ec->busy_polling || bits > 8)
13421345
acpi_ec_burst_disable(ec);
@@ -1348,8 +1351,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
13481351
return AE_NOT_FOUND;
13491352
case -ETIME:
13501353
return AE_TIME;
1351-
default:
1354+
case 0:
13521355
return AE_OK;
1356+
default:
1357+
return AE_ERROR;
13531358
}
13541359
}
13551360

drivers/acpi/sbs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static void acpi_sbs_callback(void *context)
610610
if (sbs->charger_exists) {
611611
acpi_ac_get_present(sbs);
612612
if (sbs->charger_present != saved_charger_state)
613-
kobject_uevent(&sbs->charger->dev.kobj, KOBJ_CHANGE);
613+
power_supply_changed(sbs->charger);
614614
}
615615

616616
if (sbs->manager_present) {
@@ -622,7 +622,7 @@ static void acpi_sbs_callback(void *context)
622622
acpi_battery_read(bat);
623623
if (saved_battery_state == bat->present)
624624
continue;
625-
kobject_uevent(&bat->bat->dev.kobj, KOBJ_CHANGE);
625+
power_supply_changed(bat->bat);
626626
}
627627
}
628628
}

drivers/pnp/base.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
extern struct mutex pnp_lock;
88
extern const struct attribute_group *pnp_dev_groups[];
9+
extern const struct bus_type pnp_bus_type;
910

1011
int pnp_register_protocol(struct pnp_protocol *protocol);
1112
void pnp_unregister_protocol(struct pnp_protocol *protocol);

drivers/pnp/driver.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ const struct bus_type pnp_bus_type = {
266266
.dev_groups = pnp_dev_groups,
267267
};
268268

269+
bool dev_is_pnp(const struct device *dev)
270+
{
271+
return dev->bus == &pnp_bus_type;
272+
}
273+
EXPORT_SYMBOL_GPL(dev_is_pnp);
274+
269275
int pnp_register_driver(struct pnp_driver *drv)
270276
{
271277
drv->driver.name = drv->name;

include/linux/pnp.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,6 @@ struct pnp_protocol {
435435
#define protocol_for_each_dev(protocol, dev) \
436436
list_for_each_entry(dev, &(protocol)->devices, protocol_list)
437437

438-
extern const struct bus_type pnp_bus_type;
439-
440438
#if defined(CONFIG_PNP)
441439

442440
/* device management */
@@ -469,7 +467,7 @@ int compare_pnp_id(struct pnp_id *pos, const char *id);
469467
int pnp_register_driver(struct pnp_driver *drv);
470468
void pnp_unregister_driver(struct pnp_driver *drv);
471469

472-
#define dev_is_pnp(d) ((d)->bus == &pnp_bus_type)
470+
bool dev_is_pnp(const struct device *dev);
473471

474472
#else
475473

@@ -502,7 +500,7 @@ static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -E
502500
static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; }
503501
static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
504502

505-
#define dev_is_pnp(d) false
503+
static inline bool dev_is_pnp(const struct device *dev) { return false; }
506504

507505
#endif /* CONFIG_PNP */
508506

0 commit comments

Comments
 (0)