From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 73051288C; Fri, 18 Jan 2019 12:12:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jan 2019 03:12:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,491,1539673200"; d="scan'208";a="126839114" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by FMSMGA003.fm.intel.com with ESMTP; 18 Jan 2019 03:12:35 -0800 From: Ferruh Yigit To: dev@dpdk.org, Rosen Xu Cc: Andy Pei , stable@dpdk.org Date: Fri, 18 Jan 2019 11:12:33 +0000 Message-Id: <20190118111233.45114-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <1547703414-203279-1-git-send-email-andy.pei@intel.com> References: <1547703414-203279-1-git-send-email-andy.pei@intel.com> Subject: [dpdk-dev] [PATCH v2] bus/ifpga: fix ifpga afu driver probe failure handler X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2019 11:12:38 -0000 From: Andy Pei In the original code, when an AFU device probe a driver, if the first driver in the driver list does not support this device or some error happens, bus probe returns an error. With this patch, a device will try to match driver in the driver list one by one until an appropriate driver is found. If some error happens, the error is returned. If the current driver does not support the device, just try the next driver in the list. If all the drivers in the list are tried and no driver matches, 0 is returned. Otherwise, the error code is returned. Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") Cc: stable@dpdk.org Signed-off-by: Andy Pei Reviewed-by: Ferruh Yigit Acked-by: Rosen Xu --- drivers/bus/ifpga/ifpga_bus.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index e4b7b6f50..55d3abf9f 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -306,12 +306,19 @@ ifpga_probe_all_drivers(struct rte_afu_device *afu_dev) } TAILQ_FOREACH(drv, &ifpga_afu_drv_list, next) { - if (ifpga_probe_one_driver(drv, afu_dev)) { - ret = -1; - break; - } + ret = ifpga_probe_one_driver(drv, afu_dev); + if (ret < 0) + /* negative value is an error */ + return ret; + if (ret > 0) + /* positive value means driver doesn't support it */ + continue; + return 0; } - return ret; + if ((ret > 0) && (afu_dev->driver == NULL)) + return 0; + else + return ret; } /* -- 2.17.2