greybus: gpbridge: add uevent vars for gpbridge devices

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>
This commit is contained in:
Sandeep Patil 2016-05-13 11:51:05 -07:00 коммит произвёл Greg Kroah-Hartman
Родитель c7092b22fc
Коммит 6458492e9c
1 изменённых файлов: 25 добавлений и 1 удалений

Просмотреть файл

@ -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;
}