/* Disconnect the driver specified by ImageHandle from all the devices in the handle database. Uninstall all the protocols installed in the driver entry point. */
EFI_STATUS EFIAPI RestJsonStructureUnload(IN EFI_HANDLE ImageHandle)
/* Disconnect the driver specified by ImageHandle from all the devices in the handle database. Uninstall all the protocols installed in the driver entry point. */
EFI_STATUS EFIAPI RestJsonStructureUnload(IN EFI_HANDLE ImageHandle)
{
  EFI_STATUS                    Status;
  REST_JSON_STRUCTURE_INSTANCE  *Instance;
  REST_JSON_STRUCTURE_INSTANCE  *NextInstance;
  Status = gBS->UninstallProtocolInterface (
                  mProtocolHandle,
                  &gEfiRestJsonStructureProtocolGuid,
                  (VOID *)&mRestJsonStructureProtocol
                  );
  if (IsListEmpty (&mRestJsonStructureList)) {
    return Status;
  }
  Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
  do {
    NextInstance = NULL;
    if (!IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
      NextInstance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
    }
    FreePool ((VOID *)Instance);
    Instance = NextInstance;
  } while (Instance != NULL);
  return Status;
}