From: linux@treblig.org
To: sre@kernel.org, linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"Dr. David Alan Gilbert" <linux@treblig.org>
Subject: [PATCH 2/3] power: supply: ds2760: Remove unused ds2760_battery_set_charged
Date: Fri, 7 Mar 2025 23:02:24 +0000 [thread overview]
Message-ID: <20250307230225.128775-3-linux@treblig.org> (raw)
In-Reply-To: <20250307230225.128775-1-linux@treblig.org>
From: "Dr. David Alan Gilbert" <linux@treblig.org>
With power_supply_set_battery_charged() deleted in the previous
patch, there's no one left to call the set_charged method.
The only implemented is in ds2760, unwire it and delete the
associated functions and data.
(Arguably it might be time to delete ds2760 since I don't
think there are any users left)
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
drivers/power/supply/ds2760_battery.c | 49 ---------------------------
1 file changed, 49 deletions(-)
diff --git a/drivers/power/supply/ds2760_battery.c b/drivers/power/supply/ds2760_battery.c
index 83bdec5a2bda..a7f7d4c3f1ee 100644
--- a/drivers/power/supply/ds2760_battery.c
+++ b/drivers/power/supply/ds2760_battery.c
@@ -112,7 +112,6 @@ struct ds2760_device_info {
struct power_supply_desc bat_desc;
struct workqueue_struct *monitor_wqueue;
struct delayed_work monitor_work;
- struct delayed_work set_charged_work;
struct notifier_block pm_notifier;
};
@@ -489,50 +488,6 @@ static void ds2760_battery_external_power_changed(struct power_supply *psy)
}
-static void ds2760_battery_set_charged_work(struct work_struct *work)
-{
- char bias;
- struct ds2760_device_info *di = container_of(work,
- struct ds2760_device_info, set_charged_work.work);
-
- dev_dbg(di->dev, "%s\n", __func__);
-
- ds2760_battery_read_status(di);
-
- /* When we get notified by external circuitry that the battery is
- * considered fully charged now, we know that there is no current
- * flow any more. However, the ds2760's internal current meter is
- * too inaccurate to rely on - spec say something ~15% failure.
- * Hence, we use the current offset bias register to compensate
- * that error.
- */
-
- if (!power_supply_am_i_supplied(di->bat))
- return;
-
- bias = (signed char) di->current_raw +
- (signed char) di->raw[DS2760_CURRENT_OFFSET_BIAS];
-
- dev_dbg(di->dev, "%s: bias = %d\n", __func__, bias);
-
- w1_ds2760_write(di->dev, &bias, DS2760_CURRENT_OFFSET_BIAS, 1);
- w1_ds2760_store_eeprom(di->dev, DS2760_EEPROM_BLOCK1);
- w1_ds2760_recall_eeprom(di->dev, DS2760_EEPROM_BLOCK1);
-
- /* Write to the di->raw[] buffer directly - the CURRENT_OFFSET_BIAS
- * value won't be read back by ds2760_battery_read_status() */
- di->raw[DS2760_CURRENT_OFFSET_BIAS] = bias;
-}
-
-static void ds2760_battery_set_charged(struct power_supply *psy)
-{
- struct ds2760_device_info *di = power_supply_get_drvdata(psy);
-
- /* postpone the actual work by 20 secs. This is for debouncing GPIO
- * signals and to let the current value settle. See AN4188. */
- mod_delayed_work(di->monitor_wqueue, &di->set_charged_work, HZ * 20);
-}
-
static int ds2760_battery_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
@@ -692,7 +647,6 @@ static int w1_ds2760_add_slave(struct w1_slave *sl)
di->bat_desc.set_property = ds2760_battery_set_property;
di->bat_desc.property_is_writeable =
ds2760_battery_property_is_writeable;
- di->bat_desc.set_charged = ds2760_battery_set_charged;
di->bat_desc.external_power_changed =
ds2760_battery_external_power_changed;
@@ -747,8 +701,6 @@ static int w1_ds2760_add_slave(struct w1_slave *sl)
}
INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work);
- INIT_DELAYED_WORK(&di->set_charged_work,
- ds2760_battery_set_charged_work);
di->monitor_wqueue = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
if (!di->monitor_wqueue) {
retval = -ESRCH;
@@ -774,7 +726,6 @@ static void w1_ds2760_remove_slave(struct w1_slave *sl)
unregister_pm_notifier(&di->pm_notifier);
cancel_delayed_work_sync(&di->monitor_work);
- cancel_delayed_work_sync(&di->set_charged_work);
destroy_workqueue(di->monitor_wqueue);
}
--
2.48.1
next prev parent reply other threads:[~2025-03-07 23:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 23:02 [PATCH 0/3] power: supply: set_charged deadcode linux
2025-03-07 23:02 ` [PATCH 1/3] power: supply: core: Remove unused power_supply_set_battery_charged linux
2025-03-07 23:02 ` linux [this message]
2025-03-07 23:02 ` [PATCH 3/3] power: supply: Remove unused set_charged method linux
2025-03-08 0:14 ` [PATCH 0/3] power: supply: set_charged deadcode Sebastian Reichel
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=20250307230225.128775-3-linux@treblig.org \
--to=linux@treblig.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@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