Skip to content

Commit

Permalink
thunderbolt: Print connected devices
Browse files Browse the repository at this point in the history
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 <mika.westerberg@linux.intel.com>
Acked-by: Yehezkel Bernat <yehezkelshb@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Mika Westerberg authored and Greg Kroah-Hartman committed Oct 2, 2018
1 parent daa5140 commit a83bc4a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/thunderbolt/switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit a83bc4a

Please sign in to comment.