xenbus: get rid of the initialized trick

Use an instance() method as we do in other places.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenbus: add detach function

The device drivers can regiter a detach function, but we were so far using
only probe and attach. Add detach to the mix.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenfront: derive unit number from xenstore

We currently bump an integer and have that to be the index number.  However,
the interfaces are already indexed in the xenstore. Following a different
indexing scheme is possible and valid, but has the side effect that referring
to "interface 0" from outside the guest won't necessarily match the same
"interface 0" within it.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenfront: code teardown sequence

- Close our endpoint, so the backend will let the grants go.
- stop the network interface
- free each ring element and release grants
- free the rings themselves, as well as the remaining structures.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xen: allow an interrupt handler to be unregistered

As part of the teardown process for a device, we need to be able to unregister
its interrupt handler. The driver layer will call it, but the function is
currently unimplemented.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenbus: expose function to detach a device

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>