From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF4A61684BE for ; Wed, 20 May 2026 22:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779316016; cv=none; b=NUO/z0byQJ/GP5vPgwrJsS9gH3En2sW1NbYrFjro3C5SOECtUWItvFeFBoDV1s1xz27l7RQibTFZ7ozme8ntx5I6Y3Vmur8REPSjvxXbwrIKWkB7oqoU6Sa1CF3rvMr74ETiWRJBOia2lA4g5Ph5AwCTFf/gYAHFNYuiWZhcPf0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779316016; c=relaxed/simple; bh=cy+Adq9eGUkKCtEDYTRhdOcKj5ym02Xspdpj1pEVglQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IooWnCThNoEQBFlD68aytBbTnEfNHOWk79WztSkhU1qQP4LqUjEV0s4T8Hc4mJ48HCPNrstPs/JIyVRd+eRk1sjvYwqp8YN1RfT2KaMI8miotDCF0tNoFh/gAHuhdJnYMBERCgBw65fVIFOjRUu+og40tXKq99oSUtoXW/LwsFg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=jAg3j/Fm; arc=none smtp.client-ip=74.125.82.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jAg3j/Fm" Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-2ef2a1cc06dso4651931eec.0 for ; Wed, 20 May 2026 15:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1779316013; x=1779920813; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=XBKzFLJqNcvKI9IGFU+zHGxm6jLvnApDykMdfiJ4Nmc=; b=jAg3j/FmVAk45onQ8QgNTyffC4tfm0ixpvh6XvtxupmU47LdaBkZVbQNpjA4CVI7CJ eGwGD2z2lKHh4hql6v+1mZiRhVMutW8CNCydmLv4iD9hYX9vx+Nd0fvd5c/k4gWC2hMv O19BrWCwG6ODegMaJdDMnHJV2yTCaU6asV1cM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779316013; x=1779920813; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XBKzFLJqNcvKI9IGFU+zHGxm6jLvnApDykMdfiJ4Nmc=; b=iuyHwuEDNm6GbEfQlSc8Viv8Bw1JyLZcMmDpnBu2U8+jmx7PsaQT6ChrTCPKGGW+nJ u9m3Ur1O4jbY4qzogmsFAZ+xEkN2IKp5mvBQUGNFLH+QUvz+6VcFUwX0Axlr75duznT0 LYD4A5deCXGPZtDg5vBvhPR51i4KDzd+eBsHuZ8Wzwz/JIE3vyHgTkQI5snl1j2M/TJY Yaly9UHXXFm1iMRgHS6rQmWz0p8atfQFQ4qLnX9TO+DsOlTST+ecwET6BRxkENaliGOV IdGu5nRJU7yxcjRUbNrnuzOw31XE7594DOW/fAK70aCrCSi25oqbWPQsu2frvqChty1B uWoA== X-Forwarded-Encrypted: i=1; AFNElJ9ZQtKshKwgp5a/Kz3TOPXfSQj/rgcJN9wP11bBlP4STkLQxXogVa1sHZvKHJPxMdplV4peMiVO6pppZj0=@vger.kernel.org X-Gm-Message-State: AOJu0Yzbfkcp+ljnG45HkmczgYzhnZ3VT9ak+N3DORExdEhjUg8vgcJu hFv+BtdZ3iXT7Mc+Ec7F/WheyIEinGBvXO2wmbTj6QGllZwLgQmVe93J3CaS4Ko8xA== X-Gm-Gg: Acq92OGZ6CpzCU8IaMtrjhhQfkNJ5/+U6iHvsCxVCarWMAOerWMIBw3xDLJz+swOnJ7 U6OoqsRoMRccvhfQQ7eD5/J6/Rmy5HiOBmiqh7MeNoa6qvwavlt81uWiaqR6OeTf1OFwX5V71HR QVobCa8gVslAsFzxvpibWQiHKZQqg32XH0w0jXcuLBZ/BTzic3crxAJgijDqSISjgG0GtJpF2Zp t8nyINWKHNNC+aKXjkpfsvaiJAJhVafbgZOXKkDoPF5qktZjDMwK2vXNQQPTIR39+XY4kOe23rn KU7lhoEZfgOaKn8xOHV7wvgrwMZPz7WR+f5hZHwcsgbsiuMpJbEsSdK/kUTj1q/UwDKl70iIU6K MrDVR+Y1xcUga7a5WmspIDIHSSVXTXaoZWv7Mdlcl8H4fFyeFFVF392PiGl+/Qys7GwnLAyDz21 CcrrsAGt+7ZAjA10iV3SinJEfCZrKlrKnUEbJo+FXG7gtVyQupQt15AMK30lGjRA== X-Received: by 2002:a05:7300:2156:b0:2f5:5dd3:1fcf with SMTP id 5a478bee46e88-3042f477009mr321500eec.10.1779316012933; Wed, 20 May 2026 15:26:52 -0700 (PDT) Received: from localhost ([2a00:79e0:2e7c:8:3e8a:9a7f:5887:90fd]) by smtp.gmail.com with UTF8SMTPSA id 5a478bee46e88-30294500a97sm22879655eec.9.2026.05.20.15.26.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 May 2026 15:26:52 -0700 (PDT) Date: Wed, 20 May 2026 15:26:49 -0700 From: Brian Norris To: Chen-Yu Tsai Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yingying Tang Subject: Re: [PATCH v2] checkpatch: Don't emit warnings for ID-base USB & PCI DT compatibles Message-ID: References: <20260520084428.257066-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260520084428.257066-1-wenst@chromium.org> Hi Chen-Yu, On Wed, May 20, 2026 at 04:44:27PM +0800, Chen-Yu Tsai wrote: > The USB and PCI device bindings define some compatible patterns based > on device IDs that use the comma to separate vendor and product IDs. > > These prefix patterns include: > > - ^usb(if)?[0-9a-f]{1,4}, > - ^pci[0-9a-f]{2,4}, > - ^pciclass, > > These are not real vendor prefixes. Don't emit warnings for them. > Instead just skip over the DT compatible check altogether, and leave > the real check to the DT validator. This avoids false positive warnings > about undocumented DT vendor prefixes and compatibles. > > Note that the script mostly only checks the first compatible string of > each node, as it processes the source file line-by-line, and the check > only matches on the line with 'compatible = "..."'. Otherwise there > would be more warnings from arch/mips/boot/dts/loongson/ls7a-pch.dtsi > since that file also includes compatibles like "pciclass0c0310" and > "pciclass0c03" which are not accepted either. Looking at IEEE Std 1275-1994 (PCI Bus Binding), you're right, that's incorrect. > "pci0014,7a24.0" is not > valid either, It's possible that's trying to follow the "pciVVVV,DDDD.RR" format mentioned in the spec, although it's not clear if it should require 2 digits after the dot/period. Notably, the dt-schema does *not* include the "dot" option at all, so maybe there's room for improvement. Anyway, that just adds to why this is a good choice: > but this patch leaves the real check to the DT validator. > Signed-off-by: Chen-Yu Tsai > --- > Changes since v1: > - Moved check earlier and match against full compatible string to avoid > false positives for undocumented compatibles as well > - Added comma to patterns as they are now matched against the full > compatible string > - Fixed patterns in commit message to just cover the prefix portion > > This is a simplified version of what Brian Norris previously posted [1], > but more comprehensive and more perl-y than what Yingying Tang posted > [2], which only covered the second pattern. > > This is based on next-20260519. > > Also, odd observation: the other regex patterns in this script escape > the comma ',', but AFAIK this is not needed. > > [1] https://lore.kernel.org/all/20190223022440.146915-1-briannorris@chromium.org/ > [2] https://lore.kernel.org/all/20251210073812.1380803-1-yingying.tang@oss.qualcomm.com/ > --- > scripts/checkpatch.pl | 6 ++++++ > 1 file changed, 6 insertions(+) Reviewed-by: Brian Norris Tested-by: Brian Norris > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 0d18771f1b01..d4ee9d88ad07 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -3783,6 +3783,12 @@ sub process { > my $vp_file = $dt_path . "vendor-prefixes.yaml"; > > foreach my $compat (@compats) { > + # Skip ID-based PCI and USB compatible patterns. > + # DT validation will check them properly. > + next if $compat =~ /^pciclass,/; > + next if $compat =~ /^pci[a-f0-9]{2,4},/; > + next if $compat =~ /^usb(if)?[a-f0-9]{1,4},/; > + > my $compat2 = $compat; > $compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/; > my $compat3 = $compat; > -- > 2.54.0.631.ge1b05301d1-goog >