From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id A144F1B466 for ; Mon, 14 Jan 2019 06:14:45 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jan 2019 21:14:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,476,1539673200"; d="scan'208";a="106375481" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga007.jf.intel.com with ESMTP; 13 Jan 2019 21:14:44 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 13 Jan 2019 21:14:44 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 13 Jan 2019 21:14:43 -0800 Received: from shsmsx152.ccr.corp.intel.com ([169.254.6.44]) by shsmsx102.ccr.corp.intel.com ([169.254.2.63]) with mapi id 14.03.0415.000; Mon, 14 Jan 2019 13:14:41 +0800 From: "Xu, Rosen" To: "Pei, Andy" , "dev@dpdk.org" CC: "Zhang, Tianfei" Thread-Topic: [DPDK] /driver/bus/ifpga: fix driver probe failure handler Thread-Index: AQHUq6pfTuamVPmjp0WduSNDKipHCKWuOLtg Date: Mon, 14 Jan 2019 05:14:41 +0000 Message-ID: <0E78D399C70DA940A335608C6ED296D73A4B75AB@SHSMSX152.ccr.corp.intel.com> References: <1547430043-62302-1-git-send-email-andy.pei@intel.com> In-Reply-To: <1547430043-62302-1-git-send-email-andy.pei@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDdiMTU1OTEtMjBjNC00ZjlhLTkyMGEtOWVhODg5ZTM4N2JkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSTlBemdPNytaVzM3RThBSWVGMkFTZERyQVQ2dXpad1wvSFJxcDhuTDJ6d05xV3VrN2dBUDN0bDkzZ2wwSzIyZ1gifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [DPDK] /driver/bus/ifpga: fix 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: Mon, 14 Jan 2019 05:14:46 -0000 > -----Original Message----- > From: Pei, Andy > Sent: Monday, January 14, 2019 9:41 > To: dev@dpdk.org > Cc: Xu, Rosen ; Zhang, Tianfei > ; Pei, Andy > Subject: [DPDK] /driver/bus/ifpga: fix driver probe failure handler >=20 > In the original code, when a device probe a driver, if the driver in the = driver > list does not support this device, a error is returned. > After this patch, a device wil try to match driver in the driver list one= by one > until an appropriate driver is found. If the current driver does not supp= ort > the device or some error happens, just try the next driver in the list. > If all the drivers in the list are tried and no driver matches. 0 is retu= rned. >=20 > fixes: 05fa3d4a6539 > cc: rosen.xu@intel.com > cc: tianfei.zhang@intel.com > cc: andy.pei@intel.com >=20 > Signed-off-by: AndyPei > --- > drivers/bus/ifpga/ifpga_bus.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.= c > index e4b7b6f..55d3abf 100644 > --- a/drivers/bus/ifpga/ifpga_bus.c > +++ b/drivers/bus/ifpga/ifpga_bus.c > @@ -306,12 +306,19 @@ void rte_ifpga_driver_unregister(struct > rte_afu_driver *driver) > } >=20 > TAILQ_FOREACH(drv, &ifpga_afu_drv_list, next) { > - if (ifpga_probe_one_driver(drv, afu_dev)) { > - ret =3D -1; > - break; > - } > + ret =3D 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 =3D=3D NULL)) > + return 0; > + else > + return ret; > } >=20 > /* > -- > 1.8.3.1 Acked-by: Rosen Xu