diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2015-03-12 03:44:02 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2015-03-13 18:15:12 -0400 |
commit | 2dc9215d7c94f7f9f34ccf8b1710ad73d82f6216 (patch) | |
tree | b8bae66b916e1f64dd725a68bca2182ee315bf66 /drivers/power | |
parent | e44ea364394499d38a26ed4c9668fb378ae8797f (diff) |
power_supply: Move run-time configuration to separate structure
Add new structure 'power_supply_config' for holding run-time
initialization data like of_node, supplies and private driver data.
The power_supply_register() function is changed so all power supply
drivers need updating.
When registering the power supply this new 'power_supply_config' should be
used instead of directly initializing 'struct power_supply'. This allows
changing the ownership of power_supply structure from driver to the
power supply core in next patches.
When a driver does not use of_node or supplies then it should use NULL
as config. If driver uses of_node or supplies then it should allocate
config on stack and initialize it with proper values.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
[for the nvec part]
Reviewed-by: Marc Dietrich <marvin24@gmx.de>
[for drivers/platform/x86/compal-laptop.c]
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
[for drivers/hid/*]
Reviewed-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
59 files changed, 190 insertions, 150 deletions
diff --git a/drivers/power/88pm860x_battery.c b/drivers/power/88pm860x_battery.c index bd3c997f4fee..a99d7f2829a7 100644 --- a/drivers/power/88pm860x_battery.c +++ b/drivers/power/88pm860x_battery.c | |||
@@ -953,7 +953,7 @@ static int pm860x_battery_probe(struct platform_device *pdev) | |||
953 | else | 953 | else |
954 | info->resistor = 300; /* set default internal resistor */ | 954 | info->resistor = 300; /* set default internal resistor */ |
955 | 955 | ||
956 | ret = power_supply_register(&pdev->dev, &info->battery); | 956 | ret = power_supply_register(&pdev->dev, &info->battery, NULL); |
957 | if (ret) | 957 | if (ret) |
958 | return ret; | 958 | return ret; |
959 | info->battery.dev->parent = &pdev->dev; | 959 | info->battery.dev->parent = &pdev->dev; |
diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c index 734ec4afa14d..ac352a6c03ea 100644 --- a/drivers/power/88pm860x_charger.c +++ b/drivers/power/88pm860x_charger.c | |||
@@ -648,6 +648,7 @@ static struct pm860x_irq_desc { | |||
648 | static int pm860x_charger_probe(struct platform_device *pdev) | 648 | static int pm860x_charger_probe(struct platform_device *pdev) |
649 | { | 649 | { |
650 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | 650 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); |
651 | struct power_supply_config psy_cfg = {}; | ||
651 | struct pm860x_charger_info *info; | 652 | struct pm860x_charger_info *info; |
652 | int ret; | 653 | int ret; |
653 | int count; | 654 | int count; |
@@ -687,12 +688,12 @@ static int pm860x_charger_probe(struct platform_device *pdev) | |||
687 | 688 | ||
688 | info->usb.name = "usb"; | 689 | info->usb.name = "usb"; |
689 | info->usb.type = POWER_SUPPLY_TYPE_USB; | 690 | info->usb.type = POWER_SUPPLY_TYPE_USB; |
690 | info->usb.supplied_to = pm860x_supplied_to; | ||
691 | info->usb.num_supplicants = ARRAY_SIZE(pm860x_supplied_to); | ||
692 | info->usb.properties = pm860x_usb_props; | 691 | info->usb.properties = pm860x_usb_props; |
693 | info->usb.num_properties = ARRAY_SIZE(pm860x_usb_props); | 692 | info->usb.num_properties = ARRAY_SIZE(pm860x_usb_props); |
694 | info->usb.get_property = pm860x_usb_get_prop; | 693 | info->usb.get_property = pm860x_usb_get_prop; |
695 | ret = power_supply_register(&pdev->dev, &info->usb); | 694 | psy_cfg.supplied_to = pm860x_supplied_to; |
695 | psy_cfg.num_supplicants = ARRAY_SIZE(pm860x_supplied_to); | ||
696 | ret = power_supply_register(&pdev->dev, &info->usb, &psy_cfg); | ||
696 | if (ret) | 697 | if (ret) |
697 | goto out; | 698 | goto out; |
698 | 699 | ||
diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 4ebf7b0819f7..d5683f503a4e 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c | |||
@@ -1058,6 +1058,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev) | |||
1058 | { | 1058 | { |
1059 | struct device_node *np = pdev->dev.of_node; | 1059 | struct device_node *np = pdev->dev.of_node; |
1060 | struct abx500_bm_data *plat = pdev->dev.platform_data; | 1060 | struct abx500_bm_data *plat = pdev->dev.platform_data; |
1061 | struct power_supply_config psy_cfg = {}; | ||
1061 | struct ab8500_btemp *di; | 1062 | struct ab8500_btemp *di; |
1062 | int irq, i, ret = 0; | 1063 | int irq, i, ret = 0; |
1063 | u8 val; | 1064 | u8 val; |
@@ -1095,11 +1096,11 @@ static int ab8500_btemp_probe(struct platform_device *pdev) | |||
1095 | di->btemp_psy.properties = ab8500_btemp_props; | 1096 | di->btemp_psy.properties = ab8500_btemp_props; |
1096 | di->btemp_psy.num_properties = ARRAY_SIZE(ab8500_btemp_props); | 1097 | di->btemp_psy.num_properties = ARRAY_SIZE(ab8500_btemp_props); |
1097 | di->btemp_psy.get_property = ab8500_btemp_get_property; | 1098 | di->btemp_psy.get_property = ab8500_btemp_get_property; |
1098 | di->btemp_psy.supplied_to = supply_interface; | ||
1099 | di->btemp_psy.num_supplicants = ARRAY_SIZE(supply_interface); | ||
1100 | di->btemp_psy.external_power_changed = | 1099 | di->btemp_psy.external_power_changed = |
1101 | ab8500_btemp_external_power_changed; | 1100 | ab8500_btemp_external_power_changed; |
1102 | 1101 | ||
1102 | psy_cfg.supplied_to = supply_interface; | ||
1103 | psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface); | ||
1103 | 1104 | ||
1104 | /* Create a work queue for the btemp */ | 1105 | /* Create a work queue for the btemp */ |
1105 | di->btemp_wq = | 1106 | di->btemp_wq = |
@@ -1140,7 +1141,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev) | |||
1140 | } | 1141 | } |
1141 | 1142 | ||
1142 | /* Register BTEMP power supply class */ | 1143 | /* Register BTEMP power supply class */ |
1143 | ret = power_supply_register(di->dev, &di->btemp_psy); | 1144 | ret = power_supply_register(di->dev, &di->btemp_psy, &psy_cfg); |
1144 | if (ret) { | 1145 | if (ret) { |
1145 | dev_err(di->dev, "failed to register BTEMP psy\n"); | 1146 | dev_err(di->dev, "failed to register BTEMP psy\n"); |
1146 | goto free_btemp_wq; | 1147 | goto free_btemp_wq; |
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index 8c8d170ff0f8..cee9b9e46825 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c | |||
@@ -3446,6 +3446,7 @@ static int ab8500_charger_probe(struct platform_device *pdev) | |||
3446 | { | 3446 | { |
3447 | struct device_node *np = pdev->dev.of_node; | 3447 | struct device_node *np = pdev->dev.of_node; |
3448 | struct abx500_bm_data *plat = pdev->dev.platform_data; | 3448 | struct abx500_bm_data *plat = pdev->dev.platform_data; |
3449 | struct power_supply_config psy_cfg = {}; | ||
3449 | struct ab8500_charger *di; | 3450 | struct ab8500_charger *di; |
3450 | int irq, i, charger_status, ret = 0, ch_stat; | 3451 | int irq, i, charger_status, ret = 0, ch_stat; |
3451 | 3452 | ||
@@ -3483,6 +3484,10 @@ static int ab8500_charger_probe(struct platform_device *pdev) | |||
3483 | di->autopower = false; | 3484 | di->autopower = false; |
3484 | di->invalid_charger_detect_state = 0; | 3485 | di->invalid_charger_detect_state = 0; |
3485 | 3486 | ||
3487 | /* AC and USB supply config */ | ||
3488 | psy_cfg.supplied_to = supply_interface; | ||
3489 | psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface); | ||
3490 | |||
3486 | /* AC supply */ | 3491 | /* AC supply */ |
3487 | /* power_supply base class */ | 3492 | /* power_supply base class */ |
3488 | di->ac_chg.psy.name = "ab8500_ac"; | 3493 | di->ac_chg.psy.name = "ab8500_ac"; |
@@ -3490,8 +3495,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) | |||
3490 | di->ac_chg.psy.properties = ab8500_charger_ac_props; | 3495 | di->ac_chg.psy.properties = ab8500_charger_ac_props; |
3491 | di->ac_chg.psy.num_properties = ARRAY_SIZE(ab8500_charger_ac_props); | 3496 | di->ac_chg.psy.num_properties = ARRAY_SIZE(ab8500_charger_ac_props); |
3492 | di->ac_chg.psy.get_property = ab8500_charger_ac_get_property; | 3497 | di->ac_chg.psy.get_property = ab8500_charger_ac_get_property; |
3493 | di->ac_chg.psy.supplied_to = supply_interface; | ||
3494 | di->ac_chg.psy.num_supplicants = ARRAY_SIZE(supply_interface), | ||
3495 | /* ux500_charger sub-class */ | 3498 | /* ux500_charger sub-class */ |
3496 | di->ac_chg.ops.enable = &ab8500_charger_ac_en; | 3499 | di->ac_chg.ops.enable = &ab8500_charger_ac_en; |
3497 | di->ac_chg.ops.check_enable = &ab8500_charger_ac_check_enable; | 3500 | di->ac_chg.ops.check_enable = &ab8500_charger_ac_check_enable; |
@@ -3517,8 +3520,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) | |||
3517 | di->usb_chg.psy.properties = ab8500_charger_usb_props; | 3520 | di->usb_chg.psy.properties = ab8500_charger_usb_props; |
3518 | di->usb_chg.psy.num_properties = ARRAY_SIZE(ab8500_charger_usb_props); | 3521 | di->usb_chg.psy.num_properties = ARRAY_SIZE(ab8500_charger_usb_props); |
3519 | di->usb_chg.psy.get_property = ab8500_charger_usb_get_property; | 3522 | di->usb_chg.psy.get_property = ab8500_charger_usb_get_property; |
3520 | di->usb_chg.psy.supplied_to = supply_interface; | ||
3521 | di->usb_chg.psy.num_supplicants = ARRAY_SIZE(supply_interface), | ||
3522 | /* ux500_charger sub-class */ | 3523 | /* ux500_charger sub-class */ |
3523 | di->usb_chg.ops.enable = &ab8500_charger_usb_en; | 3524 | di->usb_chg.ops.enable = &ab8500_charger_usb_en; |
3524 | di->usb_chg.ops.check_enable = &ab8500_charger_usb_check_enable; | 3525 | di->usb_chg.ops.check_enable = &ab8500_charger_usb_check_enable; |
@@ -3616,7 +3617,8 @@ static int ab8500_charger_probe(struct platform_device *pdev) | |||
3616 | 3617 | ||
3617 | /* Register AC charger class */ | 3618 | /* Register AC charger class */ |
3618 | if (di->ac_chg.enabled) { | 3619 | if (di->ac_chg.enabled) { |
3619 | ret = power_supply_register(di->dev, &di->ac_chg.psy); | 3620 | ret = power_supply_register(di->dev, &di->ac_chg.psy, |
3621 | &psy_cfg); | ||
3620 | if (ret) { | 3622 | if (ret) { |
3621 | dev_err(di->dev, "failed to register AC charger\n"); | 3623 | dev_err(di->dev, "failed to register AC charger\n"); |
3622 | goto free_charger_wq; | 3624 | goto free_charger_wq; |
@@ -3625,7 +3627,8 @@ static int ab8500_charger_probe(struct platform_device *pdev) | |||
3625 | 3627 | ||
3626 | /* Register USB charger class */ | 3628 | /* Register USB charger class */ |
3627 | if (di->usb_chg.enabled) { | 3629 | if (di->usb_chg.enabled) { |
3628 | ret = power_supply_register(di->dev, &di->usb_chg.psy); | 3630 | ret = power_supply_register(di->dev, &di->usb_chg.psy, |
3631 | &psy_cfg); | ||
3629 | if (ret) { | 3632 | if (ret) { |
3630 | dev_err(di->dev, "failed to register USB charger\n"); | 3633 | dev_err(di->dev, "failed to register USB charger\n"); |
3631 | goto free_ac; | 3634 | goto free_ac; |
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index d30387bc4c21..73bdb4dc4142 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c | |||
@@ -3075,6 +3075,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) | |||
3075 | { | 3075 | { |
3076 | struct device_node *np = pdev->dev.of_node; | 3076 | struct device_node *np = pdev->dev.of_node; |
3077 | struct abx500_bm_data *plat = pdev->dev.platform_data; | 3077 | struct abx500_bm_data *plat = pdev->dev.platform_data; |
3078 | struct power_supply_config psy_cfg = {}; | ||
3078 | struct ab8500_fg *di; | 3079 | struct ab8500_fg *di; |
3079 | int i, irq; | 3080 | int i, irq; |
3080 | int ret = 0; | 3081 | int ret = 0; |
@@ -3111,10 +3112,11 @@ static int ab8500_fg_probe(struct platform_device *pdev) | |||
3111 | di->fg_psy.properties = ab8500_fg_props; | 3112 | di->fg_psy.properties = ab8500_fg_props; |
3112 | di->fg_psy.num_properties = ARRAY_SIZE(ab8500_fg_props); | 3113 | di->fg_psy.num_properties = ARRAY_SIZE(ab8500_fg_props); |
3113 | di->fg_psy.get_property = ab8500_fg_get_property; | 3114 | di->fg_psy.get_property = ab8500_fg_get_property; |
3114 | di->fg_psy.supplied_to = supply_interface; | ||
3115 | di->fg_psy.num_supplicants = ARRAY_SIZE(supply_interface), | ||
3116 | di->fg_psy.external_power_changed = ab8500_fg_external_power_changed; | 3115 | di->fg_psy.external_power_changed = ab8500_fg_external_power_changed; |
3117 | 3116 | ||
3117 | psy_cfg.supplied_to = supply_interface; | ||
3118 | psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface); | ||
3119 | |||
3118 | di->bat_cap.max_mah_design = MILLI_TO_MICRO * | 3120 | di->bat_cap.max_mah_design = MILLI_TO_MICRO * |
3119 | di->bm->bat_type[di->bm->batt_id].charge_full_design; | 3121 | di->bm->bat_type[di->bm->batt_id].charge_full_design; |
3120 | 3122 | ||
@@ -3174,7 +3176,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) | |||
3174 | di->flags.batt_id_received = false; | 3176 | di->flags.batt_id_received = false; |
3175 | 3177 | ||
3176 | /* Register FG power supply class */ | 3178 | /* Register FG power supply class */ |
3177 | ret = power_supply_register(di->dev, &di->fg_psy); | 3179 | ret = power_supply_register(di->dev, &di->fg_psy, &psy_cfg); |
3178 | if (ret) { | 3180 | if (ret) { |
3179 | dev_err(di->dev, "failed to register FG psy\n"); | 3181 | dev_err(di->dev, "failed to register FG psy\n"); |
3180 | goto free_inst_curr_wq; | 3182 | goto free_inst_curr_wq; |
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c index ab54b8dea670..0da4415cbc10 100644 --- a/drivers/power/abx500_chargalg.c +++ b/drivers/power/abx500_chargalg.c | |||
@@ -2047,6 +2047,7 @@ static int abx500_chargalg_probe(struct platform_device *pdev) | |||
2047 | { | 2047 | { |
2048 | struct device_node *np = pdev->dev.of_node; | 2048 | struct device_node *np = pdev->dev.of_node; |
2049 | struct abx500_bm_data *plat = pdev->dev.platform_data; | 2049 | struct abx500_bm_data *plat = pdev->dev.platform_data; |
2050 | struct power_supply_config psy_cfg = {}; | ||
2050 | struct abx500_chargalg *di; | 2051 | struct abx500_chargalg *di; |
2051 | int ret = 0; | 2052 | int ret = 0; |
2052 | 2053 | ||
@@ -2080,11 +2081,12 @@ static int abx500_chargalg_probe(struct platform_device *pdev) | |||
2080 | di->chargalg_psy.properties = abx500_chargalg_props; | 2081 | di->chargalg_psy.properties = abx500_chargalg_props; |
2081 | di->chargalg_psy.num_properties = ARRAY_SIZE(abx500_chargalg_props); | 2082 | di->chargalg_psy.num_properties = ARRAY_SIZE(abx500_chargalg_props); |
2082 | di->chargalg_psy.get_property = abx500_chargalg_get_property; | 2083 | di->chargalg_psy.get_property = abx500_chargalg_get_property; |
2083 | di->chargalg_psy.supplied_to = supply_interface; | ||
2084 | di->chargalg_psy.num_supplicants = ARRAY_SIZE(supply_interface), | ||
2085 | di->chargalg_psy.external_power_changed = | 2084 | di->chargalg_psy.external_power_changed = |
2086 | abx500_chargalg_external_power_changed; | 2085 | abx500_chargalg_external_power_changed; |
2087 | 2086 | ||
2087 | psy_cfg.supplied_to = supply_interface; | ||
2088 | psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface); | ||
2089 | |||
2088 | /* Initilialize safety timer */ | 2090 | /* Initilialize safety timer */ |
2089 | hrtimer_init(&di->safety_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); | 2091 | hrtimer_init(&di->safety_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); |
2090 | di->safety_timer.function = abx500_chargalg_safety_timer_expired; | 2092 | di->safety_timer.function = abx500_chargalg_safety_timer_expired; |
@@ -2115,7 +2117,7 @@ static int abx500_chargalg_probe(struct platform_device *pdev) | |||
2115 | di->chg_info.prev_conn_chg = -1; | 2117 | di->chg_info.prev_conn_chg = -1; |
2116 | 2118 | ||
2117 | /* Register chargalg power supply class */ | 2119 | /* Register chargalg power supply class */ |
2118 | ret = power_supply_register(di->dev, &di->chargalg_psy); | 2120 | ret = power_supply_register(di->dev, &di->chargalg_psy, &psy_cfg); |
2119 | if (ret) { | 2121 | if (ret) { |
2120 | dev_err(di->dev, "failed to register chargalg psy\n"); | 2122 | dev_err(di->dev, "failed to register chargalg psy\n"); |
2121 | goto free_chargalg_wq; | 2123 | goto free_chargalg_wq; |
diff --git a/drivers/power/axp288_fuel_gauge.c b/drivers/power/axp288_fuel_gauge.c index c86e709c1880..2bec8d241e62 100644 --- a/drivers/power/axp288_fuel_gauge.c +++ b/drivers/power/axp288_fuel_gauge.c | |||
@@ -1099,7 +1099,7 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) | |||
1099 | info->bat.set_property = fuel_gauge_set_property; | 1099 | info->bat.set_property = fuel_gauge_set_property; |
1100 | info->bat.property_is_writeable = fuel_gauge_property_is_writeable; | 1100 | info->bat.property_is_writeable = fuel_gauge_property_is_writeable; |
1101 | info->bat.external_power_changed = fuel_gauge_external_power_changed; | 1101 | info->bat.external_power_changed = fuel_gauge_external_power_changed; |
1102 | ret = power_supply_register(&pdev->dev, &info->bat); | 1102 | ret = power_supply_register(&pdev->dev, &info->bat, NULL); |
1103 | if (ret) { | 1103 | if (ret) { |
1104 | dev_err(&pdev->dev, "failed to register battery: %d\n", ret); | 1104 | dev_err(&pdev->dev, "failed to register battery: %d\n", ret); |
1105 | return ret; | 1105 | return ret; |
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index 2333d7f1182b..9b509025d687 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c | |||
@@ -1051,7 +1051,7 @@ static int bq2415x_power_supply_init(struct bq2415x_device *bq) | |||
1051 | return -ENOMEM; | 1051 | return -ENOMEM; |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | ret = power_supply_register(bq->dev, &bq->charger); | 1054 | ret = power_supply_register(bq->dev, &bq->charger, NULL); |
1055 | if (ret) { | 1055 | if (ret) { |
1056 | kfree(bq->model); | 1056 | kfree(bq->model); |
1057 | return ret; | 1057 | return ret; |
diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c index d0e8236a6404..54eb58485d55 100644 --- a/drivers/power/bq24190_charger.c +++ b/drivers/power/bq24190_charger.c | |||
@@ -1418,7 +1418,7 @@ static int bq24190_probe(struct i2c_client *client, | |||
1418 | 1418 | ||
1419 | bq24190_charger_init(&bdi->charger); | 1419 | bq24190_charger_init(&bdi->charger); |
1420 | 1420 | ||
1421 | ret = power_supply_register(dev, &bdi->charger); | 1421 | ret = power_supply_register(dev, &bdi->charger, NULL); |
1422 | if (ret) { | 1422 | if (ret) { |
1423 | dev_err(dev, "Can't register charger\n"); | 1423 | dev_err(dev, "Can't register charger\n"); |
1424 | goto out2; | 1424 | goto out2; |
@@ -1426,7 +1426,7 @@ static int bq24190_probe(struct i2c_client *client, | |||
1426 | 1426 | ||
1427 | bq24190_battery_init(&bdi->battery); | 1427 | bq24190_battery_init(&bdi->battery); |
1428 | 1428 | ||
1429 | ret = power_supply_register(dev, &bdi->battery); | 1429 | ret = power_supply_register(dev, &bdi->battery, NULL); |
1430 | if (ret) { | 1430 | if (ret) { |
1431 | dev_err(dev, "Can't register battery\n"); | 1431 | dev_err(dev, "Can't register battery\n"); |
1432 | goto out3; | 1432 | goto out3; |
diff --git a/drivers/power/bq24735-charger.c b/drivers/power/bq24735-charger.c index d022b823305b..242e79bfe217 100644 --- a/drivers/power/bq24735-charger.c +++ b/drivers/power/bq24735-charger.c | |||
@@ -249,6 +249,7 @@ static int bq24735_charger_probe(struct i2c_client *client, | |||
249 | int ret; | 249 | int ret; |
250 | struct bq24735 *charger; | 250 | struct bq24735 *charger; |
251 | struct power_supply *supply; | 251 | struct power_supply *supply; |
252 | struct power_supply_config psy_cfg = {}; | ||
252 | char *name; | 253 | char *name; |
253 | 254 | ||
254 | charger = devm_kzalloc(&client->dev, sizeof(*charger), GFP_KERNEL); | 255 | charger = devm_kzalloc(&client->dev, sizeof(*charger), GFP_KERNEL); |
@@ -284,9 +285,10 @@ static int bq24735_charger_probe(struct i2c_client *client, | |||
284 | supply->properties = bq24735_charger_properties; | 285 | supply->properties = bq24735_charger_properties; |
285 | supply->num_properties = ARRAY_SIZE(bq24735_charger_properties); | 286 | supply->num_properties = ARRAY_SIZE(bq24735_charger_properties); |
286 | supply->get_property = bq24735_charger_get_property; | 287 | supply->get_property = bq24735_charger_get_property; |
287 | supply->supplied_to = charger->pdata->supplied_to; | 288 | |
288 | supply->num_supplicants = charger->pdata->num_supplicants; | 289 | psy_cfg.supplied_to = charger->pdata->supplied_to; |
289 | supply->of_node = client->dev.of_node; | 290 | psy_cfg.num_supplicants = charger->pdata->num_supplicants; |
291 | psy_cfg.of_node = client->dev.of_node; | ||
290 | 292 | ||
291 | i2c_set_clientdata(client, charger); | 293 | i2c_set_clientdata(client, charger); |
292 | 294 | ||
@@ -341,7 +343,7 @@ static int bq24735_charger_probe(struct i2c_client *client, | |||
341 | } | 343 | } |
342 | } | 344 | } |
343 | 345 | ||
344 | ret = power_supply_register(&client->dev, supply); | 346 | ret = power_supply_register(&client->dev, supply, &psy_cfg); |
345 | if (ret < 0) { | 347 | if (ret < 0) { |
346 | dev_err(&client->dev, "Failed to register power supply: %d\n", | 348 | dev_err(&client->dev, "Failed to register power supply: %d\n", |
347 | ret); | 349 | ret); |
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index ba08b5926bfd..a992e43908a2 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c | |||
@@ -791,7 +791,7 @@ static int bq27x00_powersupply_init(struct bq27x00_device_info *di) | |||
791 | INIT_DELAYED_WORK(&di->work, bq27x00_battery_poll); | 791 | INIT_DELAYED_WORK(&di->work, bq27x00_battery_poll); |
792 | mutex_init(&di->lock); | 792 | mutex_init(&di->lock); |
793 | 793 | ||
794 | ret = power_supply_register_no_ws(di->dev, &di->bat); | 794 | ret = power_supply_register_no_ws(di->dev, &di->bat, NULL); |
795 | if (ret) { | 795 | if (ret) { |
796 | dev_err(di->dev, "failed to register battery: %d\n", ret); | 796 | dev_err(di->dev, "failed to register battery: %d\n", ret); |
797 | return ret; | 797 | return ret; |
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 14b0d85318eb..df27600880b9 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c | |||
@@ -1740,7 +1740,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1740 | 1740 | ||
1741 | INIT_DELAYED_WORK(&cm->fullbatt_vchk_work, fullbatt_vchk); | 1741 | INIT_DELAYED_WORK(&cm->fullbatt_vchk_work, fullbatt_vchk); |
1742 | 1742 | ||
1743 | ret = power_supply_register(NULL, &cm->charger_psy); | 1743 | ret = power_supply_register(NULL, &cm->charger_psy, NULL); |
1744 | if (ret) { | 1744 | if (ret) { |
1745 | dev_err(&pdev->dev, "Cannot register charger-manager with name \"%s\"\n", | 1745 | dev_err(&pdev->dev, "Cannot register charger-manager with name \"%s\"\n", |
1746 | cm->charger_psy.name); | 1746 | cm->charger_psy.name); |
diff --git a/drivers/power/collie_battery.c b/drivers/power/collie_battery.c index 594e4dbc2d51..e7a808d1758a 100644 --- a/drivers/power/collie_battery.c +++ b/drivers/power/collie_battery.c | |||
@@ -334,10 +334,10 @@ static int collie_bat_probe(struct ucb1x00_dev *dev) | |||
334 | 334 | ||
335 | INIT_WORK(&bat_work, collie_bat_work); | 335 | INIT_WORK(&bat_work, collie_bat_work); |
336 | 336 | ||
337 | ret = power_supply_register(&dev->ucb->dev, &collie_bat_main.psy); | 337 | ret = power_supply_register(&dev->ucb->dev, &collie_bat_main.psy, NULL); |
338 | if (ret) | 338 | if (ret) |
339 | goto err_psy_reg_main; | 339 | goto err_psy_reg_main; |
340 | ret = power_supply_register(&dev->ucb->dev, &collie_bat_bu.psy); | 340 | ret = power_supply_register(&dev->ucb->dev, &collie_bat_bu.psy, NULL); |
341 | if (ret) | 341 | if (ret) |
342 | goto err_psy_reg_bu; | 342 | goto err_psy_reg_bu; |
343 | 343 | ||
diff --git a/drivers/power/da9030_battery.c b/drivers/power/da9030_battery.c index 78cd5d66144b..a87406ef18ee 100644 --- a/drivers/power/da9030_battery.c +++ b/drivers/power/da9030_battery.c | |||
@@ -541,7 +541,7 @@ static int da9030_battery_probe(struct platform_device *pdev) | |||
541 | goto err_notifier; | 541 | goto err_notifier; |
542 | 542 | ||
543 | da9030_battery_setup_psy(charger); | 543 | da9030_battery_setup_psy(charger); |
544 | ret = power_supply_register(&pdev->dev, &charger->psy); | 544 | ret = power_supply_register(&pdev->dev, &charger->psy, NULL); |
545 | if (ret) | 545 | if (ret) |
546 | goto err_ps_register; | 546 | goto err_ps_register; |
547 | 547 | ||
diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c index d17250f745c2..54ba9ddb6d4f 100644 --- a/drivers/power/da9052-battery.c +++ b/drivers/power/da9052-battery.c | |||
@@ -625,7 +625,7 @@ static s32 da9052_bat_probe(struct platform_device *pdev) | |||
625 | } | 625 | } |
626 | } | 626 | } |
627 | 627 | ||
628 | ret = power_supply_register(&pdev->dev, &bat->psy); | 628 | ret = power_supply_register(&pdev->dev, &bat->psy, NULL); |
629 | if (ret) | 629 | if (ret) |
630 | goto err; | 630 | goto err; |
631 | 631 | ||
diff --git a/drivers/power/da9150-charger.c b/drivers/power/da9150-charger.c index 4df97ea8dcde..db8ba5d8d1e3 100644 --- a/drivers/power/da9150-charger.c +++ b/drivers/power/da9150-charger.c | |||
@@ -550,7 +550,7 @@ static int da9150_charger_probe(struct platform_device *pdev) | |||
550 | usb->properties = da9150_charger_props; | 550 | usb->properties = da9150_charger_props; |
551 | usb->num_properties = ARRAY_SIZE(da9150_charger_props); | 551 | usb->num_properties = ARRAY_SIZE(da9150_charger_props); |
552 | usb->get_property = da9150_charger_get_prop; | 552 | usb->get_property = da9150_charger_get_prop; |
553 | ret = power_supply_register(dev, usb); | 553 | ret = power_supply_register(dev, usb, NULL); |
554 | if (ret) | 554 | if (ret) |
555 | goto usb_fail; | 555 | goto usb_fail; |
556 | 556 | ||
@@ -559,7 +559,7 @@ static int da9150_charger_probe(struct platform_device *pdev) | |||
559 | battery->properties = da9150_charger_bat_props; | 559 | battery->properties = da9150_charger_bat_props; |
560 | battery->num_properties = ARRAY_SIZE(da9150_charger_bat_props); | 560 | battery->num_properties = ARRAY_SIZE(da9150_charger_bat_props); |
561 | battery->get_property = da9150_charger_battery_get_prop; | 561 | battery->get_property = da9150_charger_battery_get_prop; |
562 | ret = power_supply_register(dev, battery); | 562 | ret = power_supply_register(dev, battery, NULL); |
563 | if (ret) | 563 | if (ret) |
564 | goto battery_fail; | 564 | goto battery_fail; |
565 | 565 | ||
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c index 85b4e6eca0b1..e82dff0bbb20 100644 --- a/drivers/power/ds2760_battery.c +++ b/drivers/power/ds2760_battery.c | |||
@@ -555,7 +555,7 @@ static int ds2760_battery_probe(struct platform_device *pdev) | |||
555 | if (current_accum) | 555 | if (current_accum) |
556 | ds2760_battery_set_current_accum(di, current_accum); | 556 | ds2760_battery_set_current_accum(di, current_accum); |
557 | 557 | ||
558 | retval = power_supply_register(&pdev->dev, &di->bat); | 558 | retval = power_supply_register(&pdev->dev, &di->bat, NULL); |
559 | if (retval) { | 559 | if (retval) { |
560 | dev_err(di->dev, "failed to register battery\n"); | 560 | dev_err(di->dev, "failed to register battery\n"); |
561 | goto batt_failed; | 561 | goto batt_failed; |
diff --git a/drivers/power/ds2780_battery.c b/drivers/power/ds2780_battery.c index 9f418fa879e5..b1d3570ea730 100644 --- a/drivers/power/ds2780_battery.c +++ b/drivers/power/ds2780_battery.c | |||
@@ -776,7 +776,7 @@ static int ds2780_battery_probe(struct platform_device *pdev) | |||
776 | dev_info->bat.num_properties = ARRAY_SIZE(ds2780_battery_props); | 776 | dev_info->bat.num_properties = ARRAY_SIZE(ds2780_battery_props); |
777 | dev_info->bat.get_property = ds2780_battery_get_property; | 777 | dev_info->bat.get_property = ds2780_battery_get_property; |
778 | 778 | ||
779 | ret = power_supply_register(&pdev->dev, &dev_info->bat); | 779 | ret = power_supply_register(&pdev->dev, &dev_info->bat, NULL); |
780 | if (ret) { | 780 | if (ret) { |
781 | dev_err(dev_info->dev, "failed to register battery\n"); | 781 | dev_err(dev_info->dev, "failed to register battery\n"); |
782 | goto fail; | 782 | goto fail; |
diff --git a/drivers/power/ds2781_battery.c b/drivers/power/ds2781_battery.c index 0a5acc6fc6f0..50686dc59711 100644 --- a/drivers/power/ds2781_battery.c +++ b/drivers/power/ds2781_battery.c | |||
@@ -769,7 +769,7 @@ static int ds2781_battery_probe(struct platform_device *pdev) | |||
769 | dev_info->bat.num_properties = ARRAY_SIZE(ds2781_battery_props); | 769 | dev_info->bat.num_properties = ARRAY_SIZE(ds2781_battery_props); |
770 | dev_info->bat.get_property = ds2781_battery_get_property; | 770 | dev_info->bat.get_property = ds2781_battery_get_property; |
771 | 771 | ||
772 | ret = power_supply_register(&pdev->dev, &dev_info->bat); | 772 | ret = power_supply_register(&pdev->dev, &dev_info->bat, NULL); |
773 | if (ret) { | 773 | if (ret) { |
774 | dev_err(dev_info->dev, "failed to register battery\n"); | 774 | dev_err(dev_info->dev, "failed to register battery\n"); |
775 | goto fail; | 775 | goto fail; |
diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c index 39694883d3bf..2dcb96a83cee 100644 --- a/drivers/power/ds2782_battery.c +++ b/drivers/power/ds2782_battery.c | |||
@@ -424,7 +424,7 @@ static int ds278x_battery_probe(struct i2c_client *client, | |||
424 | 424 | ||
425 | INIT_DELAYED_WORK(&info->bat_work, ds278x_bat_work); | 425 | INIT_DELAYED_WORK(&info->bat_work, ds278x_bat_work); |
426 | 426 | ||
427 | ret = power_supply_register(&client->dev, &info->battery); | 427 | ret = power_supply_register(&client->dev, &info->battery, NULL); |
428 | if (ret) { | 428 | if (ret) { |
429 | dev_err(&client->dev, "failed to register battery\n"); | 429 | dev_err(&client->dev, "failed to register battery\n"); |
430 | goto fail_register; | 430 | goto fail_register; |
diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c index 0a566ac3eefd..4575955de7c5 100644 --- a/drivers/power/generic-adc-battery.c +++ b/drivers/power/generic-adc-battery.c | |||
@@ -312,7 +312,7 @@ static int gab_probe(struct platform_device *pdev) | |||
312 | */ | 312 | */ |
313 | psy->num_properties = ARRAY_SIZE(gab_props) + index; | 313 | psy->num_properties = ARRAY_SIZE(gab_props) + index; |
314 | 314 | ||
315 | ret = power_supply_register(&pdev->dev, psy); | 315 | ret = power_supply_register(&pdev->dev, psy, NULL); |
316 | if (ret) | 316 | if (ret) |
317 | goto err_reg_fail; | 317 | goto err_reg_fail; |
318 | 318 | ||
diff --git a/drivers/power/goldfish_battery.c b/drivers/power/goldfish_battery.c index 29eba88a2963..61d437f8cf76 100644 --- a/drivers/power/goldfish_battery.c +++ b/drivers/power/goldfish_battery.c | |||
@@ -195,11 +195,11 @@ static int goldfish_battery_probe(struct platform_device *pdev) | |||
195 | if (ret) | 195 | if (ret) |
196 | return ret; | 196 | return ret; |
197 | 197 | ||
198 | ret = power_supply_register(&pdev->dev, &data->ac); | 198 | ret = power_supply_register(&pdev->dev, &data->ac, NULL); |
199 | if (ret) | 199 | if (ret) |
200 | return ret; | 200 | return ret; |
201 | 201 | ||
202 | ret = power_supply_register(&pdev->dev, &data->battery); | 202 | ret = power_supply_register(&pdev->dev, &data->battery, NULL); |
203 | if (ret) { | 203 | if (ret) { |
204 | power_supply_unregister(&data->ac); | 204 | power_supply_unregister(&data->ac); |
205 | return ret; | 205 | return ret; |
diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c index b7424c8501f1..47a9e2bd94d9 100644 --- a/drivers/power/gpio-charger.c +++ b/drivers/power/gpio-charger.c | |||
@@ -127,6 +127,7 @@ struct gpio_charger_platform_data *gpio_charger_parse_dt(struct device *dev) | |||
127 | static int gpio_charger_probe(struct platform_device *pdev) | 127 | static int gpio_charger_probe(struct platform_device *pdev) |
128 | { | 128 | { |
129 | const struct gpio_charger_platform_data *pdata = pdev->dev.platform_data; | 129 | const struct gpio_charger_platform_data *pdata = pdev->dev.platform_data; |
130 | struct power_supply_config psy_cfg = {}; | ||
130 | struct gpio_charger *gpio_charger; | 131 | struct gpio_charger *gpio_charger; |
131 | struct power_supply *charger; | 132 | struct power_supply *charger; |
132 | int ret; | 133 | int ret; |
@@ -161,9 +162,10 @@ static int gpio_charger_probe(struct platform_device *pdev) | |||
161 | charger->properties = gpio_charger_properties; | 162 | charger->properties = gpio_charger_properties; |
162 | charger->num_properties = ARRAY_SIZE(gpio_charger_properties); | 163 | charger->num_properties = ARRAY_SIZE(gpio_charger_properties); |
163 | charger->get_property = gpio_charger_get_property; | 164 | charger->get_property = gpio_charger_get_property; |
164 | charger->supplied_to = pdata->supplied_to; | 165 | |
165 | charger->num_supplicants = pdata->num_supplicants; | 166 | psy_cfg.supplied_to = pdata->supplied_to; |
166 | charger->of_node = pdev->dev.of_node; | 167 | psy_cfg.num_supplicants = pdata->num_supplicants; |
168 | psy_cfg.of_node = pdev->dev.of_node; | ||
167 | 169 | ||
168 | ret = gpio_request(pdata->gpio, dev_name(&pdev->dev)); | 170 | ret = gpio_request(pdata->gpio, dev_name(&pdev->dev)); |
169 | if (ret) { | 171 | if (ret) { |
@@ -178,7 +180,7 @@ static int gpio_charger_probe(struct platform_device *pdev) | |||
178 | 180 | ||
179 | gpio_charger->pdata = pdata; | 181 | gpio_charger->pdata = pdata; |
180 | 182 | ||
181 | ret = power_supply_register(&pdev->dev, charger); | 183 | ret = power_supply_register(&pdev->dev, charger, &psy_cfg); |
182 | if (ret < 0) { | 184 | if (ret < 0) { |
183 | dev_err(&pdev->dev, "Failed to register power supply: %d\n", | 185 | dev_err(&pdev->dev, "Failed to register power supply: %d\n", |
184 | ret); | 186 | ret); |
diff --git a/drivers/power/intel_mid_battery.c b/drivers/power/intel_mid_battery.c index de3f39e6fa8e..8a149657cd71 100644 --- a/drivers/power/intel_mid_battery.c +++ b/drivers/power/intel_mid_battery.c | |||
@@ -692,7 +692,7 @@ static int probe(int irq, struct device *dev) | |||
692 | pbi->batt.properties = pmic_battery_props; | 692 | pbi->batt.properties = pmic_battery_props; |
693 | pbi->batt.num_properties = ARRAY_SIZE(pmic_battery_props); | 693 | pbi->batt.num_properties = ARRAY_SIZE(pmic_battery_props); |
694 | pbi->batt.get_property = pmic_battery_get_property; | 694 | pbi->batt.get_property = pmic_battery_get_property; |
695 | retval = power_supply_register(dev, &pbi->batt); | 695 | retval = power_supply_register(dev, &pbi->batt, NULL); |
696 | if (retval) { | 696 | if (retval) { |
697 | dev_err(dev, | 697 | dev_err(dev, |
698 | "%s(): failed to register pmic battery device with power supply subsystem\n", | 698 | "%s(): failed to register pmic battery device with power supply subsystem\n", |
@@ -712,7 +712,7 @@ static int probe(int irq, struct device *dev) | |||
712 | pbi->usb.properties = pmic_usb_props; | 712 | pbi->usb.properties = pmic_usb_props; |
713 | pbi->usb.num_properties = ARRAY_SIZE(pmic_usb_props); | 713 | pbi->usb.num_properties = ARRAY_SIZE(pmic_usb_props); |
714 | pbi->usb.get_property = pmic_usb_get_property; | 714 | pbi->usb.get_property = pmic_usb_get_property; |
715 | retval = power_supply_register(dev, &pbi->usb); | 715 | retval = power_supply_register(dev, &pbi->usb, NULL); |
716 | if (retval) { | 716 | if (retval) { |
717 | dev_err(dev, | 717 | dev_err(dev, |
718 | "%s(): failed to register pmic usb device with power supply subsystem\n", | 718 | "%s(): failed to register pmic usb device with power supply subsystem\n", |
diff --git a/drivers/power/ipaq_micro_battery.c b/drivers/power/ipaq_micro_battery.c index 96b15e003f3f..842e7e2e1cb5 100644 --- a/drivers/power/ipaq_micro_battery.c +++ b/drivers/power/ipaq_micro_battery.c | |||
@@ -241,11 +241,11 @@ static int micro_batt_probe(struct platform_device *pdev) | |||
241 | platform_set_drvdata(pdev, mb); | 241 | platform_set_drvdata(pdev, mb); |
242 | queue_delayed_work(mb->wq, &mb->update, 1); | 242 | queue_delayed_work(mb->wq, &mb->update, 1); |
243 | 243 | ||
244 | ret = power_supply_register(&pdev->dev, µ_batt_power); | 244 | ret = power_supply_register(&pdev->dev, µ_batt_power, NULL); |
245 | if (ret < 0) | 245 | if (ret < 0) |
246 | goto batt_err; | 246 | goto batt_err; |
247 | 247 | ||
248 | ret = power_supply_register(&pdev->dev, µ_ac_power); | 248 | ret = power_supply_register(&pdev->dev, µ_ac_power, NULL); |
249 | if (ret < 0) | 249 | if (ret < 0) |
250 | goto ac_err; | 250 | goto ac_err; |
251 | 251 | ||
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c index 0b4cf9d63291..5521178bdc08 100644 --- a/drivers/power/isp1704_charger.c +++ b/drivers/power/isp1704_charger.c | |||
@@ -460,7 +460,7 @@ static int isp1704_charger_probe(struct platform_device *pdev) | |||
460 | isp->psy.num_properties = ARRAY_SIZE(power_props); | 460 | isp->psy.num_properties = ARRAY_SIZE(power_props); |
461 | isp->psy.get_property = isp1704_charger_get_property; | 461 | isp->psy.get_property = isp1704_charger_get_property; |
462 | 462 | ||
463 | ret = power_supply_register(isp->dev, &isp->psy); | 463 | ret = power_supply_register(isp->dev, &isp->psy, NULL); |
464 | if (ret) | 464 | if (ret) |
465 | goto fail1; | 465 | goto fail1; |
466 | 466 | ||
diff --git a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c index 9cd391d61819..0444434e1927 100644 --- a/drivers/power/jz4740-battery.c +++ b/drivers/power/jz4740-battery.c | |||
@@ -330,7 +330,7 @@ static int jz_battery_probe(struct platform_device *pdev) | |||
330 | else | 330 | else |
331 | jz4740_adc_set_config(pdev->dev.parent, JZ_ADC_CONFIG_BAT_MB, 0); | 331 | jz4740_adc_set_config(pdev->dev.parent, JZ_ADC_CONFIG_BAT_MB, 0); |
332 | 332 | ||
333 | ret = power_supply_register(&pdev->dev, &jz_battery->battery); | 333 | ret = power_supply_register(&pdev->dev, &jz_battery->battery, NULL); |
334 | if (ret) { | 334 | if (ret) { |
335 | dev_err(&pdev->dev, "power supply battery register failed.\n"); | 335 | dev_err(&pdev->dev, "power supply battery register failed.\n"); |
336 | goto err_free_charge_irq; | 336 | goto err_free_charge_irq; |
diff --git a/drivers/power/lp8727_charger.c b/drivers/power/lp8727_charger.c index 32de636dcd73..1f71af7a3811 100644 --- a/drivers/power/lp8727_charger.c +++ b/drivers/power/lp8727_charger.c | |||
@@ -420,6 +420,7 @@ static void lp8727_charger_changed(struct power_supply *psy) | |||
420 | 420 | ||
421 | static int lp8727_register_psy(struct lp8727_chg *pchg) | 421 | static int lp8727_register_psy(struct lp8727_chg *pchg) |
422 | { | 422 | { |
423 | struct power_supply_config psy_cfg = {}; /* Only for ac and usb */ | ||
423 | struct lp8727_psy *psy; | 424 | struct lp8727_psy *psy; |
424 | 425 | ||
425 | psy = devm_kzalloc(pchg->dev, sizeof(*psy), GFP_KERNEL); | 426 | psy = devm_kzalloc(pchg->dev, sizeof(*psy), GFP_KERNEL); |
@@ -428,15 +429,16 @@ static int lp8727_register_psy(struct lp8727_chg *pchg) | |||
428 | 429 | ||
429 | pchg->psy = psy; | 430 | pchg->psy = psy; |
430 | 431 | ||
432 | psy_cfg.supplied_to = battery_supplied_to; | ||
433 | psy_cfg.num_supplicants = ARRAY_SIZE(battery_supplied_to); | ||
434 | |||
431 | psy->ac.name = "ac"; | 435 | psy->ac.name = "ac"; |
432 | psy->ac.type = POWER_SUPPLY_TYPE_MAINS; | 436 | psy->ac.type = POWER_SUPPLY_TYPE_MAINS; |
433 | psy->ac.properties = lp8727_charger_prop; | 437 | psy->ac.properties = lp8727_charger_prop; |
434 | psy->ac.num_properties = ARRAY_SIZE(lp8727_charger_prop); | 438 | psy->ac.num_properties = ARRAY_SIZE(lp8727_charger_prop); |
435 | psy->ac.get_property = lp8727_charger_get_property; | 439 | psy->ac.get_property = lp8727_charger_get_property; |
436 | psy->ac.supplied_to = battery_supplied_to; | ||
437 | psy->ac.num_supplicants = ARRAY_SIZE(battery_supplied_to); | ||
438 | 440 | ||
439 | if (power_supply_register(pchg->dev, &psy->ac)) | 441 | if (power_supply_register(pchg->dev, &psy->ac, &psy_cfg)) |
440 | goto err_psy_ac; | 442 | goto err_psy_ac; |
441 | 443 | ||
442 | psy->usb.name = "usb"; | 444 | psy->usb.name = "usb"; |
@@ -444,10 +446,8 @@ static int lp8727_register_psy(struct lp8727_chg *pchg) | |||
444 | psy->usb.properties = lp8727_charger_prop; | 446 | psy->usb.properties = lp8727_charger_prop; |
445 | psy->usb.num_properties = ARRAY_SIZE(lp8727_charger_prop); | 447 | psy->usb.num_properties = ARRAY_SIZE(lp8727_charger_prop); |
446 | psy->usb.get_property = lp8727_charger_get_property; | 448 | psy->usb.get_property = lp8727_charger_get_property; |
447 | psy->usb.supplied_to = battery_supplied_to; | ||
448 | psy->usb.num_supplicants = ARRAY_SIZE(battery_supplied_to); | ||
449 | 449 | ||
450 | if (power_supply_register(pchg->dev, &psy->usb)) | 450 | if (power_supply_register(pchg->dev, &psy->usb, &psy_cfg)) |
451 | goto err_psy_usb; | 451 | goto err_psy_usb; |
452 | 452 | ||
453 | psy->batt.name = "main_batt"; | 453 | psy->batt.name = "main_batt"; |
@@ -457,7 +457,7 @@ static int lp8727_register_psy(struct lp8727_chg *pchg) | |||
457 | psy->batt.get_property = lp8727_battery_get_property; | 457 | psy->batt.get_property = lp8727_battery_get_property; |
458 | psy->batt.external_power_changed = lp8727_charger_changed; | 458 | psy->batt.external_power_changed = lp8727_charger_changed; |
459 | 459 | ||
460 | if (power_supply_register(pchg->dev, &psy->batt)) | 460 | if (power_supply_register(pchg->dev, &psy->batt, NULL)) |
461 | goto err_psy_batt; | 461 | goto err_psy_batt; |
462 | 462 | ||
463 | return 0; | 463 | return 0; |
diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c index 176dab2e4c16..8e4d228519c1 100644 --- a/drivers/power/lp8788-charger.c +++ b/drivers/power/lp8788-charger.c | |||
@@ -400,15 +400,18 @@ static int lp8788_update_charger_params(struct platform_device *pdev, | |||
400 | static int lp8788_psy_register(struct platform_device *pdev, | 400 | static int lp8788_psy_register(struct platform_device *pdev, |
401 | struct lp8788_charger *pchg) | 401 | struct lp8788_charger *pchg) |
402 | { | 402 | { |
403 | struct power_supply_config charger_cfg = {}; | ||
404 | |||
403 | pchg->charger.name = LP8788_CHARGER_NAME; | 405 | pchg->charger.name = LP8788_CHARGER_NAME; |
404 | pchg->charger.type = POWER_SUPPLY_TYPE_MAINS; | 406 | pchg->charger.type = POWER_SUPPLY_TYPE_MAINS; |
405 | pchg->charger.properties = lp8788_charger_prop; | 407 | pchg->charger.properties = lp8788_charger_prop; |
406 | pchg->charger.num_properties = ARRAY_SIZE(lp8788_charger_prop); | 408 | pchg->charger.num_properties = ARRAY_SIZE(lp8788_charger_prop); |
407 | pchg->charger.get_property = lp8788_charger_get_property; | 409 | pchg->charger.get_property = lp8788_charger_get_property; |
408 | pchg->charger.supplied_to = battery_supplied_to; | ||
409 | pchg->charger.num_supplicants = ARRAY_SIZE(battery_supplied_to); | ||
410 | 410 | ||
411 | if (power_supply_register(&pdev->dev, &pchg->charger)) | 411 | charger_cfg.supplied_to = battery_supplied_to; |
412 | charger_cfg.num_supplicants = ARRAY_SIZE(battery_supplied_to); | ||
413 | |||
414 | if (power_supply_register(&pdev->dev, &pchg->charger, &charger_cfg)) | ||
412 | return -EPERM; | 415 | return -EPERM; |
413 | 416 | ||
414 | pchg->battery.name = LP8788_BATTERY_NAME; | 417 | pchg->battery.name = LP8788_BATTERY_NAME; |
@@ -417,7 +420,7 @@ static int lp8788_psy_register(struct platform_device *pdev, | |||
417 | pchg->battery.num_properties = ARRAY_SIZE(lp8788_battery_prop); | 420 | pchg->battery.num_properties = ARRAY_SIZE(lp8788_battery_prop); |
418 | pchg->battery.get_property = lp8788_battery_get_property; | 421 | pchg->battery.get_property = lp8788_battery_get_property; |
419 | 422 | ||
420 | if (power_supply_register(&pdev->dev, &pchg->battery)) { | 423 | if (power_supply_register(&pdev->dev, &pchg->battery, NULL)) { |
421 | power_supply_unregister(&pchg->charger); | 424 | power_supply_unregister(&pchg->charger); |
422 | return -EPERM; | 425 | return -EPERM; |
423 | } | 426 | } |
diff --git a/drivers/power/ltc2941-battery-gauge.c b/drivers/power/ltc2941-battery-gauge.c index 50c5d89dcef3..9bc545393ef8 100644 --- a/drivers/power/ltc2941-battery-gauge.c +++ b/drivers/power/ltc2941-battery-gauge.c | |||
@@ -473,7 +473,7 @@ static int ltc294x_i2c_probe(struct i2c_client *client, | |||
473 | goto fail_comm; | 473 | goto fail_comm; |
474 | } | 474 | } |
475 | 475 | ||
476 | ret = power_supply_register(&client->dev, &info->supply); | 476 | ret = power_supply_register(&client->dev, &info->supply, NULL); |
477 | if (ret) { | 477 | if (ret) { |
478 | dev_err(&client->dev, "failed to register ltc2941\n"); | 478 | dev_err(&client->dev, "failed to register ltc2941\n"); |
479 | goto fail_register; | 479 | goto fail_register; |
diff --git a/drivers/power/max14577_charger.c b/drivers/power/max14577_charger.c index 4736dc478578..c5f2a535c81a 100644 --- a/drivers/power/max14577_charger.c +++ b/drivers/power/max14577_charger.c | |||
@@ -594,7 +594,7 @@ static int max14577_charger_probe(struct platform_device *pdev) | |||
594 | return ret; | 594 | return ret; |
595 | } | 595 | } |
596 | 596 | ||
597 | ret = power_supply_register(&pdev->dev, &chg->charger); | 597 | ret = power_supply_register(&pdev->dev, &chg->charger, NULL); |
598 | if (ret) { | 598 | if (ret) { |
599 | dev_err(&pdev->dev, "failed: power supply register\n"); | 599 | dev_err(&pdev->dev, "failed: power supply register\n"); |
600 | goto err; | 600 | goto err; |
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c index 63ff3f705154..d36b2f6c2053 100644 --- a/drivers/power/max17040_battery.c +++ b/drivers/power/max17040_battery.c | |||
@@ -224,7 +224,7 @@ static int max17040_probe(struct i2c_client *client, | |||
224 | chip->battery.properties = max17040_battery_props; | 224 | chip->battery.properties = max17040_battery_props; |
225 | chip->battery.num_properties = ARRAY_SIZE(max17040_battery_props); | 225 | chip->battery.num_properties = ARRAY_SIZE(max17040_battery_props); |
226 | 226 | ||
227 | ret = power_supply_register(&client->dev, &chip->battery); | 227 | ret = power_supply_register(&client->dev, &chip->battery, NULL); |
228 | if (ret) { | 228 | if (ret) { |
229 | dev_err(&client->dev, "failed: power supply register\n"); | 229 | dev_err(&client->dev, "failed: power supply register\n"); |
230 | return ret; | 230 | return ret; |
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c index 830435adfb64..b1ebbc3b8640 100644 --- a/drivers/power/max17042_battery.c +++ b/drivers/power/max17042_battery.c | |||
@@ -731,7 +731,7 @@ static int max17042_probe(struct i2c_client *client, | |||
731 | regmap_write(chip->regmap, MAX17042_LearnCFG, 0x0007); | 731 | regmap_write(chip->regmap, MAX17042_LearnCFG, 0x0007); |
732 | } | 732 | } |
733 | 733 | ||
734 | ret = power_supply_register(&client->dev, &chip->battery); | 734 | ret = power_supply_register(&client->dev, &chip->battery, NULL); |
735 | if (ret) { | 735 | if (ret) { |
736 | dev_err(&client->dev, "failed: power supply register\n"); | 736 | dev_err(&client->dev, "failed: power supply register\n"); |
737 | return ret; | 737 | return ret; |
diff --git a/drivers/power/max77693_charger.c b/drivers/power/max77693_charger.c index ca52e7d15b95..86ea0231175c 100644 --- a/drivers/power/max77693_charger.c +++ b/drivers/power/max77693_charger.c | |||
@@ -714,7 +714,7 @@ static int max77693_charger_probe(struct platform_device *pdev) | |||
714 | goto err; | 714 | goto err; |
715 | } | 715 | } |
716 | 716 | ||
717 | ret = power_supply_register(&pdev->dev, &chg->charger); | 717 | ret = power_supply_register(&pdev->dev, &chg->charger, NULL); |
718 | if (ret) { | 718 | if (ret) { |
719 | dev_err(&pdev->dev, "failed: power supply register\n"); | 719 | dev_err(&pdev->dev, "failed: power supply register\n"); |
720 | goto err; | 720 | goto err; |
diff --git a/drivers/power/max8903_charger.c b/drivers/power/max8903_charger.c index 99e3cdcd3e11..2f769faa85f6 100644 --- a/drivers/power/max8903_charger.c +++ b/drivers/power/max8903_charger.c | |||
@@ -288,7 +288,7 @@ static int max8903_probe(struct platform_device *pdev) | |||
288 | data->psy.properties = max8903_charger_props; | 288 | data->psy.properties = max8903_charger_props; |
289 | data->psy.num_properties = ARRAY_SIZE(max8903_charger_props); | 289 | data->psy.num_properties = ARRAY_SIZE(max8903_charger_props); |
290 | 290 | ||
291 | ret = power_supply_register(dev, &data->psy); | 291 | ret = power_supply_register(dev, &data->psy, NULL); |
292 | if (ret) { | 292 | if (ret) { |
293 | dev_err(dev, "failed: power supply register.\n"); | 293 | dev_err(dev, "failed: power supply register.\n"); |
294 | goto err; | 294 | goto err; |
diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index a6d45eef64dd..71c087e3feaf 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c | |||
@@ -482,6 +482,7 @@ max8925_power_dt_init(struct platform_device *pdev) | |||
482 | static int max8925_power_probe(struct platform_device *pdev) | 482 | static int max8925_power_probe(struct platform_device *pdev) |
483 | { | 483 | { |
484 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | 484 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); |
485 | struct power_supply_config psy_cfg = {}; /* Only for ac and usb */ | ||
485 | struct max8925_power_pdata *pdata = NULL; | 486 | struct max8925_power_pdata *pdata = NULL; |
486 | struct max8925_power_info *info; | 487 | struct max8925_power_info *info; |
487 | int ret; | 488 | int ret; |
@@ -502,14 +503,15 @@ static int max8925_power_probe(struct platform_device *pdev) | |||
502 | info->adc = chip->adc; | 503 | info->adc = chip->adc; |
503 | platform_set_drvdata(pdev, info); | 504 | platform_set_drvdata(pdev, info); |
504 | 505 | ||
506 | psy_cfg.supplied_to = pdata->supplied_to; | ||
507 | psy_cfg.num_supplicants = pdata->num_supplicants; | ||
508 | |||
505 | info->ac.name = "max8925-ac"; | 509 | info->ac.name = "max8925-ac"; |
506 | info->ac.type = POWER_SUPPLY_TYPE_MAINS; | 510 | info->ac.type = POWER_SUPPLY_TYPE_MAINS; |
507 | info->ac.properties = max8925_ac_props; | 511 | info->ac.properties = max8925_ac_props; |
508 | info->ac.num_properties = ARRAY_SIZE(max8925_ac_props); | 512 | info->ac.num_properties = ARRAY_SIZE(max8925_ac_props); |
509 | info->ac.get_property = max8925_ac_get_prop; | 513 | info->ac.get_property = max8925_ac_get_prop; |
510 | info->ac.supplied_to = pdata->supplied_to; | 514 | ret = power_supply_register(&pdev->dev, &info->ac, &psy_cfg); |
511 | info->ac.num_supplicants = pdata->num_supplicants; | ||
512 | ret = power_supply_register(&pdev->dev, &info->ac); | ||
513 | if (ret) | 515 | if (ret) |
514 | goto out; | 516 | goto out; |
515 | info->ac.dev->parent = &pdev->dev; | 517 | info->ac.dev->parent = &pdev->dev; |
@@ -519,10 +521,8 @@ static int max8925_power_probe(struct platform_device *pdev) | |||
519 | info->usb.properties = max8925_usb_props; | 521 | info->usb.properties = max8925_usb_props; |
520 | info->usb.num_properties = ARRAY_SIZE(max8925_usb_props); | 522 | info->usb.num_properties = ARRAY_SIZE(max8925_usb_props); |
521 | info->usb.get_property = max8925_usb_get_prop; | 523 | info->usb.get_property = max8925_usb_get_prop; |
522 | info->usb.supplied_to = pdata->supplied_to; | ||
523 | info->usb.num_supplicants = pdata->num_supplicants; | ||
524 | 524 | ||
525 | ret = power_supply_register(&pdev->dev, &info->usb); | 525 | ret = power_supply_register(&pdev->dev, &info->usb, &psy_cfg); |
526 | if (ret) | 526 | if (ret) |
527 | goto out_usb; | 527 | goto out_usb; |
528 | info->usb.dev->parent = &pdev->dev; | 528 | info->usb.dev->parent = &pdev->dev; |
@@ -532,7 +532,7 @@ static int max8925_power_probe(struct platform_device *pdev) | |||
532 | info->battery.properties = max8925_battery_props; | 532 | info->battery.properties = max8925_battery_props; |
533 | info->battery.num_properties = ARRAY_SIZE(max8925_battery_props); | 533 | info->battery.num_properties = ARRAY_SIZE(max8925_battery_props); |
534 | info->battery.get_property = max8925_bat_get_prop; | 534 | info->battery.get_property = max8925_bat_get_prop; |
535 | ret = power_supply_register(&pdev->dev, &info->battery); | 535 | ret = power_supply_register(&pdev->dev, &info->battery, NULL); |
536 | if (ret) | 536 | if (ret) |
537 | goto out_battery; | 537 | goto out_battery; |
538 | info->battery.dev->parent = &pdev->dev; | 538 | info->battery.dev->parent = &pdev->dev; |
diff --git a/drivers/power/max8997_charger.c b/drivers/power/max8997_charger.c index aefa0c9a3007..a9f4d506eb44 100644 --- a/drivers/power/max8997_charger.c +++ b/drivers/power/max8997_charger.c | |||
@@ -156,7 +156,7 @@ static int max8997_battery_probe(struct platform_device *pdev) | |||
156 | charger->dev = &pdev->dev; | 156 | charger->dev = &pdev->dev; |
157 | charger->iodev = iodev; | 157 | charger->iodev = iodev; |
158 | 158 | ||
159 | ret = power_supply_register(&pdev->dev, &charger->battery); | 159 | ret = power_supply_register(&pdev->dev, &charger->battery, NULL); |
160 | if (ret) { | 160 | if (ret) { |
161 | dev_err(&pdev->dev, "failed: power supply register\n"); | 161 | dev_err(&pdev->dev, "failed: power supply register\n"); |
162 | return ret; | 162 | return ret; |
diff --git a/drivers/power/max8998_charger.c b/drivers/power/max8998_charger.c index 08694c7a9f38..9ee72314b3d0 100644 --- a/drivers/power/max8998_charger.c +++ b/drivers/power/max8998_charger.c | |||
@@ -167,7 +167,7 @@ static int max8998_battery_probe(struct platform_device *pdev) | |||
167 | max8998->battery.properties = max8998_battery_props; | 167 | max8998->battery.properties = max8998_battery_props; |
168 | max8998->battery.num_properties = ARRAY_SIZE(max8998_battery_props); | 168 | max8998->battery.num_properties = ARRAY_SIZE(max8998_battery_props); |
169 | 169 | ||
170 | ret = power_supply_register(max8998->dev, &max8998->battery); | 170 | ret = power_supply_register(max8998->dev, &max8998->battery, NULL); |
171 | if (ret) { | 171 | if (ret) { |
172 | dev_err(max8998->dev, "failed: power supply register\n"); | 172 | dev_err(max8998->dev, "failed: power supply register\n"); |
173 | goto err; | 173 | goto err; |
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c index ad9cde705de1..1340a1a75325 100644 --- a/drivers/power/olpc_battery.c +++ b/drivers/power/olpc_battery.c | |||
@@ -619,7 +619,7 @@ static int olpc_battery_probe(struct platform_device *pdev) | |||
619 | 619 | ||
620 | /* Ignore the status. It doesn't actually matter */ | 620 | /* Ignore the status. It doesn't actually matter */ |
621 | 621 | ||
622 | ret = power_supply_register(&pdev->dev, &olpc_ac); | 622 | ret = power_supply_register(&pdev->dev, &olpc_ac, NULL); |
623 | if (ret) | 623 | if (ret) |
624 | return ret; | 624 | return ret; |
625 | 625 | ||
@@ -631,7 +631,7 @@ static int olpc_battery_probe(struct platform_device *pdev) | |||
631 | olpc_bat.num_properties = ARRAY_SIZE(olpc_xo1_bat_props); | 631 | olpc_bat.num_properties = ARRAY_SIZE(olpc_xo1_bat_props); |
632 | } | 632 | } |
633 | 633 | ||
634 | ret = power_supply_register(&pdev->dev, &olpc_bat); | 634 | ret = power_supply_register(&pdev->dev, &olpc_bat, NULL); |
635 | if (ret) | 635 | if (ret) |
636 | goto battery_failed; | 636 | goto battery_failed; |
637 | 637 | ||
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c index 771c4f0fb8ac..88fe7db2afcf 100644 --- a/drivers/power/pcf50633-charger.c +++ b/drivers/power/pcf50633-charger.c | |||
@@ -368,6 +368,7 @@ static const u8 mbc_irq_handlers[] = { | |||
368 | 368 | ||
369 | static int pcf50633_mbc_probe(struct platform_device *pdev) | 369 | static int pcf50633_mbc_probe(struct platform_device *pdev) |
370 | { | 370 | { |
371 | struct power_supply_config psy_cfg = {}; | ||
371 | struct pcf50633_mbc *mbc; | 372 | struct pcf50633_mbc *mbc; |
372 | int ret; | 373 | int ret; |
373 | int i; | 374 | int i; |
@@ -385,45 +386,42 @@ static int pcf50633_mbc_probe(struct platform_device *pdev) | |||
385 | pcf50633_register_irq(mbc->pcf, mbc_irq_handlers[i], | 386 | pcf50633_register_irq(mbc->pcf, mbc_irq_handlers[i], |
386 | pcf50633_mbc_irq_handler, mbc); | 387 | pcf50633_mbc_irq_handler, mbc); |
387 | 388 | ||
389 | psy_cfg.supplied_to = mbc->pcf->pdata->batteries; | ||
390 | psy_cfg.num_supplicants = mbc->pcf->pdata->num_batteries; | ||
391 | |||
388 | /* Create power supplies */ | 392 | /* Create power supplies */ |
389 | mbc->adapter.name = "adapter"; | 393 | mbc->adapter.name = "adapter"; |
390 | mbc->adapter.type = POWER_SUPPLY_TYPE_MAINS; | 394 | mbc->adapter.type = POWER_SUPPLY_TYPE_MAINS; |
391 | mbc->adapter.properties = power_props; | 395 | mbc->adapter.properties = power_props; |
392 | mbc->adapter.num_properties = ARRAY_SIZE(power_props); | 396 | mbc->adapter.num_properties = ARRAY_SIZE(power_props); |
393 | mbc->adapter.get_property = &adapter_get_property; | 397 | mbc->adapter.get_property = &adapter_get_property; |
394 | mbc->adapter.supplied_to = mbc->pcf->pdata->batteries; | ||
395 | mbc->adapter.num_supplicants = mbc->pcf->pdata->num_batteries; | ||
396 | 398 | ||
397 | mbc->usb.name = "usb"; | 399 | mbc->usb.name = "usb"; |
398 | mbc->usb.type = POWER_SUPPLY_TYPE_USB; | 400 | mbc->usb.type = POWER_SUPPLY_TYPE_USB; |
399 | mbc->usb.properties = power_props; | 401 | mbc->usb.properties = power_props; |
400 | mbc->usb.num_properties = ARRAY_SIZE(power_props); | 402 | mbc->usb.num_properties = ARRAY_SIZE(power_props); |
401 | mbc->usb.get_property = usb_get_property; | 403 | mbc->usb.get_property = usb_get_property; |
402 | mbc->usb.supplied_to = mbc->pcf->pdata->batteries; | ||
403 | mbc->usb.num_supplicants = mbc->pcf->pdata->num_batteries; | ||
404 | 404 | ||
405 | mbc->ac.name = "ac"; | 405 | mbc->ac.name = "ac"; |
406 | mbc->ac.type = POWER_SUPPLY_TYPE_MAINS; | 406 | mbc->ac.type = POWER_SUPPLY_TYPE_MAINS; |
407 | mbc->ac.properties = power_props; | 407 | mbc->ac.properties = power_props; |
408 | mbc->ac.num_properties = ARRAY_SIZE(power_props); | 408 | mbc->ac.num_properties = ARRAY_SIZE(power_props); |
409 | mbc->ac.get_property = ac_get_property; | 409 | mbc->ac.get_property = ac_get_property; |
410 | mbc->ac.supplied_to = mbc->pcf->pdata->batteries; | ||
411 | mbc->ac.num_supplicants = mbc->pcf->pdata->num_batteries; | ||
412 | 410 | ||
413 | ret = power_supply_register(&pdev->dev, &mbc->adapter); | 411 | ret = power_supply_register(&pdev->dev, &mbc->adapter, &psy_cfg); |
414 | if (ret) { | 412 | if (ret) { |
415 | dev_err(mbc->pcf->dev, "failed to register adapter\n"); | 413 | dev_err(mbc->pcf->dev, "failed to register adapter\n"); |
416 | return ret; | 414 | return ret; |
417 | } | 415 | } |
418 | 416 | ||
419 | ret = power_supply_register(&pdev->dev, &mbc->usb); | 417 | ret = power_supply_register(&pdev->dev, &mbc->usb, &psy_cfg); |
420 | if (ret) { | 418 | if (ret) { |
421 | dev_err(mbc->pcf->dev, "failed to register usb\n"); | 419 | dev_err(mbc->pcf->dev, "failed to register usb\n"); |
422 | power_supply_unregister(&mbc->adapter); | 420 | power_supply_unregister(&mbc->adapter); |
423 | return ret; | 421 | return ret; |
424 | } | 422 | } |
425 | 423 | ||
426 | ret = power_supply_register(&pdev->dev, &mbc->ac); | 424 | ret = power_supply_register(&pdev->dev, &mbc->ac, &psy_cfg); |
427 | if (ret) { | 425 | if (ret) { |
428 | dev_err(mbc->pcf->dev, "failed to register ac\n"); | 426 | dev_err(mbc->pcf->dev, "failed to register ac\n"); |
429 | power_supply_unregister(&mbc->adapter); | 427 | power_supply_unregister(&mbc->adapter); |
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c index 0c52e2a0d90c..fd55fad1d0db 100644 --- a/drivers/power/pda_power.c +++ b/drivers/power/pda_power.c | |||
@@ -83,8 +83,6 @@ static char *pda_power_supplied_to[] = { | |||
83 | static struct power_supply pda_psy_ac = { | 83 | static struct power_supply pda_psy_ac = { |
84 | .name = "ac", | 84 | .name = "ac", |
85 | .type = POWER_SUPPLY_TYPE_MAINS, | 85 | .type = POWER_SUPPLY_TYPE_MAINS, |
86 | .supplied_to = pda_power_supplied_to, | ||
87 | .num_supplicants = ARRAY_SIZE(pda_power_supplied_to), | ||
88 | .properties = pda_power_props, | 86 | .properties = pda_power_props, |
89 | .num_properties = ARRAY_SIZE(pda_power_props), | 87 | .num_properties = ARRAY_SIZE(pda_power_props), |
90 | .get_property = pda_power_get_property, | 88 | .get_property = pda_power_get_property, |
@@ -93,8 +91,6 @@ static struct power_supply pda_psy_ac = { | |||
93 | static struct power_supply pda_psy_usb = { | 91 | static struct power_supply pda_psy_usb = { |
94 | .name = "usb", | 92 | .name = "usb", |
95 | .type = POWER_SUPPLY_TYPE_USB, | 93 | .type = POWER_SUPPLY_TYPE_USB, |
96 | .supplied_to = pda_power_supplied_to, | ||
97 | .num_supplicants = ARRAY_SIZE(pda_power_supplied_to), | ||
98 | .properties = pda_power_props, | 94 | .properties = pda_power_props, |
99 | .num_properties = ARRAY_SIZE(pda_power_props), | 95 | .num_properties = ARRAY_SIZE(pda_power_props), |
100 | .get_property = pda_power_get_property, | 96 | .get_property = pda_power_get_property, |
@@ -262,6 +258,7 @@ static int otg_handle_notification(struct notifier_block *nb, | |||
262 | 258 | ||
263 | static int pda_power_probe(struct platform_device *pdev) | 259 | static int pda_power_probe(struct platform_device *pdev) |
264 | { | 260 | { |
261 | struct power_supply_config psy_cfg = {}; | ||
265 | int ret = 0; | 262 | int ret = 0; |
266 | 263 | ||
267 | dev = &pdev->dev; | 264 | dev = &pdev->dev; |
@@ -309,10 +306,11 @@ static int pda_power_probe(struct platform_device *pdev) | |||
309 | usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb"); | 306 | usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb"); |
310 | 307 | ||
311 | if (pdata->supplied_to) { | 308 | if (pdata->supplied_to) { |
312 | pda_psy_ac.supplied_to = pdata->supplied_to; | 309 | psy_cfg.supplied_to = pdata->supplied_to; |
313 | pda_psy_ac.num_supplicants = pdata->num_supplicants; | 310 | psy_cfg.num_supplicants = pdata->num_supplicants; |
314 | pda_psy_usb.supplied_to = pdata->supplied_to; | 311 | } else { |
315 | pda_psy_usb.num_supplicants = pdata->num_supplicants; | 312 | psy_cfg.supplied_to = pda_power_supplied_to; |
313 | psy_cfg.num_supplicants = ARRAY_SIZE(pda_power_supplied_to); | ||
316 | } | 314 | } |
317 | 315 | ||
318 | #if IS_ENABLED(CONFIG_USB_PHY) | 316 | #if IS_ENABLED(CONFIG_USB_PHY) |
@@ -326,7 +324,7 @@ static int pda_power_probe(struct platform_device *pdev) | |||
326 | #endif | 324 | #endif |
327 | 325 | ||
328 | if (pdata->is_ac_online) { | 326 | if (pdata->is_ac_online) { |
329 | ret = power_supply_register(&pdev->dev, &pda_psy_ac); | 327 | ret = power_supply_register(&pdev->dev, &pda_psy_ac, &psy_cfg); |
330 | if (ret) { | 328 | if (ret) { |
331 | dev_err(dev, "failed to register %s power supply\n", | 329 | dev_err(dev, "failed to register %s power supply\n", |
332 | pda_psy_ac.name); | 330 | pda_psy_ac.name); |
@@ -347,7 +345,7 @@ static int pda_power_probe(struct platform_device *pdev) | |||
347 | } | 345 | } |
348 | 346 | ||
349 | if (pdata->is_usb_online) { | 347 | if (pdata->is_usb_online) { |
350 | ret = power_supply_register(&pdev->dev, &pda_psy_usb); | 348 | ret = power_supply_register(&pdev->dev, &pda_psy_usb, &psy_cfg); |
351 | if (ret) { | 349 | if (ret) { |
352 | dev_err(dev, "failed to register %s power supply\n", | 350 | dev_err(dev, "failed to register %s power supply\n", |
353 | pda_psy_usb.name); | 351 | pda_psy_usb.name); |
diff --git a/drivers/power/pm2301_charger.c b/drivers/power/pm2301_charger.c index 777324992c59..d2e88e473238 100644 --- a/drivers/power/pm2301_charger.c +++ b/drivers/power/pm2301_charger.c | |||
@@ -989,6 +989,7 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client, | |||
989 | const struct i2c_device_id *id) | 989 | const struct i2c_device_id *id) |
990 | { | 990 | { |
991 | struct pm2xxx_platform_data *pl_data = i2c_client->dev.platform_data; | 991 | struct pm2xxx_platform_data *pl_data = i2c_client->dev.platform_data; |
992 | struct power_supply_config psy_cfg = {}; | ||
992 | struct pm2xxx_charger *pm2; | 993 | struct pm2xxx_charger *pm2; |
993 | int ret = 0; | 994 | int ret = 0; |
994 | u8 val; | 995 | u8 val; |
@@ -1047,8 +1048,9 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client, | |||
1047 | pm2->ac_chg.psy.properties = pm2xxx_charger_ac_props; | 1048 | pm2->ac_chg.psy.properties = pm2xxx_charger_ac_props; |
1048 | pm2->ac_chg.psy.num_properties = ARRAY_SIZE(pm2xxx_charger_ac_props); | 1049 | pm2->ac_chg.psy.num_properties = ARRAY_SIZE(pm2xxx_charger_ac_props); |
1049 | pm2->ac_chg.psy.get_property = pm2xxx_charger_ac_get_property; | 1050 | pm2->ac_chg.psy.get_property = pm2xxx_charger_ac_get_property; |
1050 | pm2->ac_chg.psy.supplied_to = pm2->pdata->supplied_to; | 1051 | |
1051 | pm2->ac_chg.psy.num_supplicants = pm2->pdata->num_supplicants; | 1052 | psy_cfg.supplied_to = pm2->pdata->supplied_to; |
1053 | psy_cfg.num_supplicants = pm2->pdata->num_supplicants; | ||
1052 | /* pm2xxx_charger sub-class */ | 1054 | /* pm2xxx_charger sub-class */ |
1053 | pm2->ac_chg.ops.enable = &pm2xxx_charger_ac_en; | 1055 | pm2->ac_chg.ops.enable = &pm2xxx_charger_ac_en; |
1054 | pm2->ac_chg.ops.kick_wd = &pm2xxx_charger_watchdog_kick; | 1056 | pm2->ac_chg.ops.kick_wd = &pm2xxx_charger_watchdog_kick; |
@@ -1093,7 +1095,7 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client, | |||
1093 | } | 1095 | } |
1094 | 1096 | ||
1095 | /* Register AC charger class */ | 1097 | /* Register AC charger class */ |
1096 | ret = power_supply_register(pm2->dev, &pm2->ac_chg.psy); | 1098 | ret = power_supply_register(pm2->dev, &pm2->ac_chg.psy, &psy_cfg); |
1097 | if (ret) { | 1099 | if (ret) { |
1098 | dev_err(pm2->dev, "failed to register AC charger\n"); | 1100 | dev_err(pm2->dev, "failed to register AC charger\n"); |
1099 | goto free_regulator; | 1101 | goto free_regulator; |
diff --git a/drivers/power/pmu_battery.c b/drivers/power/pmu_battery.c index 023d24993b87..fb026f19aa4a 100644 --- a/drivers/power/pmu_battery.c +++ b/drivers/power/pmu_battery.c | |||
@@ -152,7 +152,7 @@ static int __init pmu_bat_init(void) | |||
152 | goto pdev_register_failed; | 152 | goto pdev_register_failed; |
153 | } | 153 | } |
154 | 154 | ||
155 | ret = power_supply_register(&bat_pdev->dev, &pmu_ac); | 155 | ret = power_supply_register(&bat_pdev->dev, &pmu_ac, NULL); |
156 | if (ret) | 156 | if (ret) |
157 | goto ac_register_failed; | 157 | goto ac_register_failed; |
158 | 158 | ||
@@ -169,7 +169,7 @@ static int __init pmu_bat_init(void) | |||
169 | pbat->bat.get_property = pmu_bat_get_property; | 169 | pbat->bat.get_property = pmu_bat_get_property; |
170 | pbat->pbi = &pmu_batteries[i]; | 170 | pbat->pbi = &pmu_batteries[i]; |
171 | 171 | ||
172 | ret = power_supply_register(&bat_pdev->dev, &pbat->bat); | 172 | ret = power_supply_register(&bat_pdev->dev, &pbat->bat, NULL); |
173 | if (ret) { | 173 | if (ret) { |
174 | kfree(pbat); | 174 | kfree(pbat); |
175 | goto battery_register_failed; | 175 | goto battery_register_failed; |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 1c0978f961ea..a21e36ed8d41 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -536,7 +536,9 @@ static void psy_unregister_cooler(struct power_supply *psy) | |||
536 | #endif | 536 | #endif |
537 | 537 | ||
538 | static int __power_supply_register(struct device *parent, | 538 | static int __power_supply_register(struct device *parent, |
539 | struct power_supply *psy, bool ws) | 539 | struct power_supply *psy, |
540 | const struct power_supply_config *cfg, | ||
541 | bool ws) | ||
540 | { | 542 | { |
541 | struct device *dev; | 543 | struct device *dev; |
542 | int rc; | 544 | int rc; |
@@ -553,6 +555,12 @@ static int __power_supply_register(struct device *parent, | |||
553 | dev->release = power_supply_dev_release; | 555 | dev->release = power_supply_dev_release; |
554 | dev_set_drvdata(dev, psy); | 556 | dev_set_drvdata(dev, psy); |
555 | psy->dev = dev; | 557 | psy->dev = dev; |
558 | if (cfg) { | ||
559 | psy->drv_data = cfg->drv_data; | ||
560 | psy->of_node = cfg->of_node; | ||
561 | psy->supplied_to = cfg->supplied_to; | ||
562 | psy->num_supplicants = cfg->num_supplicants; | ||
563 | } | ||
556 | 564 | ||
557 | rc = dev_set_name(dev, "%s", psy->name); | 565 | rc = dev_set_name(dev, "%s", psy->name); |
558 | if (rc) | 566 | if (rc) |
@@ -605,15 +613,17 @@ dev_set_name_failed: | |||
605 | return rc; | 613 | return rc; |
606 | } | 614 | } |
607 | 615 | ||
608 | int power_supply_register(struct device *parent, struct power_supply *psy) | 616 | int power_supply_register(struct device *parent, struct power_supply *psy, |
617 | const struct power_supply_config *cfg) | ||
609 | { | 618 | { |
610 | return __power_supply_register(parent, psy, true); | 619 | return __power_supply_register(parent, psy, cfg, true); |
611 | } | 620 | } |
612 | EXPORT_SYMBOL_GPL(power_supply_register); | 621 | EXPORT_SYMBOL_GPL(power_supply_register); |
613 | 622 | ||
614 | int power_supply_register_no_ws(struct device *parent, struct power_supply *psy) | 623 | int power_supply_register_no_ws(struct device *parent, struct power_supply *psy, |
624 | const struct power_supply_config *cfg) | ||
615 | { | 625 | { |
616 | return __power_supply_register(parent, psy, false); | 626 | return __power_supply_register(parent, psy, cfg, false); |
617 | } | 627 | } |
618 | EXPORT_SYMBOL_GPL(power_supply_register_no_ws); | 628 | EXPORT_SYMBOL_GPL(power_supply_register_no_ws); |
619 | 629 | ||
@@ -624,7 +634,8 @@ static void devm_power_supply_release(struct device *dev, void *res) | |||
624 | power_supply_unregister(*psy); | 634 | power_supply_unregister(*psy); |
625 | } | 635 | } |
626 | 636 | ||
627 | int devm_power_supply_register(struct device *parent, struct power_supply *psy) | 637 | int devm_power_supply_register(struct device *parent, struct power_supply *psy, |
638 | const struct power_supply_config *cfg) | ||
628 | { | 639 | { |
629 | struct power_supply **ptr = devres_alloc(devm_power_supply_release, | 640 | struct power_supply **ptr = devres_alloc(devm_power_supply_release, |
630 | sizeof(*ptr), GFP_KERNEL); | 641 | sizeof(*ptr), GFP_KERNEL); |
@@ -632,7 +643,7 @@ int devm_power_supply_register(struct device *parent, struct power_supply *psy) | |||
632 | 643 | ||
633 | if (!ptr) | 644 | if (!ptr) |
634 | return -ENOMEM; | 645 | return -ENOMEM; |
635 | ret = __power_supply_register(parent, psy, true); | 646 | ret = __power_supply_register(parent, psy, cfg, true); |
636 | if (ret < 0) | 647 | if (ret < 0) |
637 | devres_free(ptr); | 648 | devres_free(ptr); |
638 | else { | 649 | else { |
@@ -643,7 +654,8 @@ int devm_power_supply_register(struct device *parent, struct power_supply *psy) | |||
643 | } | 654 | } |
644 | EXPORT_SYMBOL_GPL(devm_power_supply_register); | 655 | EXPORT_SYMBOL_GPL(devm_power_supply_register); |
645 | 656 | ||
646 | int devm_power_supply_register_no_ws(struct device *parent, struct power_supply *psy) | 657 | int devm_power_supply_register_no_ws(struct device *parent, struct power_supply *psy, |
658 | const struct power_supply_config *cfg) | ||
647 | { | 659 | { |
648 | struct power_supply **ptr = devres_alloc(devm_power_supply_release, | 660 | struct power_supply **ptr = devres_alloc(devm_power_supply_release, |
649 | sizeof(*ptr), GFP_KERNEL); | 661 | sizeof(*ptr), GFP_KERNEL); |
@@ -651,7 +663,7 @@ int devm_power_supply_register_no_ws(struct device *parent, struct power_supply | |||
651 | 663 | ||
652 | if (!ptr) | 664 | if (!ptr) |
653 | return -ENOMEM; | 665 | return -ENOMEM; |
654 | ret = __power_supply_register(parent, psy, false); | 666 | ret = __power_supply_register(parent, psy, cfg, false); |
655 | if (ret < 0) | 667 | if (ret < 0) |
656 | devres_free(ptr); | 668 | devres_free(ptr); |
657 | else { | 669 | else { |
diff --git a/drivers/power/rt5033_battery.c b/drivers/power/rt5033_battery.c index 995247af14fc..8cf000baaf36 100644 --- a/drivers/power/rt5033_battery.c +++ b/drivers/power/rt5033_battery.c | |||
@@ -138,7 +138,7 @@ static int rt5033_battery_probe(struct i2c_client *client, | |||
138 | battery->psy.properties = rt5033_battery_props; | 138 | battery->psy.properties = rt5033_battery_props; |
139 | battery->psy.num_properties = ARRAY_SIZE(rt5033_battery_props); | 139 | battery->psy.num_properties = ARRAY_SIZE(rt5033_battery_props); |
140 | 140 | ||
141 | ret = power_supply_register(&client->dev, &battery->psy); | 141 | ret = power_supply_register(&client->dev, &battery->psy, NULL); |
142 | if (ret) { | 142 | if (ret) { |
143 | dev_err(&client->dev, "Failed to register power supply\n"); | 143 | dev_err(&client->dev, "Failed to register power supply\n"); |
144 | return ret; | 144 | return ret; |
diff --git a/drivers/power/rx51_battery.c b/drivers/power/rx51_battery.c index a01aacb32f59..804f60c7b715 100644 --- a/drivers/power/rx51_battery.c +++ b/drivers/power/rx51_battery.c | |||
@@ -238,7 +238,7 @@ static int rx51_battery_probe(struct platform_device *pdev) | |||
238 | goto error_channel_bsi; | 238 | goto error_channel_bsi; |
239 | } | 239 | } |
240 | 240 | ||
241 | ret = power_supply_register(di->dev, &di->bat); | 241 | ret = power_supply_register(di->dev, &di->bat, NULL); |
242 | if (ret) | 242 | if (ret) |
243 | goto error_channel_vbat; | 243 | goto error_channel_vbat; |
244 | 244 | ||
diff --git a/drivers/power/s3c_adc_battery.c b/drivers/power/s3c_adc_battery.c index 5948ce058bdd..b6ff213373dd 100644 --- a/drivers/power/s3c_adc_battery.c +++ b/drivers/power/s3c_adc_battery.c | |||
@@ -310,14 +310,14 @@ static int s3c_adc_bat_probe(struct platform_device *pdev) | |||
310 | main_bat.cable_plugged = 0; | 310 | main_bat.cable_plugged = 0; |
311 | main_bat.status = POWER_SUPPLY_STATUS_DISCHARGING; | 311 | main_bat.status = POWER_SUPPLY_STATUS_DISCHARGING; |
312 | 312 | ||
313 | ret = power_supply_register(&pdev->dev, &main_bat.psy); | 313 | ret = power_supply_register(&pdev->dev, &main_bat.psy, NULL); |
314 | if (ret) | 314 | if (ret) |
315 | goto err_reg_main; | 315 | goto err_reg_main; |
316 | if (pdata->backup_volt_mult) { | 316 | if (pdata->backup_volt_mult) { |
317 | backup_bat.client = client; | 317 | backup_bat.client = client; |
318 | backup_bat.pdata = pdev->dev.platform_data; | 318 | backup_bat.pdata = pdev->dev.platform_data; |
319 | backup_bat.volt_value = -1; | 319 | backup_bat.volt_value = -1; |
320 | ret = power_supply_register(&pdev->dev, &backup_bat.psy); | 320 | ret = power_supply_register(&pdev->dev, &backup_bat.psy, NULL); |
321 | if (ret) | 321 | if (ret) |
322 | goto err_reg_backup; | 322 | goto err_reg_backup; |
323 | } | 323 | } |
diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c index c7b7b4018df3..879f1448fc4a 100644 --- a/drivers/power/sbs-battery.c +++ b/drivers/power/sbs-battery.c | |||
@@ -801,6 +801,7 @@ static int sbs_probe(struct i2c_client *client, | |||
801 | { | 801 | { |
802 | struct sbs_info *chip; | 802 | struct sbs_info *chip; |
803 | struct sbs_platform_data *pdata = client->dev.platform_data; | 803 | struct sbs_platform_data *pdata = client->dev.platform_data; |
804 | struct power_supply_config psy_cfg = {}; | ||
804 | int rc; | 805 | int rc; |
805 | int irq; | 806 | int irq; |
806 | char *name; | 807 | char *name; |
@@ -825,7 +826,7 @@ static int sbs_probe(struct i2c_client *client, | |||
825 | chip->power_supply.properties = sbs_properties; | 826 | chip->power_supply.properties = sbs_properties; |
826 | chip->power_supply.num_properties = ARRAY_SIZE(sbs_properties); | 827 | chip->power_supply.num_properties = ARRAY_SIZE(sbs_properties); |
827 | chip->power_supply.get_property = sbs_get_property; | 828 | chip->power_supply.get_property = sbs_get_property; |
828 | chip->power_supply.of_node = client->dev.of_node; | 829 | psy_cfg.of_node = client->dev.of_node; |
829 | /* ignore first notification of external change, it is generated | 830 | /* ignore first notification of external change, it is generated |
830 | * from the power_supply_register call back | 831 | * from the power_supply_register call back |
831 | */ | 832 | */ |
@@ -892,7 +893,8 @@ skip_gpio: | |||
892 | goto exit_psupply; | 893 | goto exit_psupply; |
893 | } | 894 | } |
894 | 895 | ||
895 | rc = power_supply_register(&client->dev, &chip->power_supply); | 896 | rc = power_supply_register(&client->dev, &chip->power_supply, |
897 | &psy_cfg); | ||
896 | if (rc) { | 898 | if (rc) { |
897 | dev_err(&client->dev, | 899 | dev_err(&client->dev, |
898 | "%s: Failed to register power supply\n", __func__); | 900 | "%s: Failed to register power supply\n", __func__); |
diff --git a/drivers/power/smb347-charger.c b/drivers/power/smb347-charger.c index e9702de262e5..4396a1ffeb1a 100644 --- a/drivers/power/smb347-charger.c +++ b/drivers/power/smb347-charger.c | |||
@@ -1194,6 +1194,7 @@ static int smb347_probe(struct i2c_client *client, | |||
1194 | { | 1194 | { |
1195 | static char *battery[] = { "smb347-battery" }; | 1195 | static char *battery[] = { "smb347-battery" }; |
1196 | const struct smb347_charger_platform_data *pdata; | 1196 | const struct smb347_charger_platform_data *pdata; |
1197 | struct power_supply_config psy_cfg = {}; /* Only for mains and usb */ | ||
1197 | struct device *dev = &client->dev; | 1198 | struct device *dev = &client->dev; |
1198 | struct smb347_charger *smb; | 1199 | struct smb347_charger *smb; |
1199 | int ret; | 1200 | int ret; |
@@ -1223,15 +1224,15 @@ static int smb347_probe(struct i2c_client *client, | |||
1223 | if (ret < 0) | 1224 | if (ret < 0) |
1224 | return ret; | 1225 | return ret; |
1225 | 1226 | ||
1227 | psy_cfg.supplied_to = battery; | ||
1228 | psy_cfg.num_supplicants = ARRAY_SIZE(battery); | ||
1226 | if (smb->pdata->use_mains) { | 1229 | if (smb->pdata->use_mains) { |
1227 | smb->mains.name = "smb347-mains"; | 1230 | smb->mains.name = "smb347-mains"; |
1228 | smb->mains.type = POWER_SUPPLY_TYPE_MAINS; | 1231 | smb->mains.type = POWER_SUPPLY_TYPE_MAINS; |
1229 | smb->mains.get_property = smb347_mains_get_property; | 1232 | smb->mains.get_property = smb347_mains_get_property; |
1230 | smb->mains.properties = smb347_mains_properties; | 1233 | smb->mains.properties = smb347_mains_properties; |
1231 | smb->mains.num_properties = ARRAY_SIZE(smb347_mains_properties); | 1234 | smb->mains.num_properties = ARRAY_SIZE(smb347_mains_properties); |
1232 | smb->mains.supplied_to = battery; | 1235 | ret = power_supply_register(dev, &smb->mains, &psy_cfg); |
1233 | smb->mains.num_supplicants = ARRAY_SIZE(battery); | ||
1234 | ret = power_supply_register(dev, &smb->mains); | ||
1235 | if (ret < 0) | 1236 | if (ret < 0) |
1236 | return ret; | 1237 | return ret; |
1237 | } | 1238 | } |
@@ -1242,9 +1243,7 @@ static int smb347_probe(struct i2c_client *client, | |||
1242 | smb->usb.get_property = smb347_usb_get_property; | 1243 | smb->usb.get_property = smb347_usb_get_property; |
1243 | smb->usb.properties = smb347_usb_properties; | 1244 | smb->usb.properties = smb347_usb_properties; |
1244 | smb->usb.num_properties = ARRAY_SIZE(smb347_usb_properties); | 1245 | smb->usb.num_properties = ARRAY_SIZE(smb347_usb_properties); |
1245 | smb->usb.supplied_to = battery; | 1246 | ret = power_supply_register(dev, &smb->usb, &psy_cfg); |
1246 | smb->usb.num_supplicants = ARRAY_SIZE(battery); | ||
1247 | ret = power_supply_register(dev, &smb->usb); | ||
1248 | if (ret < 0) { | 1247 | if (ret < 0) { |
1249 | if (smb->pdata->use_mains) | 1248 | if (smb->pdata->use_mains) |
1250 | power_supply_unregister(&smb->mains); | 1249 | power_supply_unregister(&smb->mains); |
@@ -1259,7 +1258,7 @@ static int smb347_probe(struct i2c_client *client, | |||
1259 | smb->battery.num_properties = ARRAY_SIZE(smb347_battery_properties); | 1258 | smb->battery.num_properties = ARRAY_SIZE(smb347_battery_properties); |
1260 | 1259 | ||
1261 | 1260 | ||
1262 | ret = power_supply_register(dev, &smb->battery); | 1261 | ret = power_supply_register(dev, &smb->battery, NULL); |
1263 | if (ret < 0) { | 1262 | if (ret < 0) { |
1264 | if (smb->pdata->use_usb) | 1263 | if (smb->pdata->use_usb) |
1265 | power_supply_unregister(&smb->usb); | 1264 | power_supply_unregister(&smb->usb); |
diff --git a/drivers/power/test_power.c b/drivers/power/test_power.c index f26b1fa00fe1..f6c92d1d7811 100644 --- a/drivers/power/test_power.c +++ b/drivers/power/test_power.c | |||
@@ -157,8 +157,6 @@ static struct power_supply test_power_supplies[] = { | |||
157 | [TEST_AC] = { | 157 | [TEST_AC] = { |
158 | .name = "test_ac", | 158 | .name = "test_ac", |
159 | .type = POWER_SUPPLY_TYPE_MAINS, | 159 | .type = POWER_SUPPLY_TYPE_MAINS, |
160 | .supplied_to = test_power_ac_supplied_to, | ||
161 | .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to), | ||
162 | .properties = test_power_ac_props, | 160 | .properties = test_power_ac_props, |
163 | .num_properties = ARRAY_SIZE(test_power_ac_props), | 161 | .num_properties = ARRAY_SIZE(test_power_ac_props), |
164 | .get_property = test_power_get_ac_property, | 162 | .get_property = test_power_get_ac_property, |
@@ -173,14 +171,25 @@ static struct power_supply test_power_supplies[] = { | |||
173 | [TEST_USB] = { | 171 | [TEST_USB] = { |
174 | .name = "test_usb", | 172 | .name = "test_usb", |
175 | .type = POWER_SUPPLY_TYPE_USB, | 173 | .type = POWER_SUPPLY_TYPE_USB, |
176 | .supplied_to = test_power_ac_supplied_to, | ||
177 | .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to), | ||
178 | .properties = test_power_ac_props, | 174 | .properties = test_power_ac_props, |
179 | .num_properties = ARRAY_SIZE(test_power_ac_props), | 175 | .num_properties = ARRAY_SIZE(test_power_ac_props), |
180 | .get_property = test_power_get_usb_property, | 176 | .get_property = test_power_get_usb_property, |
181 | }, | 177 | }, |
182 | }; | 178 | }; |
183 | 179 | ||
180 | static const struct power_supply_config test_power_configs[] = { | ||
181 | { | ||
182 | /* test_ac */ | ||
183 | .supplied_to = test_power_ac_supplied_to, | ||
184 | .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to), | ||
185 | }, { | ||
186 | /* test_battery */ | ||
187 | }, { | ||
188 | /* test_usb */ | ||
189 | .supplied_to = test_power_ac_supplied_to, | ||
190 | .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to), | ||
191 | }, | ||
192 | }; | ||
184 | 193 | ||
185 | static int __init test_power_init(void) | 194 | static int __init test_power_init(void) |
186 | { | 195 | { |
@@ -188,9 +197,11 @@ static int __init test_power_init(void) | |||
188 | int ret; | 197 | int ret; |
189 | 198 | ||
190 | BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_supplies)); | 199 | BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_supplies)); |
200 | BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_configs)); | ||
191 | 201 | ||
192 | for (i = 0; i < ARRAY_SIZE(test_power_supplies); i++) { | 202 | for (i = 0; i < ARRAY_SIZE(test_power_supplies); i++) { |
193 | ret = power_supply_register(NULL, &test_power_supplies[i]); | 203 | ret = power_supply_register(NULL, &test_power_supplies[i], |
204 | &test_power_configs[i]); | ||
194 | if (ret) { | 205 | if (ret) { |
195 | pr_err("%s: failed to register %s\n", __func__, | 206 | pr_err("%s: failed to register %s\n", __func__, |
196 | test_power_supplies[i].name); | 207 | test_power_supplies[i].name); |
diff --git a/drivers/power/tosa_battery.c b/drivers/power/tosa_battery.c index f4d80df627c7..895e4b4dfcf6 100644 --- a/drivers/power/tosa_battery.c +++ b/drivers/power/tosa_battery.c | |||
@@ -358,13 +358,13 @@ static int tosa_bat_probe(struct platform_device *dev) | |||
358 | 358 | ||
359 | INIT_WORK(&bat_work, tosa_bat_work); | 359 | INIT_WORK(&bat_work, tosa_bat_work); |
360 | 360 | ||
361 | ret = power_supply_register(&dev->dev, &tosa_bat_main.psy); | 361 | ret = power_supply_register(&dev->dev, &tosa_bat_main.psy, NULL); |
362 | if (ret) | 362 | if (ret) |
363 | goto err_psy_reg_main; | 363 | goto err_psy_reg_main; |
364 | ret = power_supply_register(&dev->dev, &tosa_bat_jacket.psy); | 364 | ret = power_supply_register(&dev->dev, &tosa_bat_jacket.psy, NULL); |
365 | if (ret) | 365 | if (ret) |
366 | goto err_psy_reg_jacket; | 366 | goto err_psy_reg_jacket; |
367 | ret = power_supply_register(&dev->dev, &tosa_bat_bu.psy); | 367 | ret = power_supply_register(&dev->dev, &tosa_bat_bu.psy, NULL); |
368 | if (ret) | 368 | if (ret) |
369 | goto err_psy_reg_bu; | 369 | goto err_psy_reg_bu; |
370 | 370 | ||
diff --git a/drivers/power/tps65090-charger.c b/drivers/power/tps65090-charger.c index 0f4e5971dff5..9872c901bd70 100644 --- a/drivers/power/tps65090-charger.c +++ b/drivers/power/tps65090-charger.c | |||
@@ -233,6 +233,7 @@ static int tps65090_charger_probe(struct platform_device *pdev) | |||
233 | { | 233 | { |
234 | struct tps65090_charger *cdata; | 234 | struct tps65090_charger *cdata; |
235 | struct tps65090_platform_data *pdata; | 235 | struct tps65090_platform_data *pdata; |
236 | struct power_supply_config psy_cfg = {}; | ||
236 | uint8_t status1 = 0; | 237 | uint8_t status1 = 0; |
237 | int ret; | 238 | int ret; |
238 | int irq; | 239 | int irq; |
@@ -264,11 +265,12 @@ static int tps65090_charger_probe(struct platform_device *pdev) | |||
264 | cdata->ac.get_property = tps65090_ac_get_property; | 265 | cdata->ac.get_property = tps65090_ac_get_property; |
265 | cdata->ac.properties = tps65090_ac_props; | 266 | cdata->ac.properties = tps65090_ac_props; |
266 | cdata->ac.num_properties = ARRAY_SIZE(tps65090_ac_props); | 267 | cdata->ac.num_properties = ARRAY_SIZE(tps65090_ac_props); |
267 | cdata->ac.supplied_to = pdata->supplied_to; | ||
268 | cdata->ac.num_supplicants = pdata->num_supplicants; | ||
269 | cdata->ac.of_node = pdev->dev.of_node; | ||
270 | 268 | ||
271 | ret = power_supply_register(&pdev->dev, &cdata->ac); | 269 | psy_cfg.supplied_to = pdata->supplied_to; |
270 | psy_cfg.num_supplicants = pdata->num_supplicants; | ||
271 | psy_cfg.of_node = pdev->dev.of_node; | ||
272 | |||
273 | ret = power_supply_register(&pdev->dev, &cdata->ac, &psy_cfg); | ||
272 | if (ret) { | 274 | if (ret) { |
273 | dev_err(&pdev->dev, "failed: power supply register\n"); | 275 | dev_err(&pdev->dev, "failed: power supply register\n"); |
274 | return ret; | 276 | return ret; |
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c index d35b83e635b5..156f30e64a75 100644 --- a/drivers/power/twl4030_charger.c +++ b/drivers/power/twl4030_charger.c | |||
@@ -590,7 +590,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev) | |||
590 | bci->ac.num_properties = ARRAY_SIZE(twl4030_charger_props); | 590 | bci->ac.num_properties = ARRAY_SIZE(twl4030_charger_props); |
591 | bci->ac.get_property = twl4030_bci_get_property; | 591 | bci->ac.get_property = twl4030_bci_get_property; |
592 | 592 | ||
593 | ret = power_supply_register(&pdev->dev, &bci->ac); | 593 | ret = power_supply_register(&pdev->dev, &bci->ac, NULL); |
594 | if (ret) { | 594 | if (ret) { |
595 | dev_err(&pdev->dev, "failed to register ac: %d\n", ret); | 595 | dev_err(&pdev->dev, "failed to register ac: %d\n", ret); |
596 | goto fail_register_ac; | 596 | goto fail_register_ac; |
@@ -604,7 +604,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev) | |||
604 | 604 | ||
605 | bci->usb_reg = regulator_get(bci->dev, "bci3v1"); | 605 | bci->usb_reg = regulator_get(bci->dev, "bci3v1"); |
606 | 606 | ||
607 | ret = power_supply_register(&pdev->dev, &bci->usb); | 607 | ret = power_supply_register(&pdev->dev, &bci->usb, NULL); |
608 | if (ret) { | 608 | if (ret) { |
609 | dev_err(&pdev->dev, "failed to register usb: %d\n", ret); | 609 | dev_err(&pdev->dev, "failed to register usb: %d\n", ret); |
610 | goto fail_register_usb; | 610 | goto fail_register_usb; |
diff --git a/drivers/power/twl4030_madc_battery.c b/drivers/power/twl4030_madc_battery.c index cf907609ec49..d065460c1cb3 100644 --- a/drivers/power/twl4030_madc_battery.c +++ b/drivers/power/twl4030_madc_battery.c | |||
@@ -217,7 +217,7 @@ static int twl4030_madc_battery_probe(struct platform_device *pdev) | |||
217 | 217 | ||
218 | twl4030_madc_bat->pdata = pdata; | 218 | twl4030_madc_bat->pdata = pdata; |
219 | platform_set_drvdata(pdev, twl4030_madc_bat); | 219 | platform_set_drvdata(pdev, twl4030_madc_bat); |
220 | ret = power_supply_register(&pdev->dev, &twl4030_madc_bat->psy); | 220 | ret = power_supply_register(&pdev->dev, &twl4030_madc_bat->psy, NULL); |
221 | if (ret < 0) | 221 | if (ret < 0) |
222 | kfree(twl4030_madc_bat); | 222 | kfree(twl4030_madc_bat); |
223 | 223 | ||
diff --git a/drivers/power/wm831x_backup.c b/drivers/power/wm831x_backup.c index 56fb509f4be0..60ae871148b0 100644 --- a/drivers/power/wm831x_backup.c +++ b/drivers/power/wm831x_backup.c | |||
@@ -197,7 +197,7 @@ static int wm831x_backup_probe(struct platform_device *pdev) | |||
197 | backup->properties = wm831x_backup_props; | 197 | backup->properties = wm831x_backup_props; |
198 | backup->num_properties = ARRAY_SIZE(wm831x_backup_props); | 198 | backup->num_properties = ARRAY_SIZE(wm831x_backup_props); |
199 | backup->get_property = wm831x_backup_get_prop; | 199 | backup->get_property = wm831x_backup_get_prop; |
200 | ret = power_supply_register(&pdev->dev, backup); | 200 | ret = power_supply_register(&pdev->dev, backup, NULL); |
201 | 201 | ||
202 | return ret; | 202 | return ret; |
203 | } | 203 | } |
diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c index 3bed2f55cf7d..a132aae6225d 100644 --- a/drivers/power/wm831x_power.c +++ b/drivers/power/wm831x_power.c | |||
@@ -536,7 +536,7 @@ static int wm831x_power_probe(struct platform_device *pdev) | |||
536 | wall->properties = wm831x_wall_props; | 536 | wall->properties = wm831x_wall_props; |
537 | wall->num_properties = ARRAY_SIZE(wm831x_wall_props); | 537 | wall->num_properties = ARRAY_SIZE(wm831x_wall_props); |
538 | wall->get_property = wm831x_wall_get_prop; | 538 | wall->get_property = wm831x_wall_get_prop; |
539 | ret = power_supply_register(&pdev->dev, wall); | 539 | ret = power_supply_register(&pdev->dev, wall, NULL); |
540 | if (ret) | 540 | if (ret) |
541 | goto err_kmalloc; | 541 | goto err_kmalloc; |
542 | 542 | ||
@@ -545,7 +545,7 @@ static int wm831x_power_probe(struct platform_device *pdev) | |||
545 | usb->properties = wm831x_usb_props; | 545 | usb->properties = wm831x_usb_props; |
546 | usb->num_properties = ARRAY_SIZE(wm831x_usb_props); | 546 | usb->num_properties = ARRAY_SIZE(wm831x_usb_props); |
547 | usb->get_property = wm831x_usb_get_prop; | 547 | usb->get_property = wm831x_usb_get_prop; |
548 | ret = power_supply_register(&pdev->dev, usb); | 548 | ret = power_supply_register(&pdev->dev, usb, NULL); |
549 | if (ret) | 549 | if (ret) |
550 | goto err_wall; | 550 | goto err_wall; |
551 | 551 | ||
@@ -560,7 +560,7 @@ static int wm831x_power_probe(struct platform_device *pdev) | |||
560 | battery->num_properties = ARRAY_SIZE(wm831x_bat_props); | 560 | battery->num_properties = ARRAY_SIZE(wm831x_bat_props); |
561 | battery->get_property = wm831x_bat_get_prop; | 561 | battery->get_property = wm831x_bat_get_prop; |
562 | battery->use_for_apm = 1; | 562 | battery->use_for_apm = 1; |
563 | ret = power_supply_register(&pdev->dev, battery); | 563 | ret = power_supply_register(&pdev->dev, battery, NULL); |
564 | if (ret) | 564 | if (ret) |
565 | goto err_usb; | 565 | goto err_usb; |
566 | } | 566 | } |
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c index b3607e2906d2..261ceca561d5 100644 --- a/drivers/power/wm8350_power.c +++ b/drivers/power/wm8350_power.c | |||
@@ -457,7 +457,7 @@ static int wm8350_power_probe(struct platform_device *pdev) | |||
457 | ac->properties = wm8350_ac_props; | 457 | ac->properties = wm8350_ac_props; |
458 | ac->num_properties = ARRAY_SIZE(wm8350_ac_props); | 458 | ac->num_properties = ARRAY_SIZE(wm8350_ac_props); |
459 | ac->get_property = wm8350_ac_get_prop; | 459 | ac->get_property = wm8350_ac_get_prop; |
460 | ret = power_supply_register(&pdev->dev, ac); | 460 | ret = power_supply_register(&pdev->dev, ac, NULL); |
461 | if (ret) | 461 | if (ret) |
462 | return ret; | 462 | return ret; |
463 | 463 | ||
@@ -466,7 +466,7 @@ static int wm8350_power_probe(struct platform_device *pdev) | |||
466 | battery->num_properties = ARRAY_SIZE(wm8350_bat_props); | 466 | battery->num_properties = ARRAY_SIZE(wm8350_bat_props); |
467 | battery->get_property = wm8350_bat_get_property; | 467 | battery->get_property = wm8350_bat_get_property; |
468 | battery->use_for_apm = 1; | 468 | battery->use_for_apm = 1; |
469 | ret = power_supply_register(&pdev->dev, battery); | 469 | ret = power_supply_register(&pdev->dev, battery, NULL); |
470 | if (ret) | 470 | if (ret) |
471 | goto battery_failed; | 471 | goto battery_failed; |
472 | 472 | ||
@@ -475,7 +475,7 @@ static int wm8350_power_probe(struct platform_device *pdev) | |||
475 | usb->properties = wm8350_usb_props; | 475 | usb->properties = wm8350_usb_props; |
476 | usb->num_properties = ARRAY_SIZE(wm8350_usb_props); | 476 | usb->num_properties = ARRAY_SIZE(wm8350_usb_props); |
477 | usb->get_property = wm8350_usb_get_prop; | 477 | usb->get_property = wm8350_usb_get_prop; |
478 | ret = power_supply_register(&pdev->dev, usb); | 478 | ret = power_supply_register(&pdev->dev, usb, NULL); |
479 | if (ret) | 479 | if (ret) |
480 | goto usb_failed; | 480 | goto usb_failed; |
481 | 481 | ||
diff --git a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c index a8e6203673ad..e81e917bd9d0 100644 --- a/drivers/power/wm97xx_battery.c +++ b/drivers/power/wm97xx_battery.c | |||
@@ -244,7 +244,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) | |||
244 | bat_ps.properties = prop; | 244 | bat_ps.properties = prop; |
245 | bat_ps.num_properties = props; | 245 | bat_ps.num_properties = props; |
246 | 246 | ||
247 | ret = power_supply_register(&dev->dev, &bat_ps); | 247 | ret = power_supply_register(&dev->dev, &bat_ps, NULL); |
248 | if (!ret) | 248 | if (!ret) |
249 | schedule_work(&bat_work); | 249 | schedule_work(&bat_work); |
250 | else | 250 | else |
diff --git a/drivers/power/z2_battery.c b/drivers/power/z2_battery.c index 814d2e31f0c9..df22364212dd 100644 --- a/drivers/power/z2_battery.c +++ b/drivers/power/z2_battery.c | |||
@@ -230,7 +230,7 @@ static int z2_batt_probe(struct i2c_client *client, | |||
230 | 230 | ||
231 | INIT_WORK(&charger->bat_work, z2_batt_work); | 231 | INIT_WORK(&charger->bat_work, z2_batt_work); |
232 | 232 | ||
233 | ret = power_supply_register(&client->dev, &charger->batt_ps); | 233 | ret = power_supply_register(&client->dev, &charger->batt_ps, NULL); |
234 | if (ret) | 234 | if (ret) |
235 | goto err4; | 235 | goto err4; |
236 | 236 | ||