Re: [PATCH v3 02/11] power: charger-manager: don't write through desc->properties

From: Sebastian Reichel
Date: Fri May 01 2020 - 09:48:20 EST


Hi,

On Fri, May 01, 2020 at 03:30:08PM +0200, MichaÅ MirosÅaw wrote:
> 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.

Thanks, I folded this into the charger-manager patch.

-- Sebastian

> 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++;
> }

Attachment: signature.asc
Description: PGP signature