struct gb_svc {
        struct gb_connection    *connection;
        enum gb_svc_state       state;
+       struct ida              device_id_map;
 };
 
 struct svc_hotplug {
        struct gb_svc_intf_hotplug_request data;
 };
 
-static struct ida greybus_svc_device_id_map;
 
 /*
  * AP's SVC cport is required early to get messages from the SVC. This happens
         * XXX Do we need to allocate device ID for SVC or the AP here? And what
         * XXX about an AP with multiple interface blocks?
         */
-       device_id = ida_simple_get(&greybus_svc_device_id_map,
+       device_id = ida_simple_get(&svc->device_id_map,
                                   GB_DEVICE_ID_MODULES_START, 0, GFP_KERNEL);
        if (device_id < 0) {
                ret = device_id;
         * XXX anymore.
         */
 ida_put:
-       ida_simple_remove(&greybus_svc_device_id_map, device_id);
+       ida_simple_remove(&svc->device_id_map, device_id);
 destroy_interface:
        gb_interface_remove(hd, intf_id);
 free_svc_hotplug:
         */
        gb_svc_route_destroy(svc, hd->endo->ap_intf_id, intf_id);
 
-       ida_simple_remove(&greybus_svc_device_id_map, device_id);
+       ida_simple_remove(&svc->device_id_map, device_id);
 
        return 0;
 }
        WARN_ON(connection->hd->initial_svc_connection);
        connection->hd->initial_svc_connection = connection;
 
-       ida_init(&greybus_svc_device_id_map);
+       ida_init(&svc->device_id_map);
 
        return 0;
 }
 {
        struct gb_svc *svc = connection->private;
 
+       ida_destroy(&svc->device_id_map);
        connection->hd->svc = NULL;
        connection->private = NULL;
        kfree(svc);