From a914c8df696d4fd8cc8d7bbdfe99da539606fcf9 Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Fri, 31 Aug 2018 09:11:14 -0600 Subject: ss-mux: remove unused port_addr initialization We do not need to set the port_addr variable most places because the SS-MUX is also the TCPC and the tcpc_config_t information is used instead. Remove unused variable setting to avoid confusion. BRANCH=none BUG=none TEST=buildall. phaser USB-C communication (and muxs) still work which is a nominal case for all of these changes. Change-Id: I72ee5da251956eb133091974e8dce5ac7f8787c6 Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/1200064 Commit-Ready: ChromeOS CL Exonerator Bot Reviewed-by: Edward Hill --- baseboard/dragonegg/baseboard.c | 2 -- baseboard/grunt/baseboard.c | 2 -- baseboard/octopus/variant_usbc_standalone_tcpcs.c | 2 -- board/atlas/board.c | 2 -- board/cheza/board.c | 2 -- board/coral/board.c | 2 -- board/elm/board.c | 1 - board/eve/board.c | 2 -- board/fizz/board.c | 1 - board/kukui/board.c | 1 - board/nami/board.c | 2 -- board/nautilus/board.c | 2 -- board/nocturne/board.c | 3 --- board/pdeval-stm32f072/usb_pd_policy.c | 1 - board/poppy/board.c | 2 -- board/rainier/board.c | 1 - board/rammus/board.c | 2 -- board/reef/board.c | 2 -- board/reef_mchp/board.c | 2 -- board/rowan/board.c | 1 - board/samus_pd/usb_mux.c | 6 ++---- board/scarlet/board.c | 1 - board/zoombini/board.c | 5 +---- include/usb_mux.h | 7 +++++-- 24 files changed, 8 insertions(+), 46 deletions(-) diff --git a/baseboard/dragonegg/baseboard.c b/baseboard/dragonegg/baseboard.c index e3f49ff336..9046e8c69c 100644 --- a/baseboard/dragonegg/baseboard.c +++ b/baseboard/dragonegg/baseboard.c @@ -207,13 +207,11 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ITE_0] = { - .port_addr = 0, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }, [USB_PD_PORT_ITE_1] = { - .port_addr = 0, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }, diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c index 8b37381f12..678d69010d 100644 --- a/baseboard/grunt/baseboard.c +++ b/baseboard/grunt/baseboard.c @@ -122,12 +122,10 @@ void tcpc_alert_event(enum gpio_signal signal) struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX74XX] = { - .port_addr = USB_PD_PORT_ANX74XX, .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, [USB_PD_PORT_PS8751] = { - .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, /* TODO(ecgh): ps8751_tune_mux needed? */ diff --git a/baseboard/octopus/variant_usbc_standalone_tcpcs.c b/baseboard/octopus/variant_usbc_standalone_tcpcs.c index 3546b3c4cf..2068231519 100644 --- a/baseboard/octopus/variant_usbc_standalone_tcpcs.c +++ b/baseboard/octopus/variant_usbc_standalone_tcpcs.c @@ -49,12 +49,10 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX7447] = { - .port_addr = USB_PD_PORT_ANX7447, .driver = &anx7447_usb_mux_driver, .hpd_update = &anx7447_tcpc_update_hpd_status, }, [USB_PD_PORT_PS8751] = { - .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, } diff --git a/board/atlas/board.c b/board/atlas/board.c index 6e403bfd8f..aec1967d13 100644 --- a/board/atlas/board.c +++ b/board/atlas/board.c @@ -184,12 +184,10 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, { - .port_addr = 1, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, diff --git a/board/cheza/board.c b/board/cheza/board.c index 3e176736fd..b2b323eefd 100644 --- a/board/cheza/board.c +++ b/board/cheza/board.c @@ -225,12 +225,10 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = USB_PD_PORT_ANX3429, .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, { - .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, } diff --git a/board/coral/board.c b/board/coral/board.c index e651561e11..2c56f36b0b 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -287,12 +287,10 @@ static int ps8751_tune_mux(int port) struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX74XX] = { - .port_addr = USB_PD_PORT_ANX74XX, .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, [USB_PD_PORT_PS8751] = { - .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, .board_init = &ps8751_tune_mux, diff --git a/board/elm/board.c b/board/elm/board.c index 67a60d1aed..4fe7f780a0 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -157,7 +157,6 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, /* port idx */ .driver = &anx7688_usb_mux_driver, }, }; diff --git a/board/eve/board.c b/board/eve/board.c index e4ff6ad44a..df95551535 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -226,12 +226,10 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, { - .port_addr = 1, .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, diff --git a/board/fizz/board.c b/board/fizz/board.c index 2c2877c0c1..ac51d43c22 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -210,7 +210,6 @@ static int ps8751_tune_mux(int port) struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, .board_init = &ps8751_tune_mux, diff --git a/board/kukui/board.c b/board/kukui/board.c index 5d610c83a4..d86beb1e46 100644 --- a/board/kukui/board.c +++ b/board/kukui/board.c @@ -147,7 +147,6 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }, diff --git a/board/nami/board.c b/board/nami/board.c index cb5efe7bf6..75bfa139ec 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -228,12 +228,10 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, { - .port_addr = USB_PD_PORT_ANX7447, .driver = &anx7447_usb_mux_driver, .hpd_update = &anx7447_tcpc_update_hpd_status, } diff --git a/board/nautilus/board.c b/board/nautilus/board.c index e765064bf6..c98de155d7 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -183,12 +183,10 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, { - .port_addr = 1, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, } diff --git a/board/nocturne/board.c b/board/nocturne/board.c index fd61390cc1..5d3f494127 100644 --- a/board/nocturne/board.c +++ b/board/nocturne/board.c @@ -300,16 +300,13 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { }, }; -/* The port_addr members are PD port numbers, not I2C port numbers. */ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, { - .port_addr = 1, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c index 0b858e58e3..ba899f5efb 100644 --- a/board/pdeval-stm32f072/usb_pd_policy.c +++ b/board/pdeval-stm32f072/usb_pd_policy.c @@ -38,7 +38,6 @@ const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo); #if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447) struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &anx7447_usb_mux_driver, }, }; diff --git a/board/poppy/board.c b/board/poppy/board.c index 20c57d6388..3a158ef050 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -225,12 +225,10 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, /* don't care / unused */ .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, { - .port_addr = 1, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, } diff --git a/board/rainier/board.c b/board/rainier/board.c index c3b7fab020..9e98136127 100644 --- a/board/rainier/board.c +++ b/board/rainier/board.c @@ -135,7 +135,6 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }, diff --git a/board/rammus/board.c b/board/rammus/board.c index 3f3be06943..1ae366f68a 100644 --- a/board/rammus/board.c +++ b/board/rammus/board.c @@ -174,12 +174,10 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_PS8751] = { - .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, [USB_PD_PORT_ANX7447] = { - .port_addr = USB_PD_PORT_ANX7447, .driver = &anx7447_usb_mux_driver, .hpd_update = &anx7447_tcpc_update_hpd_status, } diff --git a/board/reef/board.c b/board/reef/board.c index 54766f73b9..a0a9a0ee4c 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -292,12 +292,10 @@ static int ps8751_tune_mux(int port) struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX74XX] = { - .port_addr = USB_PD_PORT_ANX74XX, .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, [USB_PD_PORT_PS8751] = { - .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, .board_init = &ps8751_tune_mux, diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c index 91dc329b0c..733c345359 100644 --- a/board/reef_mchp/board.c +++ b/board/reef_mchp/board.c @@ -432,12 +432,10 @@ static int ps8751_tune_mux(int port) */ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX74XX] = { - .port_addr = USB_PD_PORT_ANX74XX, .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, [USB_PD_PORT_PS8751] = { - .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, .board_init = &ps8751_tune_mux, diff --git a/board/rowan/board.c b/board/rowan/board.c index 15c54b8392..64d2f39239 100644 --- a/board/rowan/board.c +++ b/board/rowan/board.c @@ -158,7 +158,6 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, /* port idx */ .driver = &anx7688_usb_mux_driver, }, }; diff --git a/board/samus_pd/usb_mux.c b/board/samus_pd/usb_mux.c index e37dd08037..268c0c5843 100644 --- a/board/samus_pd/usb_mux.c +++ b/board/samus_pd/usb_mux.c @@ -107,11 +107,9 @@ const struct usb_mux_driver board_custom_usb_mux_driver = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, - .driver = &board_custom_usb_mux_driver, + .driver = &board_custom_usb_mux_driver, }, { - .port_addr = 1, - .driver = &board_custom_usb_mux_driver, + .driver = &board_custom_usb_mux_driver, }, }; diff --git a/board/scarlet/board.c b/board/scarlet/board.c index adfee70cd7..6a21406697 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -131,7 +131,6 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }, diff --git a/board/zoombini/board.c b/board/zoombini/board.c index 0fd3f28518..a17d1465f4 100644 --- a/board/zoombini/board.c +++ b/board/zoombini/board.c @@ -393,23 +393,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { #endif /* defined(BOARD_ZOOMBINI) */ }; -/* The port_addr members are PD port numbers, not I2C port numbers. */ +/* The order is PD port (same as tcpc) */ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, { - .port_addr = 1, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, #ifdef BOARD_ZOOMBINI { - .port_addr = 2, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, diff --git a/include/usb_mux.h b/include/usb_mux.h index 7c3f5ae55f..e483954733 100644 --- a/include/usb_mux.h +++ b/include/usb_mux.h @@ -92,8 +92,11 @@ struct usb_mux_driver { /* Describes a USB mux present in the system */ struct usb_mux { /* - * Driver-defined parameter, typically an i2c slave address - * (for i2c muxes) or a port number (for GPIO 'muxes'). + * Used by driver. Muxes that are also the TCPC do not need to specify + * anything for this as they will use the values from tcpc_config_t. If + * this mux is also a TCPC but not used as the TCPC then use the + * MUX_PORT_AND_ADDR to pack the i2c port and i2c address into this + * field and use the USB_MUX_FLAG_NOT_TCPC flag. */ const int port_addr; -- cgit v1.2.1