Re: [PATCH v7 04/15] power: bq24257: Use managed power supply register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




W dniu 26.09.2015 o 00:54, Andreas Dannenberg pisze:
> Use the devm_* managed version of the function to register the power
> supply and remove the associated unregister function.

Add explanation for "why" you want to use devm method.

After that:
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>

Best regards,
Krzysztof

> 
> Signed-off-by: Andreas Dannenberg <dannenberg@xxxxxx>
> ---
>  drivers/power/bq24257_charger.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/bq24257_charger.c b/drivers/power/bq24257_charger.c
> index d2d077c..6757b41 100644
> --- a/drivers/power/bq24257_charger.c
> +++ b/drivers/power/bq24257_charger.c
> @@ -590,8 +590,10 @@ static int bq24257_power_supply_init(struct bq24257_device *bq)
>  	psy_cfg.supplied_to = bq24257_charger_supplied_to;
>  	psy_cfg.num_supplicants = ARRAY_SIZE(bq24257_charger_supplied_to);
>  
> -	bq->charger = power_supply_register(bq->dev, &bq24257_power_supply_desc,
> -					    &psy_cfg);
> +	bq->charger = devm_power_supply_register(bq->dev,
> +						 &bq24257_power_supply_desc,
> +						 &psy_cfg);
> +
>  	if (IS_ERR(bq->charger))
>  		return PTR_ERR(bq->charger);
>  
> @@ -742,8 +744,6 @@ static int bq24257_remove(struct i2c_client *client)
>  
>  	cancel_delayed_work_sync(&bq->iilimit_setup_work);
>  
> -	power_supply_unregister(bq->charger);
> -
>  	bq24257_field_write(bq, F_RESET, 1); /* reset to defaults */
>  
>  	return 0;
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux