diff mbox

power: supply: cpcap-charger: Add missing power_supply_config

Message ID 20170615044108.26707-1-tony@atomide.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Tony Lindgren June 15, 2017, 4:41 a.m. UTC
Otherwise cpcap-battery won't probe properly with the power-supplies
property configured but will fail with "Not all required supplies found,
defer probe".

Cc: Marcel Partap <mpartap@gmx.net>
Cc: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/power/supply/cpcap-charger.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Sebastian Reichel June 15, 2017, 12:55 p.m. UTC | #1
Hi,

On Wed, Jun 14, 2017 at 09:41:08PM -0700, Tony Lindgren wrote:
> Otherwise cpcap-battery won't probe properly with the power-supplies
> property configured but will fail with "Not all required supplies found,
> defer probe".
> 
> Cc: Marcel Partap <mpartap@gmx.net>
> Cc: Michael Scott <michael.scott@linaro.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Thanks, queued.

-- Sebastian

> ---
>  drivers/power/supply/cpcap-charger.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c
> --- a/drivers/power/supply/cpcap-charger.c
> +++ b/drivers/power/supply/cpcap-charger.c
> @@ -637,6 +637,7 @@ static int cpcap_charger_probe(struct platform_device *pdev)
>  {
>  	struct cpcap_charger_ddata *ddata;
>  	const struct of_device_id *of_id;
> +	struct power_supply_config psy_cfg = {};
>  	int error;
>  
>  	of_id = of_match_device(of_match_ptr(cpcap_charger_id_table),
> @@ -665,9 +666,12 @@ static int cpcap_charger_probe(struct platform_device *pdev)
>  
>  	atomic_set(&ddata->active, 1);
>  
> +	psy_cfg.of_node = pdev->dev.of_node;
> +	psy_cfg.drv_data = ddata;
> +
>  	ddata->usb = devm_power_supply_register(ddata->dev,
>  						&cpcap_charger_usb_desc,
> -						NULL);
> +						&psy_cfg);
>  	if (IS_ERR(ddata->usb)) {
>  		error = PTR_ERR(ddata->usb);
>  		dev_err(ddata->dev, "failed to register USB charger: %i\n",
> -- 
> 2.13.0
diff mbox

Patch

diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c
--- a/drivers/power/supply/cpcap-charger.c
+++ b/drivers/power/supply/cpcap-charger.c
@@ -637,6 +637,7 @@  static int cpcap_charger_probe(struct platform_device *pdev)
 {
 	struct cpcap_charger_ddata *ddata;
 	const struct of_device_id *of_id;
+	struct power_supply_config psy_cfg = {};
 	int error;
 
 	of_id = of_match_device(of_match_ptr(cpcap_charger_id_table),
@@ -665,9 +666,12 @@  static int cpcap_charger_probe(struct platform_device *pdev)
 
 	atomic_set(&ddata->active, 1);
 
+	psy_cfg.of_node = pdev->dev.of_node;
+	psy_cfg.drv_data = ddata;
+
 	ddata->usb = devm_power_supply_register(ddata->dev,
 						&cpcap_charger_usb_desc,
-						NULL);
+						&psy_cfg);
 	if (IS_ERR(ddata->usb)) {
 		error = PTR_ERR(ddata->usb);
 		dev_err(ddata->dev, "failed to register USB charger: %i\n",