From d94dcbb10183f3b384c84e65724d2b753aa53c4d Mon Sep 17 00:00:00 2001 From: Mika Westerberg Date: Wed, 4 Jul 2018 08:50:01 +0300 Subject: thunderbolt: Do not fail adding switch if some port is not implemented There are two ways to mark a port as unimplemented. Typical way is to return port type as TB_TYPE_INACTIVE when its config space is read. Alternatively if the port is not physically present (such as ports 10 and 11 in ICL) reading from port config space returns TB_CFG_ERROR_INVALID_CONFIG_SPACE instead. Currently the driver bails out from adding the switch if it receives any error during port inititialization which is wrong. Handle this properly and just leave the port as TB_TYPE_INACTIVE before continuing to the next port. This also allows us to get rid of special casing for Light Ridge port 5 in eeprom.c. Signed-off-by: Mika Westerberg Reviewed-by: Yehezkel Bernat Tested-by: Mario Limonciello --- drivers/thunderbolt/switch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'drivers/thunderbolt/switch.c') diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 5668a44e0653..64f845fe4690 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -611,8 +611,14 @@ static int tb_init_port(struct tb_port *port) int cap; res = tb_port_read(port, &port->config, TB_CFG_PORT, 0, 8); - if (res) + if (res) { + if (res == -ENODEV) { + tb_dbg(port->sw->tb, " Port %d: not implemented\n", + port->port); + return 0; + } return res; + } /* Port 0 is the switch itself and has no PHY. */ if (port->config.type == TB_TYPE_PORT && port->port != 0) { -- cgit v1.2.3-59-g8ed1b