From: Mika Westerberg Date: Mon, 1 Oct 2018 09:31:20 +0000 (+0300) Subject: thunderbolt: Print connected devices X-Git-Tag: v4.20-rc1~107^2~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a83bc4a5e8e08c15464f0b0b79934b834911cf9c;p=thirdparty%2Fkernel%2Flinux.git thunderbolt: Print connected devices The previous patch made the driver less verbose meanining that all the switch structures and ports are now logged as debug level. However, we have been missing similar output that USB for intance prints when a new USB device is connected and disconnected. This information is useful for end users as well as developers because it immediately shows the actual device that was connected. This patch adds printing of the actual connected devices to the driver. Signed-off-by: Mika Westerberg Acked-by: Yehezkel Bernat Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 81134ee295784..9f44a2924dac0 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -1402,6 +1402,14 @@ int tb_switch_add(struct tb_switch *sw) if (ret) return ret; + if (tb_route(sw)) { + dev_info(&sw->dev, "new device found, vendor=%#x device=%#x\n", + sw->vendor, sw->device); + if (sw->vendor_name && sw->device_name) + dev_info(&sw->dev, "%s %s\n", sw->vendor_name, + sw->device_name); + } + ret = tb_switch_nvm_add(sw); if (ret) { device_del(&sw->dev); @@ -1453,6 +1461,9 @@ void tb_switch_remove(struct tb_switch *sw) tb_plug_events_active(sw, false); tb_switch_nvm_remove(sw); + + if (tb_route(sw)) + dev_info(&sw->dev, "device disconnected\n"); device_unregister(&sw->dev); }