Re: [PATCH v3 02/11] power: charger-manager: don't write through desc->properties
From: Michał Mirosław
Date: Fri May 01 2020 - 09:58:37 EST
On Fri, May 01, 2020 at 02:38:49PM +0200, Sebastian Reichel wrote:
> Hi,
>
> On Fri, Apr 03, 2020 at 10:20:31PM +0200, Michał Mirosław wrote:
> > psy_desc->properties will become pointer to const. Avoid writing
> > through the pointer to enable constification of the tables elsewhere.
> >
> > Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
> For patches 1-3 I used my version, that I wrote in parallel while
> reviewing a different patch series. It is slightly different, but
> achieves the same goal.
There is a bug in the tree now regarding use of num_properties
in charger-manager. Following patch should fix it.
Best Regards,
Michał Mirosław
diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
index a71e2ee81423..2ef53dc1f2fb 100644
--- a/drivers/power/supply/charger-manager.c
+++ b/drivers/power/supply/charger-manager.c
@@ -1740,14 +1740,14 @@ static int charger_manager_probe(struct platform_device *pdev)
}
if (!power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_NOW, &val)) {
- properties[cm->charger_psy_desc.num_properties] =
+ properties[num_properties] =
POWER_SUPPLY_PROP_CHARGE_NOW;
num_properties++;
}
if (!power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CURRENT_NOW,
&val)) {
- properties[cm->charger_psy_desc.num_properties] =
+ properties[num_properties] =
POWER_SUPPLY_PROP_CURRENT_NOW;
num_properties++;
}