1
0
Fork 0

greybus: interface: Add print messages on interface initialization/removal

It might be of interest (to developers at least) to know when an
interface is getting created or removed from the system.

Interface creation message can further contain basic information about
the interface, like its vid/pid and mfg/prod ids.

Now, the interface is created by gb_interface_create(), which doesn't
register the intf->dev to the kernel and so the print message is rather
added to gb_interface_init() where we register the device with the
kernel.

A similar message is added to gb_interface_remove() only when the
interface was earlier initialized.

And this is how the output looks on real insertion/removal of the
module:

greybus 1-1: Interface added: VID=0x00000001, PID=0x00000001
greybus 1-1: DDBL1 Manufacturer=0x00000001, Product=0x00000001
...
greybus 1-1: Interface removed

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
hifive-unleashed-5.1
Viresh Kumar 2016-02-19 15:57:46 +05:30 committed by Greg Kroah-Hartman
parent 2422d36696
commit 907d1e16ff
1 changed files with 8 additions and 1 deletions

View File

@ -174,8 +174,10 @@ void gb_interface_remove(struct gb_interface *intf)
list_for_each_entry_safe(bundle, next, &intf->bundles, links)
gb_bundle_destroy(bundle);
if (device_is_registered(&intf->dev))
if (device_is_registered(&intf->dev)) {
device_del(&intf->dev);
dev_info(&intf->dev, "Interface removed\n");
}
gb_control_disable(intf->control);
@ -260,6 +262,11 @@ int gb_interface_init(struct gb_interface *intf, u8 device_id)
goto free_manifest;
}
dev_info(&intf->dev, "Interface added: VID=0x%08x, PID=0x%08x\n",
intf->vendor_id, intf->product_id);
dev_info(&intf->dev, "DDBL1 Manufacturer=0x%08x, Product=0x%08x\n",
intf->ddbl1_manufacturer_id, intf->ddbl1_product_id);
list_for_each_entry_safe_reverse(bundle, tmp, &intf->bundles, links) {
ret = gb_bundle_add(bundle);
if (ret) {