greybus: add bundle class to the bundle uevent
authorGreg Kroah-Hartman <gregkh@google.com>
Fri, 22 Jan 2016 02:13:41 +0000 (18:13 -0800)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 22 Jan 2016 06:43:04 +0000 (22:43 -0800)
When bundles are added and then removed, we have a race where we go to
read the sysfs file, but it is now for a different bundle than the
uevent was originally for.  So add the bundle class to the uevent so we
"know" what the correct bundle class was.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/core.c

index 522d0594eebc5284e41c5ef60d2c77b7a054c9ab..1bb685bae7d267b29b8cebf9c10e9151b44c3e57 100644 (file)
@@ -125,6 +125,8 @@ static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env)
 
                if (add_uevent_var(env, "BUNDLE=%u", bundle->id))
                        return -ENOMEM;
+               if (add_uevent_var(env, "BUNDLE_CLASS=%02x", bundle->class))
+                       return -ENOMEM;
        }
 
        return 0;