From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1798D430C1;
	Mon, 21 Aug 2023 13:38:59 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C46B7432B6;
	Mon, 21 Aug 2023 13:36:56 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id A7786432BE
 for <dev@dpdk.org>; Mon, 21 Aug 2023 13:36:53 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1692617813;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=CP0ka1eoWav1ZK33xUuS/8Eo6Se7/a5DS0I01DEk/l4=;
 b=XHjDpNSZx1Kqy5hFmLRXALogKJU7IlFsy+QbnEd4JhXrl4adtlPB8RZ7SwAnEyY2/26+lL
 rUNI80t9IDzjkj2rQ18Tm+JohA2IANIBDLQ7z5sFCGrteucr//UbePGh7dh58zi8sXY+vJ
 /HYxl3yx/E81zW5weq+TGRwTfvYc5xs=
Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by
 relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-688-eSWHyLP6OSeQvYLTjTVAXw-1; Mon, 21 Aug 2023 07:36:51 -0400
X-MC-Unique: eSWHyLP6OSeQvYLTjTVAXw-1
Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com
 [10.11.54.9])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77A833815EE7;
 Mon, 21 Aug 2023 11:36:51 +0000 (UTC)
Received: from dmarchan.redhat.com (unknown [10.45.226.19])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 4F82E492C13;
 Mon, 21 Aug 2023 11:36:50 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, ferruh.yigit@amd.com, chenbo.xia@intel.com,
 nipun.gupta@amd.com, bruce.richardson@intel.com
Subject: [PATCH v2 15/15] devtools: forbid inclusion of Linux header for PCI
Date: Mon, 21 Aug 2023 13:35:48 +0200
Message-ID: <20230821113549.3191921-16-david.marchand@redhat.com>
In-Reply-To: <20230821113549.3191921-1-david.marchand@redhat.com>
References: <20230803075038.307012-1-david.marchand@redhat.com>
 <20230821113549.3191921-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"; x-default=true
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
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>
Errors-To: dev-bounces@dpdk.org

Refrain from including Linux-only pci_regs.h header.
Instead, prefer our own definitions from the pci library.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 43f5e36a18..5d3c5aaba5 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -127,6 +127,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid inclusion of Linux header for PCI constants
+	awk -v FOLDERS="lib drivers app examples" \
+		-v EXPRESSIONS='include.*linux/pci_regs\\.h' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using linux/pci_regs.h, prefer rte_pci.h' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# forbid use of experimental build flag except in examples
 	awk -v FOLDERS='lib drivers app' \
 		-v EXPRESSIONS='-DALLOW_EXPERIMENTAL_API allow_experimental_apis' \
-- 
2.41.0