summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2024-08-31 16:20:39 +0200
committerSebastian Reichel <sebastian.reichel@collabora.com>2024-09-03 23:20:28 +0200
commit364ea7ccaef917a3068236a19a4b31a0623b561a (patch)
tree5f38b0b1bba13f8d22c5d39aa07a41d80eda61ed /drivers/phy
parent322900ac7d82be0475466f81946b6484cd1936bd (diff)
downloadlwn-364ea7ccaef917a3068236a19a4b31a0623b561a.tar.gz
lwn-364ea7ccaef917a3068236a19a4b31a0623b561a.zip
power: supply: Change usb_types from an array into a bitmask
The bit_types array just hold a list of valid enum power_supply_usb_type values which map to 0 - 9. This can easily be represented as a bitmap. This reduces the size of struct power_supply_desc and further reduces the data section size by drivers no longer needing to store the array. This also unifies how usb_types are handled with charge_behaviours, which allows power_supply_show_usb_type() to be removed. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20240831142039.28830-7-hdegoede@redhat.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/ti/phy-tusb1210.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/phy/ti/phy-tusb1210.c b/drivers/phy/ti/phy-tusb1210.c
index 751fecd466e3..c3ae9d7948d7 100644
--- a/drivers/phy/ti/phy-tusb1210.c
+++ b/drivers/phy/ti/phy-tusb1210.c
@@ -411,12 +411,6 @@ static int tusb1210_psy_get_prop(struct power_supply *psy,
return 0;
}
-static const enum power_supply_usb_type tusb1210_psy_usb_types[] = {
- POWER_SUPPLY_USB_TYPE_SDP,
- POWER_SUPPLY_USB_TYPE_DCP,
- POWER_SUPPLY_USB_TYPE_UNKNOWN,
-};
-
static const enum power_supply_property tusb1210_psy_props[] = {
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_USB_TYPE,
@@ -426,8 +420,9 @@ static const enum power_supply_property tusb1210_psy_props[] = {
static const struct power_supply_desc tusb1210_psy_desc = {
.name = "tusb1211-charger-detect",
.type = POWER_SUPPLY_TYPE_USB,
- .usb_types = tusb1210_psy_usb_types,
- .num_usb_types = ARRAY_SIZE(tusb1210_psy_usb_types),
+ .usb_types = BIT(POWER_SUPPLY_USB_TYPE_SDP) |
+ BIT(POWER_SUPPLY_USB_TYPE_DCP) |
+ BIT(POWER_SUPPLY_USB_TYPE_UNKNOWN),
.properties = tusb1210_psy_props,
.num_properties = ARRAY_SIZE(tusb1210_psy_props),
.get_property = tusb1210_psy_get_prop,