Skip to content

Commit e186bd1

Browse files
committed
Merge power-supply fixes for 6.6 cycle
Merge power-supply fixes for the 6.6 cycle, so that changes to the vexpress driver apply cleanly. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2 parents afc88df + 8894b43 commit e186bd1

File tree

12 files changed

+35
-23
lines changed

12 files changed

+35
-23
lines changed

drivers/power/reset/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ config NVMEM_REBOOT_MODE
300300

301301
config POWER_MLXBF
302302
tristate "Mellanox BlueField power handling driver"
303-
depends on (GPIO_MLXBF2 && ACPI)
303+
depends on (GPIO_MLXBF2 || GPIO_MLXBF3) && ACPI
304304
help
305305
This driver supports reset or low power mode handling for Mellanox BlueField.
306306

drivers/power/reset/pwr-mlxbf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: GPL-2.0-only or BSD-3-Clause
1+
// SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
22

33
/*
44
* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES.

drivers/power/reset/vexpress-poweroff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int vexpress_reset_probe(struct platform_device *pdev)
121121
return PTR_ERR(regmap);
122122
dev_set_drvdata(&pdev->dev, regmap);
123123

124-
switch ((enum vexpress_reset_func)match->data) {
124+
switch ((uintptr_t)match->data) {
125125
case FUNC_SHUTDOWN:
126126
vexpress_power_off_device = &pdev->dev;
127127
pm_power_off = vexpress_power_off;

drivers/power/supply/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ config BATTERY_RT5033
792792
config CHARGER_RT5033
793793
tristate "RT5033 battery charger support"
794794
depends on MFD_RT5033
795+
depends on EXTCON || !EXTCON
795796
help
796797
This adds support for battery charger in Richtek RT5033 PMIC.
797798
The device supports pre-charge mode, fast charge mode and

drivers/power/supply/ab8500_btemp.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ struct ab8500_btemp {
115115
static enum power_supply_property ab8500_btemp_props[] = {
116116
POWER_SUPPLY_PROP_PRESENT,
117117
POWER_SUPPLY_PROP_ONLINE,
118-
POWER_SUPPLY_PROP_TECHNOLOGY,
119118
POWER_SUPPLY_PROP_TEMP,
120119
};
121120

@@ -532,12 +531,6 @@ static int ab8500_btemp_get_property(struct power_supply *psy,
532531
else
533532
val->intval = 1;
534533
break;
535-
case POWER_SUPPLY_PROP_TECHNOLOGY:
536-
if (di->bm->bi)
537-
val->intval = di->bm->bi->technology;
538-
else
539-
val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
540-
break;
541534
case POWER_SUPPLY_PROP_TEMP:
542535
val->intval = ab8500_btemp_get_temp(di);
543536
break;
@@ -662,7 +655,7 @@ static char *supply_interface[] = {
662655

663656
static const struct power_supply_desc ab8500_btemp_desc = {
664657
.name = "ab8500_btemp",
665-
.type = POWER_SUPPLY_TYPE_BATTERY,
658+
.type = POWER_SUPPLY_TYPE_UNKNOWN,
666659
.properties = ab8500_btemp_props,
667660
.num_properties = ARRAY_SIZE(ab8500_btemp_props),
668661
.get_property = ab8500_btemp_get_property,

drivers/power/supply/ab8500_chargalg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ static char *supply_interface[] = {
17201720

17211721
static const struct power_supply_desc ab8500_chargalg_desc = {
17221722
.name = "ab8500_chargalg",
1723-
.type = POWER_SUPPLY_TYPE_BATTERY,
1723+
.type = POWER_SUPPLY_TYPE_UNKNOWN,
17241724
.properties = ab8500_chargalg_props,
17251725
.num_properties = ARRAY_SIZE(ab8500_chargalg_props),
17261726
.get_property = ab8500_chargalg_get_property,

drivers/power/supply/mt6370-charger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static int mt6370_chg_toggle_cfo(struct mt6370_priv *priv)
324324

325325
if (fl_strobe) {
326326
dev_err(priv->dev, "Flash led is still in strobe mode\n");
327-
return ret;
327+
return -EINVAL;
328328
}
329329

330330
/* cfo off */

drivers/power/supply/power_supply_sysfs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,13 @@ int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env)
476476
if (ret)
477477
return ret;
478478

479+
/*
480+
* Kernel generates KOBJ_REMOVE uevent in device removal path, after
481+
* resources have been freed. Exit early to avoid use-after-free.
482+
*/
483+
if (psy->removing)
484+
return 0;
485+
479486
prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
480487
if (!prop_buf)
481488
return -ENOMEM;

drivers/power/supply/qcom_battmgr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct qcom_battmgr_property_request {
105105

106106
struct qcom_battmgr_update_request {
107107
struct pmic_glink_hdr hdr;
108-
u32 battery_id;
108+
__le32 battery_id;
109109
};
110110

111111
struct qcom_battmgr_charge_time_request {
@@ -1282,9 +1282,9 @@ static void qcom_battmgr_enable_worker(struct work_struct *work)
12821282
{
12831283
struct qcom_battmgr *battmgr = container_of(work, struct qcom_battmgr, enable_work);
12841284
struct qcom_battmgr_enable_request req = {
1285-
.hdr.owner = PMIC_GLINK_OWNER_BATTMGR,
1286-
.hdr.type = PMIC_GLINK_NOTIFY,
1287-
.hdr.opcode = BATTMGR_REQUEST_NOTIFICATION,
1285+
.hdr.owner = cpu_to_le32(PMIC_GLINK_OWNER_BATTMGR),
1286+
.hdr.type = cpu_to_le32(PMIC_GLINK_NOTIFY),
1287+
.hdr.opcode = cpu_to_le32(BATTMGR_REQUEST_NOTIFICATION),
12881288
};
12891289
int ret;
12901290

drivers/power/supply/rk817_charger.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,13 @@ static void rk817_charging_monitor(struct work_struct *work)
10451045
queue_delayed_work(system_wq, &charger->work, msecs_to_jiffies(8000));
10461046
}
10471047

1048+
static void rk817_cleanup_node(void *data)
1049+
{
1050+
struct device_node *node = data;
1051+
1052+
of_node_put(node);
1053+
}
1054+
10481055
static int rk817_charger_probe(struct platform_device *pdev)
10491056
{
10501057
struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
@@ -1061,11 +1068,13 @@ static int rk817_charger_probe(struct platform_device *pdev)
10611068
if (!node)
10621069
return -ENODEV;
10631070

1071+
ret = devm_add_action_or_reset(&pdev->dev, rk817_cleanup_node, node);
1072+
if (ret)
1073+
return ret;
1074+
10641075
charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL);
1065-
if (!charger) {
1066-
of_node_put(node);
1076+
if (!charger)
10671077
return -ENOMEM;
1068-
}
10691078

10701079
charger->rk808 = rk808;
10711080

@@ -1224,3 +1233,4 @@ MODULE_DESCRIPTION("Battery power supply driver for RK817 PMIC");
12241233
MODULE_AUTHOR("Maya Matuszczyk <maccraft123mc@gmail.com>");
12251234
MODULE_AUTHOR("Chris Morgan <macromorgan@hotmail.com>");
12261235
MODULE_LICENSE("GPL");
1236+
MODULE_ALIAS("platform:rk817-charger");

0 commit comments

Comments
 (0)