Skip to content

Commit

Permalink
Merge branches 'acpi-ec', 'acpi-apei' and 'pnp'
Browse files Browse the repository at this point in the history
Merge ACPI EC driver fixes, an ACPI APEI fix and PNP fixes for
6.10-rc3:

 - 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).

* acpi-ec:
  ACPI: EC: Avoid returning AE_OK on errors in address space handler
  ACPI: EC: Abort address space access upon error

* acpi-apei:
  ACPI: APEI: EINJ: Fix einj_dev release leak

* pnp:
  PNP: Hide pnp_bus_type from the non-PNP code
  PNP: Make dev_is_pnp() to be a function and export it for modules
  • Loading branch information
Rafael J. Wysocki committed Jun 5, 2024
4 parents ac62f52 + c4bd7f1 + 7ff6c79 + edcde84 commit 1bfc083
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion drivers/acpi/apei/einj-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ static void __exit einj_exit(void)
if (einj_initialized)
platform_driver_unregister(&einj_driver);

platform_device_del(einj_dev);
platform_device_unregister(einj_dev);
}

module_init(einj_init);
Expand Down
9 changes: 7 additions & 2 deletions drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,10 +1333,13 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
if (ec->busy_polling || bits > 8)
acpi_ec_burst_enable(ec);

for (i = 0; i < bytes; ++i, ++address, ++value)
for (i = 0; i < bytes; ++i, ++address, ++value) {
result = (function == ACPI_READ) ?
acpi_ec_read(ec, address, value) :
acpi_ec_write(ec, address, *value);
if (result < 0)
break;
}

if (ec->busy_polling || bits > 8)
acpi_ec_burst_disable(ec);
Expand All @@ -1348,8 +1351,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
return AE_NOT_FOUND;
case -ETIME:
return AE_TIME;
default:
case 0:
return AE_OK;
default:
return AE_ERROR;
}
}

Expand Down
1 change: 1 addition & 0 deletions drivers/pnp/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

extern struct mutex pnp_lock;
extern const struct attribute_group *pnp_dev_groups[];
extern const struct bus_type pnp_bus_type;

int pnp_register_protocol(struct pnp_protocol *protocol);
void pnp_unregister_protocol(struct pnp_protocol *protocol);
Expand Down
6 changes: 6 additions & 0 deletions drivers/pnp/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ const struct bus_type pnp_bus_type = {
.dev_groups = pnp_dev_groups,
};

bool dev_is_pnp(const struct device *dev)
{
return dev->bus == &pnp_bus_type;
}
EXPORT_SYMBOL_GPL(dev_is_pnp);

int pnp_register_driver(struct pnp_driver *drv)
{
drv->driver.name = drv->name;
Expand Down
6 changes: 2 additions & 4 deletions include/linux/pnp.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,6 @@ struct pnp_protocol {
#define protocol_for_each_dev(protocol, dev) \
list_for_each_entry(dev, &(protocol)->devices, protocol_list)

extern const struct bus_type pnp_bus_type;

#if defined(CONFIG_PNP)

/* device management */
Expand Down Expand Up @@ -469,7 +467,7 @@ int compare_pnp_id(struct pnp_id *pos, const char *id);
int pnp_register_driver(struct pnp_driver *drv);
void pnp_unregister_driver(struct pnp_driver *drv);

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

#else

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

#define dev_is_pnp(d) false
static inline bool dev_is_pnp(const struct device *dev) { return false; }

#endif /* CONFIG_PNP */

Expand Down

0 comments on commit 1bfc083

Please sign in to comment.