greybus: svc: Allow consecutive hotplug events for the same module
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 23 Sep 2015 23:48:08 +0000 (16:48 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 24 Sep 2015 22:16:54 +0000 (15:16 -0700)
commitbbaca7115167088e8177ab8cc7aafdcb8666dea9
tree59aed13fa3b0226af54b5cf8fa33e5521d1d8fd3
parentc06307c3b476a40dfc853af34af76b591115e42c
greybus: svc: Allow consecutive hotplug events for the same module

There are two cases where the AP may receive hotplug event for an
existing interface, without first getting a hot-unplug request for it.

- bootrom loading the firmware image and booting into that, which
  only generates a hotplug event. i.e. no hot-unplug event, as the
  module never went away.
- Or the firmware on the module crashed and sent hotplug request again
  to the SVC, which got propagated to AP.

Handle such cases by first removing the interface, with a clear print
message shown to the user. And then following the normal hotplug
sequence to add the interface.

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>
drivers/staging/greybus/svc.c