mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, sre@kernel.org
Cc: platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] platform/x86: dell-ddv: Use devm_battery_hook_register
Date: Wed,  5 Mar 2025 06:30:08 +0100	[thread overview]
Message-ID: <20250305053009.378609-3-W_Armin@gmx.de> (raw)
In-Reply-To: <20250305053009.378609-1-W_Armin@gmx.de>

Use devm_battery_hook_register() instead of manually calling
devm_add_action_or_reset() to simplify the code.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/dell/dell-wmi-ddv.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c
index ab5f7d3ab824..811cddab57fc 100644
--- a/drivers/platform/x86/dell/dell-wmi-ddv.c
+++ b/drivers/platform/x86/dell/dell-wmi-ddv.c
@@ -732,13 +732,6 @@ static int dell_wmi_ddv_remove_battery(struct power_supply *battery, struct acpi
 	return 0;
 }

-static void dell_wmi_ddv_battery_remove(void *data)
-{
-	struct acpi_battery_hook *hook = data;
-
-	battery_hook_unregister(hook);
-}
-
 static int dell_wmi_ddv_battery_add(struct dell_wmi_ddv_data *data)
 {
 	data->hook.name = "Dell DDV Battery Extension";
@@ -755,9 +748,7 @@ static int dell_wmi_ddv_battery_add(struct dell_wmi_ddv_data *data)
 	data->eppid_attr.attr.mode = 0444;
 	data->eppid_attr.show = eppid_show;

-	battery_hook_register(&data->hook);
-
-	return devm_add_action_or_reset(&data->wdev->dev, dell_wmi_ddv_battery_remove, &data->hook);
+	return devm_battery_hook_register(&data->wdev->dev, &data->hook);
 }

 static int dell_wmi_ddv_buffer_read(struct seq_file *seq, enum dell_ddv_method method)
--
2.39.5


  parent reply	other threads:[~2025-03-05  5:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05  5:30 [PATCH 0/3] platform/x86: dell-ddv: Rework battery temperature handling Armin Wolf
2025-03-05  5:30 ` [PATCH 1/3] platform/x86: dell-ddv: Fix temperature calculation Armin Wolf
2025-03-05  5:30 ` Armin Wolf [this message]
2025-03-05  5:30 ` [PATCH 3/3] platform/x86: dell-ddv: Use the power supply extension mechanism Armin Wolf
2025-03-05 22:39 ` [PATCH 0/3] platform/x86: dell-ddv: Rework battery temperature handling Sebastian Reichel
2025-03-07 10:39 ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250305053009.378609-3-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®