Re: [PATCH 2/3] power: supply: New driver for LEGO MINDSTORMS EV3 battery
From: Sebastian Reichel
Date: Tue Apr 11 2017 - 12:02:15 EST
Hi,
Driver looks fine. One minor thing, though:
On Mon, Apr 03, 2017 at 03:23:48PM -0500, David Lechner wrote:
> [...]
>
> + batt->psy = power_supply_register(dev, &lego_ev3_battery_desc, &psy_cfg);
> + err = PTR_ERR_OR_ZERO(batt->psy);
> + if (err) {
> + dev_err(dev, "failed to register power supply\n");
> + return err;
> + }
There is devm_power_supply_register() and it makes sense to use it,
since that means you can drop the remove function completly :)
> + return 0;
> +}
> +
> +static int lego_ev3_battery_remove(struct platform_device *pdev)
> +{
> + struct lego_ev3_battery *batt = platform_get_drvdata(pdev);
> +
> + power_supply_unregister(batt->psy);
> +
> + return 0;
> +}
-- Sebastian
Attachment:
signature.asc
Description: PGP signature