On 04/08/14 09:27, jgross@xxxxxxxx wrote: > > + > +static void scsifront_backend_changed(struct xenbus_device *dev, > + enum xenbus_state backend_state) > +{ > + struct vscsifrnt_info *info = dev_get_drvdata(&dev->dev); > + > + DPRINTK("%p %u %u\n", dev, dev->state, backend_state); > + > + switch (backend_state) { > + case XenbusStateUnknown: > + case XenbusStateInitialising: > + case XenbusStateInitWait: > + case XenbusStateInitialised: > + break; > + > + case XenbusStateConnected: > + scsifront_read_backend_params(dev, info); > + if (xenbus_read_driver_state(dev->nodename) == > + XenbusStateInitialised) { > + scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_ADD_LUN); > + } > + > + if (dev->state != XenbusStateConnected) > + xenbus_switch_state(dev, XenbusStateConnected); > + break; > + > + case XenbusStateClosed: > + if (dev->state == XenbusStateClosed) > + break; > + /* Missed the backend's Closing state -- fallthrough */ > + case XenbusStateClosing: > + scsifront_disconnect(info); > + break; > + > + case XenbusStateReconfiguring: > + scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_DEL_LUN); > + xenbus_switch_state(dev, XenbusStateReconfiguring); > + break; > + > + case XenbusStateReconfigured: > + scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_ADD_LUN); > + xenbus_switch_state(dev, XenbusStateConnected); > + break; > + } > +} I would like to see this state machine in common code but I'm not going to insist on it since this is a existing driver. Xen related parts: Acked-by: David Vrabel <david.vrabel@xxxxxxxxxx> David -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html