[usb-bus] Re-add device for Device Firmware Upgrade

Once we finish loading firmware onto the device, we issue a reset.
If the device descriptors have changed (DFU succeeded), we need to
remove the existing device and re-add it so the correct driver
will be loaded.

Since this bus_reinitialize_device function is called from the device manager
thread, there should be no race condition of calls from the device
manager trying to do bus_add_device or bus_remove_device.

TEST= plug in DFU device and run usb-fwloader -d -f firmware_image
Verified device appeared in lsusb

ZX-3155 #comment

Change-Id: Ieafe26e89e2e7c57cff9da22107b54b532653f24
diff --git a/system/dev/usb/usb-bus/usb-bus.c b/system/dev/usb/usb-bus/usb-bus.c
index 961f2de..3bb9572 100644
--- a/system/dev/usb/usb-bus/usb-bus.c
+++ b/system/dev/usb/usb-bus/usb-bus.c
@@ -95,7 +95,19 @@
         zxlogf(INFO, "device updated from VID 0x%x PID 0x%x to VID 0x%x PID 0x%x\n",
                device->device_desc.idVendor, device->device_desc.idProduct,
                updated_desc.idVendor, updated_desc.idProduct);
-        // TODO(jocelyndang): handle this.
+
+        uint32_t hub_id = device->hub_id;
+        usb_speed_t speed = device->speed;
+        status = bus_remove_device(bus, device_id);
+        if (status != ZX_OK) {
+            zxlogf(ERROR, "could not remove device %u, got err %d\n", device_id, status);
+            return status;
+        }
+        status = bus_add_device(bus, device_id, hub_id, speed);
+        if (status != ZX_OK) {
+            zxlogf(ERROR, "could not add device %u, got err %d\n", device_id, status);
+        }
+        return status;
     }
 
 done: