From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <rosen.xu@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 7FC1D5F36
 for <dev@dpdk.org>; Tue, 15 Jan 2019 09:39:03 +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 fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 15 Jan 2019 00:39:02 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.56,481,1539673200"; d="scan'208";a="125987939"
Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205])
 by FMSMGA003.fm.intel.com with ESMTP; 15 Jan 2019 00:39:02 -0800
Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by
 fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS)
 id 14.3.408.0; Tue, 15 Jan 2019 00:39:02 -0800
Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by
 FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS)
 id 14.3.408.0; Tue, 15 Jan 2019 00:39:01 -0800
Received: from shsmsx152.ccr.corp.intel.com ([169.254.6.44]) by
 SHSMSX103.ccr.corp.intel.com ([169.254.4.150]) with mapi id 14.03.0415.000;
 Tue, 15 Jan 2019 16:39:00 +0800
From: "Xu, Rosen" <rosen.xu@intel.com>
To: "Pei, Andy" <andy.pei@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Zhang, Tianfei" <tianfei.zhang@intel.com>, "Yigit, Ferruh"
 <ferruh.yigit@intel.com>
Thread-Topic: [DPDK]  /driver/bus/ifpga: fix driver probe failure handler
Thread-Index: AQHUq6pfTuamVPmjp0WduSNDKipHCKWwAneg
Date: Tue, 15 Jan 2019 08:38:59 +0000
Message-ID: <0E78D399C70DA940A335608C6ED296D73A4BF686@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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTBhMzgwNjItMjJkMi00OTE4LTllYTEtNjA5OGM2NWMxOTVhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS0E5NWtWTDZicXNta3oyTjIxXC9CdmtnNUV0U201RW5DcDFYXC9kS0FlMkNRKzlrSWJzY09aMFpqTDRFcUVwTnpOIn0=
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 15 Jan 2019 08:39:04 -0000

Hi Andy,

> -----Original Message-----
> From: Pei, Andy
> Sent: Monday, January 14, 2019 9:41
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Pei, Andy <andy.pei@intel.com>
> Subject: [DPDK] /driver/bus/ifpga: fix driver probe failure handler
>=20
The subject should be started with bus/ifpga.
I think the tital should be fix ifpga afu driver probe failure handler

> In the original code, when a device probe a driver, if the driver in the =
driver
In the original code, when a AFU device is scanned, if its driver in the dr=
iver

> list does not support this device, a error is returned.
an error will return

> After this patch, a device wil try to match driver in the driver list one=
 by one
With this patch, a device will......
> 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

Pls use git fixline 05fa3d4a6539 to generate the full fixline

> cc: rosen.xu@intel.com
> cc: tianfei.zhang@intel.com
> cc: andy.pei@intel.com
Don't need these cc, pls only Cc: stable@dpdk.org

> Signed-off-by: AndyPei <andy.pei@intel.com>
> ---
>  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