Re: [PATCH 2/2] Add driver for MAX17211/MAX17215 fuel gauge

From: Sebastian Reichel
Date: Sun Apr 30 2017 - 16:44:28 EST


Hi,

On Sun, Apr 30, 2017 at 08:32:10PM +0300, ÐÐÑÐÐÐÐÐ ÐÐÐÐÑÐÐ ÐÐÐÑÐÐÑÐÐÐÑ wrote:
> > IIRC we already had problems with small THERMAL_NAME_LENGTH before.
> > I suggest to add another patch, that increases THERMAL_NAME_LENGTH
> > (don't forget to Cc/To the thermal subsystem people).
> May be rename "max17211-battery" to "max17211" and remove no_thermal = true?
> This case thermal zone will work again. In current (mainline) kernel all
> drivers "xxxxxx-battery" (like ds2780-battery or ds2760-battery) compiled,
> but not working (not registered). They can start working again without
> thermal zone by adding no_thermal = true or by remove "-battery" from
> platform device name. Alternative limit on THERMAL_NAME_LENGTH may be
> extended.

I think increasing THERMAL_NAME_LENGTH is the right way.

> > > + info->bat = power_supply_register(&pdev->dev, &info->bat_desc,
> > > + &psy_cfg);
> > > + if (IS_ERR(info->bat)) {
> > > + dev_err(info->dev, "failed to register battery\n");
> > > + return PTR_ERR(info->bat);
> > > + }
> > Please use devm_power_supply_register() and drop the remove
> > function.
> Khm... probe/remove paired functions. I can use devm_power_supply_register
> in my code. But all other fuel gauge drivers use classic probe/remove pair.
> Which decision will be more correct?

Most drivers are older than devm_power_supply_register. We already
have a few fuel gauge drivers, which use it, though:

$ git grep devm_power_supply_register | grep "battery"
88pm860x_battery.c: info->battery = devm_power_supply_register(&pdev->dev,
da9150-fg.c: fg->battery = devm_power_supply_register(dev, &fg_desc, NULL);
max17042_battery.c: chip->battery = devm_power_supply_register(&client->dev, max17042_desc,
max8997_charger.c: charger->battery = devm_power_supply_register(&pdev->dev,
max8998_charger.c: max8998->battery = devm_power_supply_register(max8998->dev,
sbs-battery.c: chip->power_supply = devm_power_supply_register(&client->dev, sbs_desc,

-- Sebastian

Attachment: signature.asc
Description: PGP signature