From 2e93cda49dda37e31c1b0aadda5deed64b37eb0b Mon Sep 17 00:00:00 2001 From: Li Jun Date: Thu, 18 Apr 2019 17:21:41 +0800 Subject: [PATCH] MLK-21478-25 Revert "MLK-16013-9 usb: typec: add interface to get port type and role" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This reverts commit ccbf06406704c52d5146c9f28cbc8907429b92ce. As we will use fwnode API to get typec properties, those APIs to be reverted are not required, this will also fix below build warnings: drivers/usb/typec/class.c: In function ‘typec_register_port’: drivers/usb/typec/class.c:1591:2: warning: enumeration value ‘TYPEC_PORT_TYPE_UNKNOWN’ not handled in switch [-Wswitch] switch (cap->type) { ^~~~~~ Reported-by: Fugang Duan Acked-by: Peter Chen Signed-off-by: Li Jun --- drivers/usb/typec/class.c | 48 --------------------------------------- include/linux/usb/typec.h | 4 ---- 2 files changed, 52 deletions(-) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 9c16055ac978..00141e05bc72 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "bus.h" @@ -931,12 +930,6 @@ static const char * const typec_port_data_roles[] = { [TYPEC_PORT_DRD] = "dual", }; -static const char *const typec_port_types_dt[] = { - [TYPEC_PORT_DFP] = "dfp", - [TYPEC_PORT_UFP] = "ufp", - [TYPEC_PORT_DRP] = "drp", -}; - static const char * const typec_port_types_drp[] = { [TYPEC_PORT_SRC] = "dual [source] sink", [TYPEC_PORT_SNK] = "dual source [sink]", @@ -1289,47 +1282,6 @@ const struct device_type typec_port_dev_type = { .release = typec_release, }; -static enum typec_port_type typec_get_port_type_from_string(const char *str) -{ - int ret; - - ret = match_string(typec_port_types_dt, ARRAY_SIZE(typec_port_types_dt), str); - return (ret < 0) ? TYPEC_PORT_TYPE_UNKNOWN : ret; -} - -enum typec_port_type typec_get_port_type(struct device *dev) -{ - const char *port_type; - int err; - - err = device_property_read_string(dev, "port-type", &port_type); - if (err < 0) - return TYPEC_PORT_TYPE_UNKNOWN; - - return typec_get_port_type_from_string(port_type); -}; -EXPORT_SYMBOL_GPL(typec_get_port_type); - -static enum typec_role typec_get_power_role_from_string(const char *str) -{ - int ret; - - ret = match_string(typec_roles, ARRAY_SIZE(typec_roles), str); - return (ret < 0) ? TYPEC_ROLE_UNKNOWN : ret; -} - -enum typec_role typec_get_power_role(struct device *dev) -{ - const char *power_role; - int err; - - err = device_property_read_string(dev, "default-role", &power_role); - if (err < 0) - return TYPEC_ROLE_UNKNOWN; - - return typec_get_power_role_from_string(power_role); -} -EXPORT_SYMBOL_GPL(typec_get_power_role); /* --------------------------------------- */ /* Driver callbacks to report role updates */ diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 353677f38730..7df4ecabc78a 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -22,7 +22,6 @@ enum typec_port_type { TYPEC_PORT_SRC, TYPEC_PORT_SNK, TYPEC_PORT_DRP, - TYPEC_PORT_TYPE_UNKNOWN, }; enum typec_port_data { @@ -47,7 +46,6 @@ enum typec_data_role { enum typec_role { TYPEC_SINK, TYPEC_SOURCE, - TYPEC_ROLE_UNKNOWN, }; enum typec_pwr_opmode { @@ -237,8 +235,6 @@ void typec_set_data_role(struct typec_port *port, enum typec_data_role role); void typec_set_pwr_role(struct typec_port *port, enum typec_role role); void typec_set_vconn_role(struct typec_port *port, enum typec_role role); void typec_set_pwr_opmode(struct typec_port *port, enum typec_pwr_opmode mode); -enum typec_port_type typec_get_port_type(struct device *dev); -enum typec_role typec_get_power_role(struct device *dev); int typec_set_orientation(struct typec_port *port, enum typec_orientation orientation); -- 2.17.1