From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E8A0CA04A4; Tue, 1 Mar 2022 15:53:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1FA440DF6; Tue, 1 Mar 2022 15:53:24 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 963144067B; Tue, 1 Mar 2022 15:53:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646146402; x=1677682402; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=cA+3hPpf/ZlCjlpeyJHbYJOBcvUWMH9fbrt5zsSbsFU=; b=nO9HK8OHUdZPgF9m2PvHMR7z22uxqF2gVfunWTvbrF23gZ5Q15TJaT+w Z6ZRh1DtBhh/oYyJxhQ4Ys2uRubONjHC1ybYGxEcjadNqK+p9V+JqVuZM BG0DgMQoEQvnPKtnPNqJqBhk/B6e/vM8t0sMAev+z/BqIaBqnlWyAjNpj TufnNm8WCoGYdep+A0Z6YcCxUEKFAQ8UaoeINhdJW/6xd8e1B4pshsyQ8 tnbDA0olaEs9vXuoV1YQp62t37eWDJcT4b7AK5LaVJHx1z35ccyg5TRC0 Y0EcVD6fVufcT2KaAKWAabAsY2oMT5G+BrkUj0i40C7DwTq3S955/FYLC Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10272"; a="253073195" X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="253073195" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 06:53:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="534919683" Received: from silpixa00400214.ir.intel.com (HELO silpixa00400214.ger.corp.intel.com) ([10.237.223.184]) by orsmga007.jf.intel.com with ESMTP; 01 Mar 2022 06:53:20 -0800 From: Shibin Koikkara Reeny To: david.hunt@intel.com Cc: dev@dpdk.org, Shibin Koikkara Reeny , alan.carew@intel.com, stable@dpdk.org Subject: [PATCH] examples/vm_power: replace list foreach with while loop Date: Tue, 1 Mar 2022 14:53:13 +0000 Message-Id: <20220301145313.560577-1-shibin.koikkara.reeny@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Linux header files don't support LIST_FOREACH_SAFE so replacing LIST_FOREACH with while loop. Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host") Cc: alan.carew@intel.com Cc: stable@dpdk.org Signed-off-by: Shibin Koikkara Reeny --- examples/vm_power_manager/channel_manager.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index 838465ab4b..b4dea4b275 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -1005,10 +1005,10 @@ channel_manager_exit(void) { unsigned i; char mask[RTE_MAX_LCORE]; - struct virtual_machine_info *vm_info; - - LIST_FOREACH(vm_info, &vm_list_head, vms_info) { + struct virtual_machine_info *vm_info = LIST_FIRST(&vm_list_head); + /* No LIST_FOREACH_SAFE, using while instead. */ + while (vm_info) { rte_spinlock_lock(&(vm_info->config_spinlock)); memcpy(mask, (char *)vm_info->channel_mask, RTE_MAX_LCORE); @@ -1024,6 +1024,8 @@ channel_manager_exit(void) LIST_REMOVE(vm_info, vms_info); rte_free(vm_info); + + vm_info = LIST_NEXT((vm_info), vms_info); } if (global_hypervisor_available) { -- 2.25.1