Skip to content

Commit a5f3542

Browse files
Wer-Wolfij-intel
authored andcommitted
power: supply: test-power: Test access to extended power supply
Test that power supply extensions can access properties of their power supply using power_supply_get_property_direct(). This both ensures that the functionality works and serves as an example for future driver developers. Signed-off-by: Armin Wolf <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 3ebed2f commit a5f3542

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/power/supply/test_power.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ static const struct power_supply_config test_power_configs[] = {
259259
static int test_power_battery_extmanufacture_year = 1234;
260260
static int test_power_battery_exttemp_max = 1000;
261261
static const enum power_supply_property test_power_battery_extprops[] = {
262+
POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
262263
POWER_SUPPLY_PROP_MANUFACTURE_YEAR,
263264
POWER_SUPPLY_PROP_TEMP_MAX,
264265
};
@@ -270,6 +271,9 @@ static int test_power_battery_extget_property(struct power_supply *psy,
270271
union power_supply_propval *val)
271272
{
272273
switch (psp) {
274+
case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
275+
return power_supply_get_property_direct(psy, POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
276+
val);
273277
case POWER_SUPPLY_PROP_MANUFACTURE_YEAR:
274278
val->intval = test_power_battery_extmanufacture_year;
275279
break;

0 commit comments

Comments
 (0)