[PATCH 0/2] platform/x86: thinkpad_acpi: Enable devres for subdriver .init callbacks

Kurt Borja posted 2 patches 10 months, 1 week ago
drivers/platform/x86/thinkpad_acpi.c | 176 ++++++++++++---------------
1 file changed, 77 insertions(+), 99 deletions(-)
[PATCH 0/2] platform/x86: thinkpad_acpi: Enable devres for subdriver .init callbacks
Posted by Kurt Borja 10 months, 1 week ago
Hi all,

It was reported by Mark [1] that if subdrivers used devres, the
tpacpi_pdev wouldn't bind successfully to the device, thus failing to
create the various sysfs attributes that this driver exposes.

The original problem is already fixed, however a complete solution was
due.

The approach I took is to let the driver core manage the lifetimes of
the subdrivers (details in Patch [1/2]). This enables devres for
subdrivers and IMO makes the code more maintainable (because of the
lifetime gurantees).

This was compile tested only, because (unfortunately) I don't own a
thinkpad so some testing is absolutely required, as this is an extremely
intricate driver.

Based on top of the for-next branch.

~ Kurt
---
[1] https://lore.kernel.org/platform-driver-x86/20250208091438.5972-1-mpearson-lenovo@squebb.ca/#t

Kurt Borja (2):
  platform/x86: thinkpad_acpi: Move subdriver initialization to
    tpacpi_pdriver's probe.
  platform/x86: thinkpad_acpi: Move HWMON initialization to
    tpacpi_hwmon_pdriver's probe

 drivers/platform/x86/thinkpad_acpi.c | 176 ++++++++++++---------------
 1 file changed, 77 insertions(+), 99 deletions(-)


base-commit: d497c47481f8e8f13e3191c9a707ed942d3bb3d7
-- 
2.48.1
Re: [PATCH 0/2] platform/x86: thinkpad_acpi: Enable devres for subdriver .init callbacks
Posted by Ilpo Järvinen 9 months, 3 weeks ago
On Fri, 14 Feb 2025 19:03:00 -0500, Kurt Borja wrote:

> It was reported by Mark [1] that if subdrivers used devres, the
> tpacpi_pdev wouldn't bind successfully to the device, thus failing to
> create the various sysfs attributes that this driver exposes.
> 
> The original problem is already fixed, however a complete solution was
> due.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/2] platform/x86: thinkpad_acpi: Move subdriver initialization to tpacpi_pdriver's probe.
      commit: 38b9ab80db31cf993a8f3ab2baf772083b62ca6f
[2/2] platform/x86: thinkpad_acpi: Move HWMON initialization to tpacpi_hwmon_pdriver's probe
      commit: 43fc63a1e8f6db7148f9cfcddda539c3437bc6c2

--
 i.