diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-12-03 19:18:02 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-12-03 17:25:28 -0800 |
commit | f0960d05f5ece96a7b2539e0adb92bfbfc83bf3e (patch) | |
tree | 57776b905ec43db1e2d152e2f4f87af6064768c6 /drivers/staging/greybus/core.c | |
parent | 1cacb456fd6b5fd99f0274bef2b2d04b5f259392 (diff) |
greybus: core: add bus id to uevents
Add the bus id to all greybus uevents.
This is needed to identify devices that are being removed (e.g. at
hot-unplug).
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/core.c')
-rw-r--r-- | drivers/staging/greybus/core.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c index 9dcb1bf311c0..3d8b7ef589bb 100644 --- a/drivers/staging/greybus/core.c +++ b/drivers/staging/greybus/core.c @@ -77,7 +77,7 @@ static int greybus_module_match(struct device *dev, struct device_driver *drv) static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env) { - struct gb_host_device *hd = NULL; + struct gb_host_device *hd; struct gb_interface *intf = NULL; struct gb_bundle *bundle = NULL; struct gb_svc *svc = NULL; @@ -86,16 +86,22 @@ static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env) hd = to_gb_host_device(dev); } else if (is_gb_interface(dev)) { intf = to_gb_interface(dev); + hd = intf->hd; } else if (is_gb_bundle(dev)) { bundle = to_gb_bundle(dev); intf = bundle->intf; + hd = intf->hd; } else if (is_gb_svc(dev)) { svc = to_gb_svc(dev); + hd = svc->hd; } else { dev_WARN(dev, "uevent for unknown greybus device \"type\"!\n"); return -EINVAL; } + if (add_uevent_var(env, "BUS=%u", hd->bus_id)) + return -ENOMEM; + if (bundle) { // FIXME // add a uevent that can "load" a bundle type @@ -104,10 +110,6 @@ static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env) return 0; } - // FIXME - // "just" a module, be vague here, nothing binds to a module except - // the greybus core, so there's not much, if anything, we need to - // advertise. return 0; } |