[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230427095747.3889718-1-tongjian@huaqin.corp-partner.google.com>
Date: Thu, 27 Apr 2023 17:57:49 +0800
From: tongjian <tongjian@...qin.corp-partner.google.com>
To: sre@...nel.org
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
tongjian <tongjian@...qin.corp-partner.google.com>
Subject: [PATCH] power: supply: sbs-battery: return -EPROBE_DEFER when battery err
Some batteries are not init complete when the first poweron, this cause
the devm_power_supply cannt be registered. we will return -EPROBE_DEFER
for probe retry.
Signed-off-by: tongjian <tongjian@...qin.corp-partner.google.com>
---
drivers/power/supply/sbs-battery.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index f84dbaab283a..0669c1bc1e4f 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -1187,7 +1187,8 @@ static int sbs_probe(struct i2c_client *client)
skip_gpio:
/*
* Before we register, we might need to make sure we can actually talk
- * to the battery.
+ * to the battery. If a failure occurs when talking to the battery, we
+ * will return -EPROBE_DEFER for probe retry.
*/
if (!(force_load || chip->gpio_detect)) {
union power_supply_propval val;
@@ -1195,7 +1196,7 @@ static int sbs_probe(struct i2c_client *client)
rc = sbs_get_battery_presence_and_health(
client, POWER_SUPPLY_PROP_PRESENT, &val);
if (rc < 0 || !val.intval)
- return dev_err_probe(&client->dev, -ENODEV,
+ return dev_err_probe(&client->dev, -EPROBE_DEFER,
"Failed to get present status\n");
}
--
2.34.1
Powered by blists - more mailing lists