]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: gpbridge: add uevent vars for gpbridge devices
authorSandeep Patil <sspatil@google.com>
Fri, 13 May 2016 18:51:05 +0000 (11:51 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 14 May 2016 09:19:41 +0000 (11:19 +0200)
The uevent vars now include module, interface, greybus_id,
bundle id, class and gpbridge device specific properties.

This make it consistent with how we are reporting uevents for
all other greybus devices.

Testing Done:
Tested by reading uevent from gpbridge devices that enumerate
using gpb module

Signed-off-by: Sandeep Patil <sspatil@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/gpbridge.c

index b22f5e452e9dd9df4362d92027de55f041a9bf74..c8b3822db80c74093a6c3a610479ff5eff4a3519 100644 (file)
@@ -57,7 +57,31 @@ struct device_type greybus_gpbdev_type = {
 
 static int gpbdev_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
-       /* FIXME add something here, userspace will care about these... */
+       struct gpbridge_device *gpbdev = to_gpbridge_dev(dev);
+       struct greybus_descriptor_cport *cport_desc = gpbdev->cport_desc;
+       struct gb_bundle *bundle = gpbdev->bundle;
+       struct gb_interface *intf = bundle->intf;
+       struct gb_module *module = intf->module;
+       struct gb_host_device *hd = intf->hd;
+
+       if (add_uevent_var(env, "BUS=%u", hd->bus_id))
+               return -ENOMEM;
+       if (add_uevent_var(env, "MODULE=%u", module->module_id))
+               return -ENOMEM;
+       if (add_uevent_var(env, "INTERFACE=%u", intf->interface_id))
+               return -ENOMEM;
+       if (add_uevent_var(env, "GREYBUS_ID=%08x/%08x",
+                          intf->vendor_id, intf->product_id))
+               return -ENOMEM;
+       if (add_uevent_var(env, "BUNDLE=%u", gpbdev->bundle->id))
+               return -ENOMEM;
+       if (add_uevent_var(env, "BUNDLE_CLASS=%02x", bundle->class))
+               return -ENOMEM;
+       if (add_uevent_var(env, "GPBDEV_ID=%u", gpbdev->id))
+               return -ENOMEM;
+       if (add_uevent_var(env, "PROTOCOL_ID=%02x", cport_desc->protocol_id))
+               return -ENOMEM;
+
        return 0;
 }