diff options
| author | Mark Brown <broonie@kernel.org> | 2026-09-07 14:27:41 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-09-07 14:27:41 +0100 |
| commit | fe5b3ffc1aa07226a51e145e7d7d608c81615cc8 (patch) | |
| tree | 772baf8c30b453ae3d07da027bae28c9471323c6 | |
| parent | 69ef46dc62b84973a6d10632580522c0c5022db1 (diff) | |
| parent | 8273a4059c41748d21a7dfc076407396ddca25b5 (diff) | |
| download | linux-next-fe5b3ffc1aa07226a51e145e7d7d608c81615cc8.tar.gz linux-next-fe5b3ffc1aa07226a51e145e7d7d608c81615cc8.zip | |
Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
108 files changed, 1772 insertions, 518 deletions
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml index 949444aba1f8..f4101f94241a 100644 --- a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml +++ b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml @@ -308,7 +308,7 @@ examples: arm,trig-in-sigs = <0 1>; arm,trig-in-types = <PE_DBGTRIGGER PE_PMUIRQ>; - arm,trig-out-sigs = <0 1 2 >; + arm,trig-out-sigs = <0 1 2>; arm,trig-out-types = <PE_EDBGREQ PE_DBGRESTART PE_CTIIRQ>; diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt b/Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt deleted file mode 100644 index 7de43bf41fdc..000000000000 --- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt +++ /dev/null @@ -1,30 +0,0 @@ -MediaTek g3dsys controller -============================ - -The MediaTek g3dsys controller provides various clocks and reset controller to -the GPU. - -Required Properties: - -- compatible: Should be: - - "mediatek,mt2701-g3dsys", "syscon": - for MT2701 SoC - - "mediatek,mt7623-g3dsys", "mediatek,mt2701-g3dsys", "syscon": - for MT7623 SoC -- #clock-cells: Must be 1 -- #reset-cells: Must be 1 - -The g3dsys controller uses the common clk binding from -Documentation/devicetree/bindings/clock/clock-bindings.txt -The available clocks are defined in dt-bindings/clock/mt*-clk.h. - -Example: - -g3dsys: clock-controller@13000000 { - compatible = "mediatek,mt7623-g3dsys", - "mediatek,mt2701-g3dsys", - "syscon"; - reg = <0 0x13000000 0 0x200>; - #clock-cells = <1>; - #reset-cells = <1>; -}; diff --git a/Documentation/devicetree/bindings/arm/omap/mpu.txt b/Documentation/devicetree/bindings/arm/omap/mpu.txt deleted file mode 100644 index e41490e6979c..000000000000 --- a/Documentation/devicetree/bindings/arm/omap/mpu.txt +++ /dev/null @@ -1,54 +0,0 @@ -* TI - MPU (Main Processor Unit) subsystem - -The MPU subsystem contain one or several ARM cores -depending of the version. -The MPU contain CPUs, GIC, L2 cache and a local PRCM. - -Required properties: -- compatible : Should be "ti,omap3-mpu" for OMAP3 - Should be "ti,omap4-mpu" for OMAP4 - Should be "ti,omap5-mpu" for OMAP5 -- ti,hwmods: "mpu" - -Optional properties: -- sram: Phandle to the ocmcram node - -am335x and am437x only: -- pm-sram: Phandles to ocmcram nodes to be used for power management. - First should be type 'protect-exec' for the driver to use to copy - and run PM functions, second should be regular pool to be used for - data region for code. See Documentation/devicetree/bindings/sram/sram.yaml - for more details. - -Examples: - -- For an OMAP5 SMP system: - -mpu { - compatible = "ti,omap5-mpu"; - ti,hwmods = "mpu" -}; - -- For an OMAP4 SMP system: - -mpu { - compatible = "ti,omap4-mpu"; - ti,hwmods = "mpu"; -}; - - -- For an OMAP3 monocore system: - -mpu { - compatible = "ti,omap3-mpu"; - ti,hwmods = "mpu"; -}; - -- For an AM335x system: - -mpu { - compatible = "ti,omap3-mpu"; - ti,hwmods = "mpu"; - pm-sram = <&pm_sram_code - &pm_sram_data>; -}; diff --git a/Documentation/devicetree/bindings/arm/ti/ti,omap-mpu.yaml b/Documentation/devicetree/bindings/arm/ti/ti,omap-mpu.yaml new file mode 100644 index 000000000000..abd8c64e8e9f --- /dev/null +++ b/Documentation/devicetree/bindings/arm/ti/ti,omap-mpu.yaml @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/ti/ti,omap-mpu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI MPU (Main Processor Unit) subsystem + +maintainers: + - Benoit Cousson <b-cousson@ti.com> + +description: + The MPU subsystem contains one or several ARM cores depending on the version. + The MPU contains CPUs, GIC, L2 cache and a local PRCM. + +properties: + compatible: + enum: + - ti,omap3-mpu + - ti,omap4-mpu + - ti,omap5-mpu + + ti,hwmods: + $ref: /schemas/types.yaml#/definitions/string + description: Name of the hwmod associated with the MPU + const: mpu + deprecated: true + + sram: + description: ocmcram node + + pm-sram: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: ocmcram nodes for power management. For am335x and am437x. + items: + - items: + - description: ocmcram node of type protect-exec for PM functions + - items: + - description: ocmcram node of regular pool to be used for data region + +required: + - compatible + +additionalProperties: false + +examples: + - | + mpu { + compatible = "ti,omap5-mpu"; + ti,hwmods = "mpu"; + }; + + - | + mpu { + compatible = "ti,omap3-mpu"; + ti,hwmods = "mpu"; + pm-sram = <&pm_sram_code &pm_sram_data>; + }; diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt deleted file mode 100644 index 18729f6fe1e5..000000000000 --- a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt +++ /dev/null @@ -1,29 +0,0 @@ -* OMAP OCP2SCP - ocp interface to scp interface - -properties: -- compatible : Should be "ti,am437x-ocp2scp" for AM437x processor - Should be "ti,omap-ocp2scp" for all others -- reg : Address and length of the register set for the device -- #address-cells, #size-cells : Must be present if the device has sub-nodes -- ranges : the child address space are mapped 1:1 onto the parent address space -- ti,hwmods : must be "ocp2scp_usb_phy" - -Sub-nodes: -All the devices connected to ocp2scp are described using sub-node to ocp2scp - -ocp2scp@4a0ad000 { - compatible = "ti,omap-ocp2scp"; - reg = <0x4a0ad000 0x1f>; - #address-cells = <1>; - #size-cells = <1>; - ranges; - ti,hwmods = "ocp2scp_usb_phy"; - - subnode1 { - ... - }; - - subnode2 { - ... - }; -}; diff --git a/Documentation/devicetree/bindings/bus/ti,omap-ocp2scp.yaml b/Documentation/devicetree/bindings/bus/ti,omap-ocp2scp.yaml new file mode 100644 index 000000000000..a8852185144d --- /dev/null +++ b/Documentation/devicetree/bindings/bus/ti,omap-ocp2scp.yaml @@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bus/ti,omap-ocp2scp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI OMAP OCP to SCP bus bridge + +maintainers: + - Kishon Vijay Abraham I <kishon@ti.com> + +properties: + compatible: + oneOf: + - items: + - const: ti,am437x-ocp2scp + - const: ti,omap-ocp2scp + - const: ti,omap-ocp2scp + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + ranges: true + + ti,hwmods: + $ref: /schemas/types.yaml#/definitions/string + description: Name of the hwmod associated with the device. + deprecated: true + +required: + - compatible + - "#address-cells" + - "#size-cells" + +allOf: + - if: + properties: + compatible: + contains: + const: ti,am437x-ocp2scp + then: + properties: + reg: false + else: + required: + - reg + +additionalProperties: + type: object + +examples: + - | + ocp2scp@4a0ad000 { + compatible = "ti,omap-ocp2scp"; + reg = <0x4a0ad000 0x1f>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + phy@80 { + compatible = "ti,omap-usb2"; + reg = <0x80 0x58>; + ctrl-module = <&omap_control_usb2phy>; + clocks = <&usb_phy_cm_clk32k>; + clock-names = "wkupclk"; + #phy-cells = <0>; + }; + }; diff --git a/Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml b/Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml index 17ea06719b56..b869552596f4 100644 --- a/Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml +++ b/Documentation/devicetree/bindings/display/bridge/sil,sii9022.yaml @@ -128,7 +128,7 @@ examples: cvcc12-supply = <&v1v2_hdmi>; #sound-dai-cells = <0>; - sil,i2s-data-lanes = < 0 1 2 >; + sil,i2s-data-lanes = <0 1 2>; clocks = <&mclk>; clock-names = "mclk"; diff --git a/Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml b/Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml index e3e668a12091..698cc14b027f 100644 --- a/Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml +++ b/Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml @@ -14,7 +14,7 @@ description: | details see ../mfd/delta,tn48m-cpld.yaml. Delta TN48M has an onboard Lattice CPLD that is used as an GPIO expander. - It provides 12 pins in total, they are input-only or ouput-only type. + It provides 12 pins in total, they are input-only or output-only type. properties: compatible: diff --git a/Documentation/devicetree/bindings/hwmon/adi,ltc2991.yaml b/Documentation/devicetree/bindings/hwmon/adi,ltc2991.yaml index 1ff44cb22ef4..2210764a81bb 100644 --- a/Documentation/devicetree/bindings/hwmon/adi,ltc2991.yaml +++ b/Documentation/devicetree/bindings/hwmon/adi,ltc2991.yaml @@ -49,7 +49,7 @@ patternProperties: shunt-resistor-micro-ohms: description: - The value of curent sense resistor in micro ohms. Pin configuration is + The value of current sense resistor in micro ohms. Pin configuration is set for differential input pair. adi,temperature-enable: diff --git a/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml b/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml index d1f26d5015f7..57caebe7af35 100644 --- a/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml +++ b/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml @@ -52,8 +52,8 @@ examples: axi_iic_0: i2c@40800000 { compatible = "xlnx,xps-iic-2.00.a"; clocks = <&clkc 15>; - interrupts = < 1 2 >; - reg = < 0x40800000 0x10000 >; + interrupts = <1 2>; + reg = <0x40800000 0x10000>; #size-cells = <0>; #address-cells = <1>; diff --git a/Documentation/devicetree/bindings/iio/light/upisemi,us5182.yaml b/Documentation/devicetree/bindings/iio/light/upisemi,us5182.yaml index dd78abe0ec8d..979d7e782290 100644 --- a/Documentation/devicetree/bindings/iio/light/upisemi,us5182.yaml +++ b/Documentation/devicetree/bindings/iio/light/upisemi,us5182.yaml @@ -69,7 +69,7 @@ examples: light-sensor@39 { compatible = "upisemi,usd5182"; reg = <0x39>; - upisemi,glass-coef = < 1000 >; + upisemi,glass-coef = <1000>; upisemi,dark-ths = /bits/ 16 <170 200 512 512 800 2000 4000 8000>; upisemi,upper-dark-gain = /bits/ 8 <0x00>; upisemi,lower-dark-gain = /bits/ 8 <0x16>; diff --git a/Documentation/devicetree/bindings/input/matrix-keymap.yaml b/Documentation/devicetree/bindings/input/matrix-keymap.yaml index ce910e4ac823..bef8f9813535 100644 --- a/Documentation/devicetree/bindings/input/matrix-keymap.yaml +++ b/Documentation/devicetree/bindings/input/matrix-keymap.yaml @@ -41,8 +41,7 @@ examples: - | keypad { /* ... */ - linux,keymap = < 0x00030012 - 0x0102003a >; + linux,keymap = <0x00030012 0x0102003a>; keypad,num-rows = <2>; keypad,num-columns = <8>; }; diff --git a/Documentation/devicetree/bindings/input/ti,tca8418.yaml b/Documentation/devicetree/bindings/input/ti,tca8418.yaml index 624a1830d0b0..a8897c5c4d9d 100644 --- a/Documentation/devicetree/bindings/input/ti,tca8418.yaml +++ b/Documentation/devicetree/bindings/input/ti,tca8418.yaml @@ -46,16 +46,15 @@ examples: interrupts = <11 IRQ_TYPE_EDGE_FALLING>; keypad,num-rows = <4>; keypad,num-columns = <4>; - linux,keymap = < MATRIX_KEY(0x00, 0x01, BTN_0) - MATRIX_KEY(0x00, 0x00, BTN_1) - MATRIX_KEY(0x01, 0x01, BTN_2) - MATRIX_KEY(0x01, 0x00, BTN_3) - MATRIX_KEY(0x02, 0x00, BTN_4) - MATRIX_KEY(0x00, 0x03, BTN_5) - MATRIX_KEY(0x00, 0x02, BTN_6) - MATRIX_KEY(0x01, 0x03, BTN_7) - MATRIX_KEY(0x01, 0x02, BTN_8) - MATRIX_KEY(0x02, 0x02, BTN_9) - >; + linux,keymap = <MATRIX_KEY(0x00, 0x01, BTN_0) + MATRIX_KEY(0x00, 0x00, BTN_1) + MATRIX_KEY(0x01, 0x01, BTN_2) + MATRIX_KEY(0x01, 0x00, BTN_3) + MATRIX_KEY(0x02, 0x00, BTN_4) + MATRIX_KEY(0x00, 0x03, BTN_5) + MATRIX_KEY(0x00, 0x02, BTN_6) + MATRIX_KEY(0x01, 0x03, BTN_7) + MATRIX_KEY(0x01, 0x02, BTN_8) + MATRIX_KEY(0x02, 0x02, BTN_9)>; }; }; diff --git a/Documentation/devicetree/bindings/interrupt-controller/qcom,pdc.yaml b/Documentation/devicetree/bindings/interrupt-controller/qcom,pdc.yaml index 8162a49d49a6..518fbf6b2761 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/qcom,pdc.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/qcom,pdc.yaml @@ -30,6 +30,7 @@ properties: - qcom,glymur-pdc - qcom,hawi-pdc - qcom,kaanapali-pdc + - qcom,kuno-pdc - qcom,maili-pdc - qcom,milos-pdc - qcom,nord-pdc diff --git a/Documentation/devicetree/bindings/media/nxp,imx8-jpeg.yaml b/Documentation/devicetree/bindings/media/nxp,imx8-jpeg.yaml index 6ba668aa633d..4727dd7040a8 100644 --- a/Documentation/devicetree/bindings/media/nxp,imx8-jpeg.yaml +++ b/Documentation/devicetree/bindings/media/nxp,imx8-jpeg.yaml @@ -95,7 +95,7 @@ examples: jpegdec: jpegdec@58400000 { compatible = "nxp,imx8qxp-jpgdec"; - reg = <0x58400000 0x00050000 >; + reg = <0x58400000 0x00050000>; clocks = <&img_jpeg_dec_lpcg IMX_LPCG_CLK_0>, <&img_jpeg_dec_lpcg IMX_LPCG_CLK_4>; interrupts = <GIC_SPI 309 IRQ_TYPE_LEVEL_HIGH>, @@ -111,7 +111,7 @@ examples: jpegenc: jpegenc@58450000 { compatible = "nxp,imx8qm-jpgenc", "nxp,imx8qxp-jpgenc"; - reg = <0x58450000 0x00050000 >; + reg = <0x58450000 0x00050000>; clocks = <&img_jpeg_enc_lpcg IMX_LPCG_CLK_0>, <&img_jpeg__lpcg IMX_LPCG_CLK_4>; interrupts = <GIC_SPI 305 IRQ_TYPE_LEVEL_HIGH>, diff --git a/Documentation/devicetree/bindings/mfd/ti,tps65910.yaml b/Documentation/devicetree/bindings/mfd/ti,tps65910.yaml index f1a76f88fc0c..f285e8cb29fb 100644 --- a/Documentation/devicetree/bindings/mfd/ti,tps65910.yaml +++ b/Documentation/devicetree/bindings/mfd/ti,tps65910.yaml @@ -208,7 +208,7 @@ examples: compatible = "ti,tps65910"; reg = <0x2d>; interrupt-parent = <&intc>; - interrupts = < 0 118 0x04 >; + interrupts = <0 118 0x04>; #gpio-cells = <2>; gpio-controller; diff --git a/Documentation/devicetree/bindings/nvmem/zii,rave-sp-eeprom.yaml b/Documentation/devicetree/bindings/nvmem/zii,rave-sp-eeprom.yaml index d073c51c2b9a..e0aacecd652d 100644 --- a/Documentation/devicetree/bindings/nvmem/zii,rave-sp-eeprom.yaml +++ b/Documentation/devicetree/bindings/nvmem/zii,rave-sp-eeprom.yaml @@ -27,7 +27,7 @@ properties: $ref: /schemas/types.yaml#/definitions/string description: Unique EEPROM identifier describing its function in the - system. Will be used as created NVMEM deivce's name. + system. Will be used as created NVMEM device's name. required: - compatible diff --git a/Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml b/Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml index e863519f3161..b6801057e31e 100644 --- a/Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml @@ -160,7 +160,7 @@ examples: reg = <0x2800 0 0 0 0>; compatible = "pciclass,0604"; device_type = "pci"; - reset-gpios = <&gpio27 4 0 >; + reset-gpios = <&gpio27 4 0>; #address-cells = <3>; #size-cells = <2>; ranges; @@ -170,7 +170,7 @@ examples: reg = <0x03800 0 0 0 0>; compatible = "pciclass,0604"; device_type = "pci"; - reset-gpios = <&gpio25 2 0 >; + reset-gpios = <&gpio25 2 0>; #address-cells = <3>; #size-cells = <2>; ranges; diff --git a/Documentation/devicetree/bindings/pinctrl/sunplus,sp7021-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/sunplus,sp7021-pinctrl.yaml index 94b868c7ceb1..0084350ec579 100644 --- a/Documentation/devicetree/bindings/pinctrl/sunplus,sp7021-pinctrl.yaml +++ b/Documentation/devicetree/bindings/pinctrl/sunplus,sp7021-pinctrl.yaml @@ -339,7 +339,7 @@ examples: sdcard-pins { function = "SD_CARD"; groups = "SD_CARD"; - sunplus,pins = < SPPCTL_IOPAD(91, SPPCTL_PCTL_G_GPIO, 0, 0) >; + sunplus,pins = <SPPCTL_IOPAD(91, SPPCTL_PCTL_G_GPIO, 0, 0)>; }; hdmi_A_tx1-pins { diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt2701-g3dsys.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt2701-g3dsys.yaml new file mode 100644 index 000000000000..ad3df062d5db --- /dev/null +++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt2701-g3dsys.yaml @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/mediatek/mediatek,mt2701-g3dsys.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek G3D System Controller + +maintainers: + - Sean Wang <sean.wang@mediatek.com> + - Ryder Lee <ryder.lee@mediatek.com> + +description: | + The MediaTek G3D system controller provides clocks and reset control + for the GPU subsystem on MediaTek SoCs. + +properties: + compatible: + oneOf: + - items: + - const: mediatek,mt2701-g3dsys + - const: syscon + - items: + - const: mediatek,mt7623-g3dsys + - const: mediatek,mt2701-g3dsys + - const: syscon + + reg: + maxItems: 1 + + "#clock-cells": + const: 1 + + "#reset-cells": + const: 1 + +required: + - compatible + - reg + - "#clock-cells" + - "#reset-cells" + +additionalProperties: false + +examples: + - | + soc { + #address-cells = <2>; + #size-cells = <2>; + g3dsys: syscon@13000000 { + compatible = "mediatek,mt7623-g3dsys", + "mediatek,mt2701-g3dsys", + "syscon"; + reg = <0 0x13000000 0 0x200>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + }; diff --git a/Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml b/Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml index 80e542624cc6..ad830aebb798 100644 --- a/Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml +++ b/Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml @@ -62,21 +62,21 @@ examples: interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; flash@0 { - reg = < 0 >; + reg = <0>; compatible = "jedec,spi-nor"; spi-max-frequency = <50000000>; spi-rx-bus-width = <2>; }; flash@1 { - reg = < 1 >; + reg = <1>; compatible = "jedec,spi-nor"; spi-max-frequency = <50000000>; spi-rx-bus-width = <2>; }; flash@2 { - reg = < 2 >; + reg = <2>; compatible = "jedec,spi-nor"; spi-max-frequency = <50000000>; spi-rx-bus-width = <2>; diff --git a/Documentation/devicetree/bindings/thermal/thermal-idle.yaml b/Documentation/devicetree/bindings/thermal/thermal-idle.yaml index 1b77d542a7b8..6b4b16580adf 100644 --- a/Documentation/devicetree/bindings/thermal/thermal-idle.yaml +++ b/Documentation/devicetree/bindings/thermal/thermal-idle.yaml @@ -137,7 +137,7 @@ examples: cooling-maps { map0 { trip = <&cpu_alert1>; - cooling-device = <&cpu_b0_therm 0 15 >, + cooling-device = <&cpu_b0_therm 0 15>, <&cpu_b1_therm 0 15>; }; diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 94e63d8a58ad..b1bf52e85720 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -186,7 +186,7 @@ properties: - injoinic,ip5306 # Inspur Power System power supply unit version 1 - inspur,ipsps1 - # Intel common redudant power supply crps185 + # Intel common redundant power supply crps185 - intel,crps185 # Intersil ISL29028 Ambient Light and Proximity Sensor - isil,isl29028 @@ -414,6 +414,8 @@ properties: - samsung,24ad0xd1 # Samsung Exynos SoC SATA PHY I2C device - samsung,exynos-sataphy-i2c + # SDMC 1024bit EEPROM + 128bit OTP memory for key + - sdmc,dm2016 # Semtech sx1301 baseband processor - semtech,sx1301 # Sensirion multi-pixel gas sensor with I2C interface diff --git a/MAINTAINERS b/MAINTAINERS index d553900cdb00..5e813b0a7443 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20529,6 +20529,8 @@ F: Documentation/devicetree/ F: Documentation/process/maintainer-devicetree.rst F: arch/*/boot/dts/ F: include/dt-bindings/ +F: scripts/dtc/dt-check-style +F: scripts/dtc/dt-style-selftest/ OPENCOMPUTE PTP CLOCK DRIVER M: Vadim Fedorenko <vadim.fedorenko@linux.dev> diff --git a/drivers/of/property.c b/drivers/of/property.c index 72cf12907de0..abd0b2320779 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -74,7 +74,7 @@ bool of_graph_is_present(const struct device_node *node) struct device_node *port __free(device_node) = of_get_child_by_name(node, "port"); - return !!port; + return port; } EXPORT_SYMBOL(of_graph_is_present); @@ -1659,12 +1659,12 @@ static bool of_is_fwnode_add_links_supported(void) return true; if (is_supported != -1) - return !!is_supported; + return is_supported; is_supported = !((match_property_by_path("/soc", "compatible", "intel,ce4100-cp") >= 0) || (match_property_by_path("/", "architecture", "OLPC") >= 0)); - return !!is_supported; + return is_supported; } static int of_fwnode_add_links(struct fwnode_handle *fwnode) diff --git a/include/dt-bindings/clock/agilex-clock.h b/include/dt-bindings/clock/agilex-clock.h index 06feca07e08e..6206a45e007c 100644 --- a/include/dt-bindings/clock/agilex-clock.h +++ b/include/dt-bindings/clock/agilex-clock.h @@ -44,6 +44,7 @@ /* Gate clocks */ #define AGILEX_MPU_CLK 30 +/* Legacy ABI ID; do not use in new DTs, use AGILEX_MPU_CCU_CLK */ #define AGILEX_MPU_L2RAM_CLK 31 #define AGILEX_MPU_PERIPH_CLK 32 #define AGILEX_L4_MAIN_CLK 33 diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style index 96deffc0d8a7..0ebbe658b893 100755 --- a/scripts/dtc/dt-check-style +++ b/scripts/dtc/dt-check-style @@ -5,12 +5,14 @@ # .dts/.dtsi/.dtso source files. Enforces rules from # Documentation/devicetree/bindings/dts-coding-style.rst. # -# Two modes: +# Three modes: # --mode=relaxed (default) # Only rules that produce zero warnings on the current tree. # Suitable for dt_binding_check. # --mode=strict -# All rules. Required for new submissions. +# Most of the rules. Required for new submissions. +# --mode=stricter +# All rules, including ones having false positives. # # Two input types (auto-detected by file extension): # *.yaml -- DT binding; check each example block @@ -77,24 +79,27 @@ def is_preprocessor(stripped): class DtsLine: - __slots__ = ('lineno', 'raw', 'linetype', 'indent_str', 'stripped', + __slots__ = ('lineno', 'raw', 'code', 'linetype', 'indent_str', 'stripped', 'is_root', 'prop_name', 'continuations', - 'node_name', 'node_addr', 'label', 'ref_name', 'depth', + 'node_name', 'node_addr', 'label', 'ref_name', 'parent', 'depth', 'closures') - def __init__(self, lineno, raw, linetype, depth, indent_str, stripped): + def __init__(self, lineno, raw, linetype, depth, indent_str, stripped, is_root = False): self.lineno = lineno # 1-based within the block - self.raw = raw + self.raw = raw # Entire raw line self.linetype = linetype self.indent_str = indent_str # leading whitespace as-is self.depth = depth - self.stripped = stripped + self.stripped = stripped # Code without indentation + self.code = _strip_strings_and_comments(stripped) # Only the code, skipping trailing comments + self.is_root = is_root self.prop_name = None self.continuations = [] self.node_name = None self.node_addr = None self.label = None self.ref_name = None + self.parent = None # DtsLine of parent node self.closures = 1 # count of '}' on a NODE_CLOSE line @@ -228,7 +233,10 @@ def classify_lines(text): continue if code.endswith('{'): - dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code) + is_root = False + if re.search(r'&{/}\s*{', code) or re.search(r'^/\s*\{$', code): + is_root = True + dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code, is_root=is_root) parse_node_header(dl) out.append(dl) depth += 1 @@ -272,7 +280,7 @@ def parse_node_header(dl): def parse_property_name(dl): - m = re.match(r'^([a-zA-Z0-9#][a-zA-Z0-9,._+#-]*)\s*[=;]', dl.stripped) + m = re.match(r'^([a-zA-Z0-9#][a-zA-Z0-9,._+?#-]*)\s*[=;]', dl.stripped) if m: dl.prop_name = m.group(1) @@ -309,13 +317,13 @@ def collect_labels_and_refs(text): class Ctx: """Context passed to each rule check. Carries the parsed lines, - raw text, mode and kind.""" + raw text, mode and file_type.""" - def __init__(self, lines, text, mode, kind): + def __init__(self, lines, text, mode, file_type): self.lines = lines self.text = text - self.mode = mode # 'relaxed' or 'strict' - if kind in DTS_FAMILY: + self.mode = mode # 'relaxed', 'strict' or 'stricter' + if file_type in DTS_FAMILY: self.file_type = 'dts' else: self.file_type = 'yaml' @@ -327,7 +335,7 @@ class Rule: def __init__(self, name, mode, description, check, applies_to=('yaml', 'dts', 'dtsi', 'dtso')): self.name = name - self.mode = mode # 'relaxed' or 'strict' + self.mode = mode # 'relaxed', 'strict' or 'stricter' self.description = description self.check = check self.applies_to = applies_to # input types this rule covers @@ -335,52 +343,8 @@ class Rule: # --- individual rule check functions -------------------------------------- -def check_trailing_whitespace(ctx): - for dl in ctx.lines: - if dl.raw != dl.raw.rstrip(): - yield (dl.lineno, 'trailing whitespace') - - -def check_tab_in_yaml_example(ctx): - """Reject literal tabs in DTS lines when input is YAML. - - For YAML examples, indent and content must use spaces. Tabs inside - a #define value are tolerated (those are CPP macros, not DTS). - For .dts files, this rule does not apply -- tabs are required. - """ - if ctx.file_type != 'yaml': - return - for dl in ctx.lines: - if dl.linetype == LineType.PREPROCESSOR: - continue - if dl.linetype == LineType.BLANK: - continue - if '\t' in dl.raw: - yield (dl.lineno, 'tab character not allowed in DTS example') - -def check_mixed_indent_chars(ctx): - """Indent must be all-tabs, except for aligning indentation (comments - or continued lines).""" - for dl in ctx.lines: - if not dl.indent_str: - continue - if dl.linetype == LineType.PREPROCESSOR: - continue - if re.search(r' \t', dl.indent_str): - yield (dl.lineno, 'mixed tabs and spaces in indent') - if dl.indent_str.count(' ') > 7: - yield (dl.lineno, 'too many space characters in indent (more than 7)') - for cont in dl.continuations: - if not cont.indent_str: - continue - if cont.linetype == LineType.PREPROCESSOR: - continue - if re.search(r' \t', cont.indent_str): - yield (cont.lineno, 'mixed tabs and spaces in indent') - - -def detect_indent_unit(ctx): +def _detect_indent_unit(ctx): """Find the indent unit used at depth 1 in this block. Returns tuple of string (one of: ' ' (2 spaces), ' ' (4 spaces), @@ -406,64 +370,70 @@ def detect_indent_unit(ctx): return (None, None) -def check_indent_unit_relaxed(ctx): - """YAML examples: 2 or 4 spaces. Never tabs or other widths.""" - (unit, lineno) = detect_indent_unit(ctx) - if unit is None: - return - if unit not in (' ', ' '): - yield (lineno, 'indent unit must be 2 or 4 spaces, got %r' % unit) - +def _display_col(text): + """Visual column width of text, with tabs expanded to the next + 8-column stop, matching how printf and most editors render a + line and the kernel-wide line length convention.""" + col = 0 + for ch in text: + if ch == '\t': + col = (col // 8 + 1) * 8 + else: + col += 1 + return col -def check_indent_unit_dts(ctx): - """DTS files: 1 tab per level. Always required.""" - (unit, lineno) = detect_indent_unit(ctx) - if unit is None: - return - if unit != '\t': - yield (lineno, 'indent unit must be 1 tab in DTS, got %r' % unit) +def _natural_sort_key(s): + """Split a string into a tuple of (kind, value) pairs that compares + numeric runs as ints, so 'foo10' sorts after 'foo2'.""" + parts = [] + for part in re.split(r'(\d+)', s): + if part.isdigit(): + parts.append((0, int(part))) + else: + parts.append((1, part)) + return tuple(parts) -def check_indent_unit_strict(ctx): - """YAML: must be exactly 4 spaces. DTS: 1 tab (same as relaxed).""" - (unit, lineno) = detect_indent_unit(ctx) - if unit is None: - return - if ctx.file_type == 'yaml': - if unit != ' ': - yield (lineno, 'indent unit must be 4 spaces in strict mode, ' - 'got %r' % unit) +def _strip_strings_and_comments(text): + """Remove string literals and /* */ + // comments from a single + line, replacing them with empty strings. Used so syntactic checks + (whitespace, hex case, etc.) don't false-positive on contents of + quoted strings or comments. An unclosed /* on the line is treated + as a comment running to end of line.""" + text = re.sub(r'"(?:[^"\\]|\\.)*"', '""', text) + text = re.sub(r'/\*.*?\*/', '', text) + text = re.sub(r'/\*.*$', '', text) + text = re.sub(r'//.*$', '', text) + return text -def check_indent_consistent(ctx): - """All indented lines must be a multiple of the detected unit.""" - (unit, lineno) = detect_indent_unit(ctx) - if unit is None: - return - if ctx.file_type == 'yaml': - if unit not in (' ', ' '): - return # let check_indent_unit_* report this - else: - if unit != '\t': - return - for dl in ctx.lines: - if dl.linetype in (LineType.BLANK, LineType.PREPROCESSOR): - continue - if dl.linetype == LineType.CONTINUATION: - continue # continuations align to <, not to indent unit - if dl.linetype in (LineType.COMMENT_BODY, LineType.COMMENT_END): +def _walk_bodies(lines): + """Yield lists of immediate-child NODE_OPEN lines for each node body + in the input. Skips ref-nodes (&label) since those don't have an + intrinsic ordering.""" + # Array of stacked nodes (parent/child) + body_stack = [[]] + # Current stack of nodes, purely to track parent relationship for each node + node_stack = [] + parent_dl = None + for dl in lines: + if dl.linetype == LineType.NODE_OPEN: + dl.parent = parent_dl + node_stack.append(dl) + body_stack[-1].append(dl) + body_stack.append([]) + parent_dl = dl continue - if not dl.indent_str: + if dl.linetype == LineType.NODE_CLOSE: + if len(body_stack) <= 1: + # Unbalanced; ignore to avoid crashing on malformed input + continue + parent_dl = node_stack.pop().parent + yield body_stack.pop() continue - # The indent must be 'unit' repeated dl.depth times, exactly. - # NODE_CLOSE lines have depth equal to the post-decrement value, - # which matches the indent expected. - expected = unit * dl.depth - if dl.indent_str != expected: - yield (dl.lineno, - 'indent mismatch (expected depth %d * %r)' % - (dl.depth, unit)) + while body_stack: + yield body_stack.pop() def check_blank_lines(ctx): @@ -487,46 +457,20 @@ def check_blank_lines(ctx): yield (dl.lineno, 'blank line at end of node body') -def _walk_bodies(lines): - """Yield lists of immediate-child NODE_OPEN lines for each node body - in the input. Skips ref-nodes (&label) since those don't have an - intrinsic ordering.""" - body_stack = [[]] - for dl in lines: - if dl.linetype == LineType.NODE_OPEN: - body_stack[-1].append(dl) - body_stack.append([]) - continue - if dl.linetype == LineType.NODE_CLOSE: - if len(body_stack) <= 1: - # Unbalanced; ignore to avoid crashing on malformed input - continue - yield body_stack.pop() - continue - while body_stack: - yield body_stack.pop() - - -def _natural_sort_key(s): - """Split a string into a tuple of (kind, value) pairs that compares - numeric runs as ints, so 'foo10' sorts after 'foo2'.""" - parts = [] - for part in re.split(r'(\d+)', s): - if part.isdigit(): - parts.append((0, int(part))) - else: - parts.append((1, part)) - return tuple(parts) - - def check_child_address_order(ctx): """Addressed siblings (foo@N) must appear in ascending address - order within their parent node body.""" + order within their parent node body. + Exception: Top-level in DTS follows name order, regardless of unit address + in memory@N and soc@N nodes + """ for children in _walk_bodies(ctx.lines): addressed = [] for c in children: if c.node_addr is None: continue + if c.parent and c.parent.is_root: + # Top-level does not use unit address sorting usually + continue try: parts = tuple(int(p, 16) for p in c.node_addr.split(',')) except ValueError: @@ -544,12 +488,16 @@ def check_child_name_order(ctx): """Unaddressed siblings must appear in natural-sort order by node name within their parent node body. Addressed children are scoped by check_child_address_order; reference nodes (&label { ... }) and - the root node are skipped.""" + the root node are skipped. + However root node has children with and without unit address, and + sorting should be only by name.""" for children in _walk_bodies(ctx.lines): unaddressed = [] for c in children: if c.node_addr is not None: - continue + # Skip nodes with unit address, except when sorting top-level + if not c.parent or not c.parent.is_root: + continue if c.node_name in (None, '/'): continue if c.ref_name is not None: @@ -562,6 +510,199 @@ def check_child_name_order(ctx): 'child node %r out of name order' % dl.node_name) +def check_continuation_alignment(ctx): + """A multi-line property's continuation lines must align their + first non-whitespace character to the display column of: + 1. the first '<' or '"' after the '=' in the leading line, if continuation is with '<' or '"' + 2. the first value, if the continuation is still the same phandle. + Display columns are used so tab-indented .dts files (where a continuation + aligns with tabs plus spaces) are compared correctly.""" + for dl in ctx.lines: + if dl.linetype != LineType.PROPERTY: + continue + if not dl.continuations: + continue + eq = dl.raw.find('=') + if eq < 0: + continue + # First '<' or '"' after '=', but ignore comments and strip trailing + # whitespace (e.g. remaining after removing the comment) + rest = _strip_strings_and_comments(dl.raw[eq + 1:]).rstrip() + m = re.search(r'\s*([<"])', rest) + if not m: + continue + dl_value_complete = rest.endswith('",') or rest.endswith('>,') + target_col = _display_col(_strip_strings_and_comments(dl.raw[:eq + 1 + m.start(1)])) + for cont in dl.continuations: + target_offset = 0 + err_msg_explanation = 'to < or "' + if not dl_value_complete: + target_offset = 1 + err_msg_explanation = 'to the value under <' + if _display_col(cont.indent_str) != target_col + target_offset: + yield (cont.lineno, + 'continuation should align to column %d ' + '(%s)' % (target_col + target_offset + 1, err_msg_explanation)) + # Align to the value within <> or "" of continuation (so the previous line) + dl_value_complete = cont.stripped.endswith('",') or cont.stripped.endswith('>,') + + +def check_hex_case(ctx): + """Hex literals (0xN) must use lowercase digits and prefix.""" + for dl in ctx.lines: + if dl.linetype in (LineType.BLANK, LineType.COMMENT, + LineType.COMMENT_START, LineType.COMMENT_BODY, + LineType.COMMENT_END, LineType.PREPROCESSOR): + continue + for m in re.finditer(r'\b0[xX][0-9a-fA-F]+\b', dl.code): + lit = m.group(0) + if any(c.isupper() for c in lit[2:]) or lit[1] == 'X': + yield (dl.lineno, + 'hex literal %r must be lowercase' % lit) + + +def check_indent_consistent(ctx): + """All indented lines must be a multiple of the detected unit.""" + (unit, lineno) = _detect_indent_unit(ctx) + if unit is None: + return + if ctx.file_type == 'yaml': + if unit not in (' ', ' '): + return # let check_indent_unit_* report this + else: + if unit != '\t': + return + + for dl in ctx.lines: + if dl.linetype in (LineType.BLANK, LineType.PREPROCESSOR): + continue + if dl.linetype == LineType.CONTINUATION: + continue # continuations align to <, not to indent unit + if dl.linetype in (LineType.COMMENT_BODY, LineType.COMMENT_END): + continue + if not dl.indent_str: + continue + # The indent must be 'unit' repeated dl.depth times, exactly. + # NODE_CLOSE lines have depth equal to the post-decrement value, + # which matches the indent expected. + expected = unit * dl.depth + if dl.indent_str != expected: + yield (dl.lineno, + 'indent mismatch (expected depth %d * %r)' % + (dl.depth, unit)) + + +def check_indent_unit_dts(ctx): + """DTS files: 1 tab per level. Always required.""" + (unit, lineno) = _detect_indent_unit(ctx) + if unit is None: + return + if unit != '\t': + yield (lineno, 'indent unit must be 1 tab in DTS, got %r' % unit) + + +def check_indent_unit_relaxed(ctx): + """YAML examples: 2 or 4 spaces. Never tabs or other widths.""" + (unit, lineno) = _detect_indent_unit(ctx) + if unit is None: + return + if unit not in (' ', ' '): + yield (lineno, 'indent unit must be 2 or 4 spaces, got %r' % unit) + + +def check_indent_unit_strict(ctx): + """YAML: must be exactly 4 spaces. DTS: 1 tab (same as relaxed).""" + (unit, lineno) = _detect_indent_unit(ctx) + if unit is None: + return + if ctx.file_type == 'yaml': + if unit != ' ': + yield (lineno, 'indent unit must be 4 spaces in strict mode, ' + 'got %r' % unit) + + +def check_line_length(ctx): + """Lines must not exceed 80 columns; tabs count as 8 (see + _display_col).""" + for dl in ctx.lines: + if dl.linetype == LineType.BLANK: + continue + cols = _display_col(dl.raw) + if cols > 80: + yield (dl.lineno, + 'line exceeds 80 columns (%d)' % cols) + + +def check_mixed_indent_chars(ctx): + """Indent must be all-tabs, except for aligning indentation (comments + or continued lines).""" + for dl in ctx.lines: + if not dl.indent_str: + continue + if dl.linetype == LineType.PREPROCESSOR: + continue + if re.search(r' \t', dl.indent_str): + yield (dl.lineno, 'mixed tabs and spaces in indent') + if dl.indent_str.count(' ') > 7: + yield (dl.lineno, 'too many space characters in indent (more than 7)') + for cont in dl.continuations: + if not cont.indent_str: + continue + if cont.linetype == LineType.PREPROCESSOR: + continue + if re.search(r' \t', cont.indent_str): + yield (cont.lineno, 'mixed tabs and spaces in indent') + if cont.indent_str.count(' ') > 7: + yield (cont.lineno, 'too many space characters in indent (more than 7)') + + +def check_node_close_alone(ctx): + """The closing '};' of a node must be on its own line. The + classifier accepts a canonical "}" or "};" as NODE_CLOSE; a line + that is all closures (e.g. "}; };") is still NODE_CLOSE for depth + tracking but is flagged here via dl.closures. Any other line that + still contains '};' (in code, not in strings or comments) is + mixing a node close with something else.""" + for dl in ctx.lines: + if dl.linetype == LineType.NODE_CLOSE: + if dl.closures > 1: + yield (dl.lineno, + 'closing brace must be on its own line') + continue + if dl.linetype in (LineType.BLANK, LineType.COMMENT, + LineType.COMMENT_START, LineType.COMMENT_BODY, + LineType.COMMENT_END, LineType.PREPROCESSOR): + continue + if '};' in dl.code: + yield (dl.lineno, + 'closing brace must be on its own line') + + +def check_node_name(ctx): + """Only recommended characters are used in node names.""" + for dl in ctx.lines: + if not dl.node_name in (None, '/'): + if not re.match(r'[0-9a-z][0-9a-z-]*(?<!-)$', dl.node_name): + yield (dl.lineno, f'node name "{dl.node_name}" is using discouraged style') + + +def check_property_name(ctx): + """Only recommended characters are used in property names.""" + for dl in ctx.lines: + if dl.prop_name: + exceptions = ['cpu_off', 'cpu_on', 'cpu_suspend', + 'device_type', 'dr_mode', + 'mmc-hs200-1_2v', 'mmc-hs200-1_8v', 'mmc-hs400-1_2v', 'mmc-hs400-1_8v', + 'opp-avg-kBps', 'opp-peak-kBps', 'phy_type'] + + if re.match(r'\#([0-9a-z][0-9a-z-]*(?<!-),)?[a-z-]+-cells$', dl.prop_name): + continue + if dl.prop_name in exceptions: + continue + if not re.match(r'([0-9a-z][0-9a-z-]*(?<!-),)?[0-9a-z][0-9a-z-]*(?<!-)$', dl.prop_name): + yield (dl.lineno, f'property name "{dl.prop_name}" is using discouraged style') + + def _property_bucket(name): """Return the canonical bucket index for a property: 0 device_type @@ -591,6 +732,30 @@ def _property_bucket(name): return (5 if ',' in stripped else 4, None) +def _property_bucket_root(name): + """Return the canonical bucket index for a property: + 0 model (for root nodes only) + 1 compatible + Plus a sub-key inside the bucket for fixed slots (device_type, compatible, + reg, reg-names, ranges, status). 'standard' and 'vendor' return None for + the sub-key, signalling that the within-bucket key is computed by + the pairing rules.""" + stripped = name.lstrip('#') + if name == 'model': + return (0, 0) + if name == 'compatible': + return (1, 0) + if name == 'reg': + return (2, 0) + if name == 'reg-names': + return (2, 1) + if name == 'ranges': + return (3, 0) + if name == 'status': + return (6, 0) + return (5 if ',' in stripped else 4, None) + + # Declarative pairing rules: each is a callable # (name, all_names) -> anchor_name_or_None # If a rule returns an anchor, the property sorts immediately after the @@ -627,13 +792,16 @@ def _pair_x_names(name, all_names): PAIRING_RULES = (_pair_pinctrl_names, _pair_x_names) -def _property_sort_key(name, all_names): +def _property_sort_key(dl, name, all_names): """Sort key for a property among its node-body siblings. Format: (bucket, within_key, tiebreak). 'within_key' for standard/vendor buckets follows pairing rules: a property paired with anchor X sorts as if it were X with a higher tiebreak.""" - bucket, fixed_sub = _property_bucket(name) + if dl.is_root: + bucket, fixed_sub = _property_bucket_root(name) + else: + bucket, fixed_sub = _property_bucket(name) if fixed_sub is not None: return (bucket, (), fixed_sub) @@ -668,7 +836,7 @@ def check_property_order(ctx): if len(props) < 2: continue all_names = [p.prop_name for p in props] - keyed = [(p, _property_sort_key(p.prop_name, all_names)) + keyed = [(p, _property_sort_key(dl, p.prop_name, all_names)) for p in props] for k in range(1, len(keyed)): if keyed[k][1] < keyed[k - 1][1]: @@ -680,17 +848,40 @@ def check_property_order(ctx): (p.prop_name, prev.prop_name)) -def _strip_strings_and_comments(text): - """Remove string literals and /* */ + // comments from a single - line, replacing them with empty strings. Used so syntactic checks - (whitespace, hex case, etc.) don't false-positive on contents of - quoted strings or comments. An unclosed /* on the line is treated - as a comment running to end of line.""" - text = re.sub(r'"(?:[^"\\]|\\.)*"', '""', text) - text = re.sub(r'/\*.*?\*/', '', text) - text = re.sub(r'/\*.*$', '', text) - text = re.sub(r'//.*$', '', text) - return text +def _check_redundant_whitespace(dl): + if dl.linetype in (LineType.COMMENT, LineType.COMMENT_BODY, + LineType.COMMENT_END, LineType.COMMENT_START, + LineType.PREPROCESSOR): + return + if re.search(r'(\s\s+|\t)\{', dl.code): + yield (dl.lineno, 'extra whitespace before {') + if re.search(r':(\s\s+|\t)', dl.code): + yield (dl.lineno, 'extra whitespace after :') + if re.search(r'\s+;', dl.code): + yield (dl.lineno, 'extra whitespace before ;') + + +def check_redundant_whitespace(ctx): + """No whitespace between brackets or other code elements. + See also check_value_whitespace() for more checks.""" + for dl in ctx.lines: + yield from _check_redundant_whitespace(dl) + for cont in dl.continuations: + yield from _check_redundant_whitespace(cont) + + +def check_redundant_whitespace_strict(ctx): + """No whitespace between brackets or other code elements. + See also check_value_whitespace() for more checks.""" + for dl in ctx.lines: + if dl.linetype in (LineType.COMMENT, LineType.COMMENT_BODY, + LineType.COMMENT_END, LineType.COMMENT_START, + LineType.PREPROCESSOR): + continue + if re.search(r'(\s\s+|\t)=', dl.code): + yield (dl.lineno, 'extra whitespace before =') + if re.search(r'=(\s\s+|\t)', dl.code): + yield (dl.lineno, 'extra whitespace after =') def check_required_blank_lines(ctx): @@ -752,19 +943,52 @@ def check_required_blank_lines(ctx): between_blanks = 0 -def check_hex_case(ctx): - """Hex literals (0xN) must use lowercase digits and prefix.""" +def check_tab_in_yaml_example(ctx): + """Reject literal tabs in DTS lines when input is YAML. + + For YAML examples, indent and content must use spaces. Tabs inside + a #define value are tolerated (those are CPP macros, not DTS). + For .dts files, this rule does not apply -- tabs are required. + """ + if ctx.file_type != 'yaml': + return for dl in ctx.lines: - if dl.linetype in (LineType.BLANK, LineType.COMMENT, - LineType.COMMENT_START, LineType.COMMENT_BODY, - LineType.COMMENT_END, LineType.PREPROCESSOR): + if dl.linetype == LineType.PREPROCESSOR: continue - text = _strip_strings_and_comments(dl.raw) - for m in re.finditer(r'\b0[xX][0-9a-fA-F]+\b', text): - lit = m.group(0) - if any(c.isupper() for c in lit[2:]) or lit[1] == 'X': - yield (dl.lineno, - 'hex literal %r must be lowercase' % lit) + if dl.linetype == LineType.BLANK: + continue + if '\t' in dl.raw: + yield (dl.lineno, 'tab character not allowed in DTS example') + for cont in dl.continuations: + if '\t' in cont.raw: + yield (cont.lineno, 'tab character not allowed in DTS example') + + +def check_trailing_whitespace(ctx): + for dl in ctx.lines: + if dl.raw != dl.raw.rstrip(): + yield (dl.lineno, 'trailing whitespace') + + +def check_unclosed_block_comment(ctx): + """Every /* must have a matching */ in the same block. Catches both + a comment opened on its own line (COMMENT_START) and a tail comment + opened on a PROPERTY or other code line (where in_block_comment is + set by _split_code so the next line becomes COMMENT_BODY without a + preceding COMMENT_START).""" + open_lineno = None + for dl in ctx.lines: + if dl.linetype == LineType.COMMENT_START: + open_lineno = dl.lineno + elif dl.linetype == LineType.COMMENT_END: + open_lineno = None + elif dl.linetype == LineType.COMMENT_BODY and open_lineno is None: + # Block was opened by a /* tail on a code line; report at + # the first orphan body line since the originating line is + # already classified as something else. + open_lineno = dl.lineno + if open_lineno is not None: + yield (open_lineno, 'unclosed /* block comment') def check_unit_address_format(ctx): @@ -798,6 +1022,17 @@ def check_unit_address_format(ctx): break +def check_unused_labels(ctx): + """Labels defined but never referenced are clutter.""" + defined, referenced = collect_labels_and_refs(ctx.text) + for label in sorted(defined - referenced): + # Find the line where this label is defined for line-number + # reporting. + m = re.search(r'(?m)^.*\b' + re.escape(label) + r'\s*:', ctx.text) + lineno = ctx.text[:m.start()].count('\n') + 1 if m else 1 + yield (lineno, 'label %r defined but never &-referenced' % label) + + def check_value_whitespace(ctx): """A <...> cell list must have no whitespace directly after '<' or directly before '>'. Continuation lines are joined onto the @@ -808,9 +1043,9 @@ def check_value_whitespace(ctx): for dl in ctx.lines: if dl.linetype != LineType.PROPERTY: continue - segs = [_strip_strings_and_comments(dl.raw).strip()] + segs = [dl.code.strip()] for cont in dl.continuations: - segs.append(_strip_strings_and_comments(cont.stripped).strip()) + segs.append(cont.code.strip()) text = '' for s in segs: if not s: @@ -826,131 +1061,13 @@ def check_value_whitespace(ctx): break -def check_node_close_alone(ctx): - """The closing '};' of a node must be on its own line. The - classifier accepts a canonical "}" or "};" as NODE_CLOSE; a line - that is all closures (e.g. "}; };") is still NODE_CLOSE for depth - tracking but is flagged here via dl.closures. Any other line that - still contains '};' (in code, not in strings or comments) is - mixing a node close with something else.""" - for dl in ctx.lines: - if dl.linetype == LineType.NODE_CLOSE: - if dl.closures > 1: - yield (dl.lineno, - 'closing brace must be on its own line') - continue - if dl.linetype in (LineType.BLANK, LineType.COMMENT, - LineType.COMMENT_START, LineType.COMMENT_BODY, - LineType.COMMENT_END, LineType.PREPROCESSOR): - continue - text = _strip_strings_and_comments(dl.raw) - if '};' in text: - yield (dl.lineno, - 'closing brace must be on its own line') - - -def _display_col(text): - """Visual column width of text, with tabs expanded to the next - 8-column stop, matching how printf and most editors render a - line and the kernel-wide line length convention.""" - col = 0 - for ch in text: - if ch == '\t': - col = (col // 8 + 1) * 8 - else: - col += 1 - return col - - -def check_line_length(ctx): - """Lines must not exceed 80 columns; tabs count as 8 (see - _display_col).""" - for dl in ctx.lines: - if dl.linetype == LineType.BLANK: - continue - cols = _display_col(dl.raw) - if cols > 80: - yield (dl.lineno, - 'line exceeds 80 columns (%d)' % cols) - - -def check_continuation_alignment(ctx): - """A multi-line property's continuation lines must align their - first non-whitespace character to the display column of the first - '<' or '"' after the '=' in the leading line. Display columns are - used so tab-indented .dts files (where a continuation aligns with - tabs plus spaces) are compared correctly.""" - for dl in ctx.lines: - if dl.linetype != LineType.PROPERTY: - continue - if not dl.continuations: - continue - eq = dl.raw.find('=') - if eq < 0: - continue - # First '<' or '"' after '=' - rest = dl.raw[eq + 1:] - m = re.search(r'[<"]', rest) - if not m: - continue - target_col = _display_col(dl.raw[:eq + 1 + m.start()]) - for cont in dl.continuations: - if _display_col(cont.indent_str) != target_col: - yield (cont.lineno, - 'continuation should align to column %d ' - '(under "<" or \\")' % (target_col + 1)) - - -def check_unclosed_block_comment(ctx): - """Every /* must have a matching */ in the same block. Catches both - a comment opened on its own line (COMMENT_START) and a tail comment - opened on a PROPERTY or other code line (where in_block_comment is - set by _split_code so the next line becomes COMMENT_BODY without a - preceding COMMENT_START).""" - open_lineno = None - for dl in ctx.lines: - if dl.linetype == LineType.COMMENT_START: - open_lineno = dl.lineno - elif dl.linetype == LineType.COMMENT_END: - open_lineno = None - elif dl.linetype == LineType.COMMENT_BODY and open_lineno is None: - # Block was opened by a /* tail on a code line; report at - # the first orphan body line since the originating line is - # already classified as something else. - open_lineno = dl.lineno - if open_lineno is not None: - yield (open_lineno, 'unclosed /* block comment') - - -def check_unused_labels(ctx): - """Labels defined but never referenced are clutter.""" - defined, referenced = collect_labels_and_refs(ctx.text) - for label in sorted(defined - referenced): - # Find the line where this label is defined for line-number - # reporting. - m = re.search(r'(?m)^.*\b' + re.escape(label) + r'\s*:', ctx.text) - lineno = ctx.text[:m.start()].count('\n') + 1 if m else 1 - yield (lineno, 'label %r defined but never &-referenced' % label) - - # --- registry -------------------------------------------------------------- RULES = [ # 'relaxed' is the default; rules in this group must produce zero # output on a clean kernel tree (post the small prep-cleanup # commit at the head of this series). - Rule('trailing-whitespace', 'relaxed', - 'no trailing whitespace on any line', - check_trailing_whitespace), - Rule('tab-in-yaml', 'relaxed', - 'YAML (also DTS examples) may not contain tab characters', - check_tab_in_yaml_example, applies_to=('yaml',)), - Rule('mixed-indent-chars', 'relaxed', - 'indent must not mix tabs and spaces', - check_mixed_indent_chars, applies_to=('dts', 'dtsi', 'dtso')), - Rule('unclosed-block-comment', 'relaxed', - 'every /* block comment must close with */', - check_unclosed_block_comment), + # Rules are sorted here by group (relaxed, strict, stricter) and name # DTS files always use tabs; this is not negotiable per kernel # coding style (.dts files are real source). Relaxed mode. @@ -958,19 +1075,26 @@ RULES = [ 'DTS files: 1 tab per nesting level', check_indent_unit_dts, applies_to=('dts', 'dtsi', 'dtso')), + Rule('mixed-indent-chars', 'relaxed', + 'indent must not mix tabs and spaces', + check_mixed_indent_chars, applies_to=('dts', 'dtsi', 'dtso')), + # See also check_redundant_whitespace_strict() and check_value_whitespace() + Rule('redundant-whitespace', 'relaxed', + 'no redundant whitespace within code', + check_redundant_whitespace), + Rule('tab-in-yaml', 'relaxed', + 'YAML (also DTS examples) may not contain tab characters', + check_tab_in_yaml_example, applies_to=('yaml',)), + Rule('trailing-whitespace', 'relaxed', + 'no trailing whitespace on any line', + check_trailing_whitespace), + Rule('unclosed-block-comment', 'relaxed', + 'every /* block comment must close with */', + check_unclosed_block_comment), # 'strict' rules are opt-in (e.g. for new submissions via # checkpatch.pl in a follow-up series). They flag many existing # files and can be promoted to relaxed once those are cleaned up. - Rule('indent-unit', 'strict', - 'YAML: 2 or 4 spaces per level', - check_indent_unit_relaxed, applies_to=('yaml',)), - Rule('indent-unit-strict', 'strict', - 'YAML: must be 4 spaces per level', - check_indent_unit_strict, applies_to=('yaml',)), - Rule('indent-consistent', 'strict', - 'every line indented at depth * unit', - check_indent_consistent), Rule('blank-lines', 'strict', 'no consecutive blanks; no blanks at node body edges', check_blank_lines), @@ -980,45 +1104,71 @@ RULES = [ Rule('child-name-order', 'strict', 'unaddressed siblings must be in natural-sort name order', check_child_name_order), + Rule('continuation-alignment', 'strict', + 'multi-line property continuations align under <, " or the value under <', + check_continuation_alignment), + Rule('hex-case', 'strict', + 'hex literals must be lowercase', + check_hex_case), + Rule('indent-consistent', 'strict', + 'every line indented at depth * unit', + check_indent_consistent), + Rule('indent-unit', 'strict', + 'YAML: 2 or 4 spaces per level', + check_indent_unit_relaxed, applies_to=('yaml',)), + Rule('indent-unit-strict', 'strict', + 'YAML: must be 4 spaces per level', + check_indent_unit_strict, applies_to=('yaml',)), + Rule('line-length', 'strict', + 'lines must not exceed 80 columns', + check_line_length, applies_to=('yaml',)), + Rule('line-length-dts', 'stricter', + 'lines must not exceed 80 columns', + check_line_length, applies_to=('dts', 'dtsi', 'dtso')), + Rule('node-close-alone', 'strict', + 'closing brace must be on its own line', + check_node_close_alone), + Rule('node-name', 'strict', + 'node names use only recommended characters (see DTS Coding Style)', + check_node_name), + Rule('property-name', 'strict', + 'property names use only recommended characters (see DTS Coding Style)', + check_property_name), Rule('property-order', 'strict', 'canonical bucket + pairing + natural-sort order of properties', check_property_order), + # See also check_redundant_whitespace() and check_value_whitespace() + Rule('redundant-whitespace-strict', 'strict', + 'no redundant whitespace within code', + check_redundant_whitespace_strict), Rule('required-blank-lines', 'strict', 'blank line before child nodes and before "status"', check_required_blank_lines), - Rule('hex-case', 'strict', - 'hex literals must be lowercase', - check_hex_case), Rule('unit-address-format', 'strict', 'unit addresses must be lowercase hex without leading zeros', check_unit_address_format), - Rule('value-whitespace', 'strict', - 'no whitespace directly inside <...> brackets', - check_value_whitespace), - Rule('node-close-alone', 'strict', - 'closing brace must be on its own line', - check_node_close_alone), - Rule('line-length', 'strict', - 'lines must not exceed 80 columns', - check_line_length), - Rule('continuation-alignment', 'strict', - 'multi-line property continuations align under "<" or "\\""', - check_continuation_alignment), Rule('unused-labels', 'strict', 'every label must be &-referenced in the same example/file ' '(skipped for .dtsi/.dtso since labels there are exported)', - check_unused_labels, applies_to=('yaml', 'dts')), + check_unused_labels, applies_to=('yaml',)), + Rule('unused-labels-dts', 'stricter', + 'every label must be &-referenced in the same example/file ' + '(skipped for .dtsi/.dtso since labels there are exported)', + check_unused_labels, applies_to=('dts',)), + Rule('value-whitespace', 'strict', + 'no whitespace directly inside <...> brackets', + check_value_whitespace), ] -def select_rules(mode, input_kind): +def select_rules(mode, file_type): """Return rules that apply to the given mode and input type.""" - rank = {'relaxed': 0, 'strict': 1} + rank = {'relaxed': 0, 'strict': 1, 'stricter': 2} out = [] for r in RULES: if rank[r.mode] > rank[mode]: continue - if input_kind not in r.applies_to: + if file_type not in r.applies_to: continue out.append(r) return out @@ -1028,12 +1178,12 @@ def select_rules(mode, input_kind): # Block runner # --------------------------------------------------------------------------- -def check_block(text, mode, input_type): +def check_block(text, mode, file_type): """Run all selected rules on a single block of DTS text. Returns a list of (lineno, rule_name, message) tuples.""" lines = classify_lines(text) - ctx = Ctx(lines, text, mode, input_type) - rules = select_rules(mode, input_type) + ctx = Ctx(lines, text, mode, file_type) + rules = select_rules(mode, file_type) findings = [] for r in rules: for lineno, msg in r.check(ctx): @@ -1090,7 +1240,7 @@ def iter_dts_file(filepath): # Top-level processing # --------------------------------------------------------------------------- -def input_kind(filepath): +def get_file_type(filepath): p = filepath.lower() if p.endswith('.yaml') or p.endswith('.yml'): return 'yaml' @@ -1110,17 +1260,17 @@ DTS_FAMILY = ('dts', 'dtsi', 'dtso') def collect_findings(filepath, mode): """Return a (lines, count) pair for filepath. lines is a list of formatted output strings; count is the number of findings.""" - kind = input_kind(filepath) - if kind == 'yaml': + file_type = get_file_type(filepath) + if file_type == 'yaml': iterator = iter_yaml_examples(filepath) - elif kind in DTS_FAMILY: + elif file_type in DTS_FAMILY: iterator = iter_dts_file(filepath) else: return (['%s: unknown file type, skipping' % filepath], 0) out = [] for text, base, idx in iterator: - for lineno, rule, msg in check_block(text, mode, kind): + for lineno, rule, msg in check_block(text, mode, file_type): abs_line = base + lineno - 1 ex_tag = '' if idx is None else ' example %d' % idx out.append('%s:%d:%s [%s] %s' % @@ -1141,7 +1291,7 @@ def main(): description='Check DTS coding style on YAML examples and ' '.dts/.dtsi/.dtso files.', fromfile_prefix_chars='@') - ap.add_argument('--mode', choices=('relaxed', 'strict'), + ap.add_argument('--mode', choices=('relaxed', 'strict', 'stricter'), default='relaxed', help='which rule set to apply (default: relaxed)') ap.add_argument('-j', '--jobs', type=int, default=0, diff --git a/scripts/dtc/dt-style-selftest/bad/dts-child-name-order.dtso b/scripts/dtc/dt-style-selftest/bad/dts-child-name-order.dtso new file mode 100644 index 000000000000..74b49be69e98 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-child-name-order.dtso @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + #address-cells = <1>; + #size-cells = <1>; + + pmu { + compatible = "example,pmu"; + + /* Include labels to be sure they do not affect sorting */ + foo: foo { + label = "foo"; + }; + + label_bar: bar { + label = "bar"; + }; + }; + + memory@a0000000 { + device_type = "memory"; + reg = <0x0 0xa0000000 0x0 0x0>; + }; + + pmu-2 { + compatible = "example,pmu"; + + /* Just reference labels to avoid strict warnings */ + example,foo = <&foo>, <&label_bar>; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-cont-align.dts b/scripts/dtc/dt-style-selftest/bad/dts-cont-align.dts new file mode 100644 index 000000000000..5390ebbf4059 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-cont-align.dts @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; + +/ { + compatible = "example,test-board"; + #address-cells = <1>; + #size-cells = <1>; + + interrupt-controller@10000 { + compatible = "example,intc"; + reg = <0x10000 0x1000>; + clocks = <1 2 3>, /* comments with " < , should not matter */ + <4 5 6>, + <7 8 9>; + interrupts = <1 2 3>, /* comments with " < , should not ... */ + <4 5 6>, + <7 8 9>; + pinmux = <0x01 + 0x02>, + <0x03 + 0x04>; + power-domain-names = "foo", + "bar", /* comments with " < , should not */ + "baz"; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dts b/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dts new file mode 100644 index 000000000000..74c956398324 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dts @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + memory@a0000000 { + device_type = "memory"; + reg = <0x0 0xa0000000 0x0 0x0>; + }; + + pmu { + compatible = "example,pmu"; + }; + + soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + + serial@20000 { + compatible = "example,serial"; + reg = <0x20000 0x1000>; + }; + + interrupt-controller@10000 { + compatible = "example,intc"; + reg = <0x10000 0x1000>; + interrupts = <1 2 3>; + }; + + serial@30000 { + compatible = "example,serial"; + reg = <0x30000 0x1000>; + }; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dtso b/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dtso new file mode 100644 index 000000000000..052c02935a45 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dtso @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + #address-cells = <1>; + #size-cells = <1>; + + memory@a0000000 { + device_type = "memory"; + reg = <0x0 0xa0000000 0x0 0x0>; + }; + + pmu { + compatible = "example,pmu"; + }; + + soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + + serial@20000 { + compatible = "example,serial"; + reg = <0x20000 0x1000>; + }; + + interrupt-controller@10000 { + compatible = "example,intc"; + reg = <0x10000 0x1000>; + interrupts = <1 2 3>; + }; + + serial@30000 { + compatible = "example,serial"; + reg = <0x30000 0x1000>; + }; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-extend-node-child-name-order.dtso b/scripts/dtc/dt-style-selftest/bad/dts-extend-node-child-name-order.dtso new file mode 100644 index 000000000000..d9cf670f19f6 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-extend-node-child-name-order.dtso @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + #address-cells = <1>; + #size-cells = <1>; + + pmu { + compatible = "example,pmu"; + + /* Just reference labels to avoid strict warnings */ + example,foo = <&foo>, <&label_bar>; + }; +}; + +&pmu { + /* Include labels to be sure they do not affect sorting */ + foo: foo { + label = "foo"; + }; + + label_bar: bar { + label = "bar"; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-extend-node-digit-node-order.dtso b/scripts/dtc/dt-style-selftest/bad/dts-extend-node-digit-node-order.dtso new file mode 100644 index 000000000000..4b2cf60e5a92 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-extend-node-digit-node-order.dtso @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + #address-cells = <1>; + #size-cells = <1>; + + soc: soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + }; +}; + +&soc { + serial@20000 { + compatible = "example,serial"; + reg = <0x20000 0x1000>; + }; + + interrupt-controller@10000 { + compatible = "example,intc"; + reg = <0x10000 0x1000>; + interrupts = <1 2 3>; + }; + + serial@30000 { + compatible = "example,serial"; + reg = <0x30000 0x1000>; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts b/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts new file mode 100644 index 000000000000..bde91a922477 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/* + * Test fixture: Line length in DTS + */ + +/dts-v1/; + +/ { + soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + + foo@1000 { + compatible = "example,test-line-length-this-is-a-very-long-name-indeed-yeah"; + reg = <0x1000 0x100>; + }; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-node-name.dts b/scripts/dtc/dt-style-selftest/bad/dts-node-name.dts new file mode 100644 index 000000000000..b897cbd74dd6 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-node-name.dts @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + foo_bar { + compatible = "example,test-node-name"; + }; + + foo,bar { + compatible = "example,test-node-name"; + }; + + foo.bar { + compatible = "example,test-node-name"; + }; + + foo+bar { + compatible = "example,test-node-name"; + }; + + foo-bar- { + compatible = "example,test-node-name"; + }; + + soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + + foo_bar@1000 { + compatible = "example,test-node-name"; + reg = <0x1000 0x100>; + }; + + foo,bar@2000 { + compatible = "example,test-node-name"; + reg = <0x2000 0x100>; + }; + + foo.bar@3000 { + compatible = "example,test-node-name"; + reg = <0x3000 0x100>; + }; + + foo+bar@4000 { + compatible = "example,test-node-name"; + reg = <0x4000 0x100>; + }; + + foo-bar-@5000 { + compatible = "example,test-node-name"; + reg = <0x5000 0x100>; + }; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-property-name.dts b/scripts/dtc/dt-style-selftest/bad/dts-property-name.dts new file mode 100644 index 000000000000..110e33a524dd --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-property-name.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + foo { + compatible = "example,test-property-name"; + + property#foo; + property+foo; + property-foo; + property-foo-; + property.foo; + property?foo; + property_foo; + + vendor,property#foo; + vendor,property+foo; + vendor,property,foo; + vendor,property-foo; + vendor,property-foo-; + vendor,property.foo; + vendor,property?foo; + vendor,property_foo; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-property-order.dts b/scripts/dtc/dt-style-selftest/bad/dts-property-order.dts index f31abb6ceae4..ebe561e38766 100644 --- a/scripts/dtc/dt-style-selftest/bad/dts-property-order.dts +++ b/scripts/dtc/dt-style-selftest/bad/dts-property-order.dts @@ -6,6 +6,11 @@ /dts-v1/; / { + compatible = "example,test-board", "example,test-soc"; + model = "DT style selftest"; + qcom,board-id = <8 0>; + chassis-type = "handset"; + cpus { #address-cells = <1>; #size-cells = <0>; @@ -41,3 +46,13 @@ }; }; }; + +/ { + compatible = "example,test-board", "example,test-soc"; + model = "DT style selftest"; +}; + +/{ + compatible = "example,test-board", "example,test-soc"; + model = "DT style selftest"; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-property-order.dtso b/scripts/dtc/dt-style-selftest/bad/dts-property-order.dtso new file mode 100644 index 000000000000..64604fa6b8c3 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-property-order.dtso @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/* + * Test fixture: Incorrect property order + */ + +/dts-v1/; +/plugin/; + +&{/} { + compatible = "example,test-board", "example,test-soc"; + model = "DT style selftest"; + qcom,board-id = <8 0>; + chassis-type = "handset"; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + reg = <0x0 0x0>; + compatible = "arm,cortex-a57"; + device_type = "cpu"; + enable-method = "psci"; + }; + }; + + pmu { + compatible = "example,pmu"; + + status = "disabled"; + dma-coherent; + }; + + soc@0 { + ranges = <0 0 0 0xc0000000>; + compatible = "simple-bus"; + + #address-cells = <1>; + #size-cells = <1>; + + interrupt-controller@10000 { + reg = <0x10000 0x1000>; + interrupts = <1 2 3>, + <4 5 6>, + <7 8 9>; + compatible = "example,intc"; + }; + }; +}; + +&{/} { + compatible = "example,test-board", "example,test-soc"; + model = "DT style selftest"; +}; + +&{/}{ + compatible = "example,test-board", "example,test-soc"; + model = "DT style selftest"; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws-strict.dts b/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws-strict.dts new file mode 100644 index 000000000000..201e3940ba1c --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws-strict.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; + +#define SOME_MACRO(foo) \ + (foo) ? <1> : <2> ; + +/ { + compatible = "example,test-board"; + #address-cells = <1>; + #size-cells = <1>; + + /* comments { are okay = though ; */ + soc: soc@0 { /* comments { are okay = though ; */ + compatible = "simple-bus"; /* comments { are okay = though ; */ + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + } ; +}; /* comments { are okay = though ; */ + +&soc { + serial: serial@20000 { /* comments { are okay = though ; */ + compatible = "example,serial"; + reg = <0x20000 0x1000>; + } ; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws.dts b/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws.dts new file mode 100644 index 000000000000..f6480ddc508a --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; + +#define SOME_MACRO(foo) \ + (foo) ? <1> : <2> ; + +/ { + compatible = "example,test-board"; + #address-cells = <1>; + #size-cells = <1>; + + /* comments { are okay = though ; */ + soc: soc@0 { /* comments { are okay = though ; */ + compatible = "simple-bus"; /* comments { are okay = though ; */ + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + } ; +}; /* comments { are okay = though ; */ + +&soc { + serial: serial@20000 { /* comments { are okay = though ; */ + compatible = "example,serial"; + reg = <0x20000 0x1000>, + <0x30000 0x1000> ; + } ; /* comments { are okay = though ; */ +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws.dtso b/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws.dtso new file mode 100644 index 000000000000..01d94e14071a --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-redundant-ws.dtso @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + compatible = "example,test-board"; + #address-cells = <1>; + #size-cells = <1>; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-trailing-ws.dts b/scripts/dtc/dt-style-selftest/bad/dts-trailing-ws.dts new file mode 100644 index 000000000000..1eb24d91c640 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-trailing-ws.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; + +/ { + compatible = "example,test-board"; + #address-cells = <1>; + #size-cells = <1>; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/dts-unused-label.dts b/scripts/dtc/dt-style-selftest/bad/dts-unused-label.dts new file mode 100644 index 000000000000..90802ae107e1 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/dts-unused-label.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/* + * Test fixture: Unused label in DTS + */ + +/dts-v1/; + +/ { + soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + + dev: device@1000 { + compatible = "example,test-unused-label"; + reg = <0x1000 0x100>; + }; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-child-addr-order.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-child-addr-order.yaml index 3df56e69a1ff..7c3b731e059a 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-child-addr-order.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-child-addr-order.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with addressed children out of order maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-child-name-order.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-child-name-order.yaml index 35d85e5573c2..f3483033859a 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-child-name-order.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-child-name-order.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with unaddressed children out of name order maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml index 92778540b056..a5a9eb17fc17 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with mis-aligned multi-line property maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: @@ -25,6 +25,8 @@ examples: - | foo@1000 { compatible = "example,test-cont-align"; - reg = <0x1000 0x100>, - <0x2000 0x100>; + reg = <0x1000 0x100>, /* comments with " < , should not matter */ + <0x2000 0x100>, /* comments with " < , should not matter */ + <0x3000 + 0x100>; }; diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-digit-node-order.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-digit-node-order.yaml index 44a9d25e5ba0..068542a98576 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-digit-node-order.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-digit-node-order.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with digit-leading nodes out of address order maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-hex-case.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-hex-case.yaml index b26d1bf58de9..c55359a4ca68 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-hex-case.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-hex-case.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with uppercase hex literals maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-indent-strict.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-indent-strict.yaml index bee4cf118d73..155060a79887 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-indent-strict.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-indent-strict.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture using 2-space indent (rejected by strict mode) maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-label-in-string.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-label-in-string.yaml index ba512869b702..4a69b503af4b 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-label-in-string.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-label-in-string.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture where a label is only "referenced" inside a string maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml index 64427bf1c385..6e4140e500b5 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture exceeding 80 columns maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-mixed-indent.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-mixed-indent.yaml index 5401d1a423a1..4f76188b5e23 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-mixed-indent.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-mixed-indent.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture mixing tabs and spaces in indent maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: @@ -26,4 +26,6 @@ examples: device@1000 { compatible = "example,test-mixed"; reg = <0x1000 0x100>; + clocks = <1>, + <2>; }; diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-multi-close.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-multi-close.yaml index 4d9fa27b50a2..afc202a698eb 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-multi-close.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-multi-close.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with two closing braces on one line maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-node-close.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-node-close.yaml index e107659fd9e8..9e714f7e7d47 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-node-close.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-node-close.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with closing brace not on its own line maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-node-name.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-node-name.yaml new file mode 100644 index 000000000000..03373cae9a66 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/yaml-node-name.yaml @@ -0,0 +1,54 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/test-node-name.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Test fixture with incorrect node names + +maintainers: + - Rob Herring <robh@kernel.org> + +properties: + compatible: + const: example,test-node-name + reg: + maxItems: 1 + +required: + - compatible + +additionalProperties: false + +examples: + - | + foo_bar@1000 { + compatible = "example,test-node-name"; + reg = <0x1000 0x100>; + }; + + foo,bar@2000 { + compatible = "example,test-node-name"; + reg = <0x2000 0x100>; + }; + + foo.bar@3000 { + compatible = "example,test-node-name"; + reg = <0x3000 0x100>; + }; + + foo+bar@4000 { + compatible = "example,test-node-name"; + reg = <0x4000 0x100>; + }; + + foo-bar-@5000 { + compatible = "example,test-node-name"; + reg = <0x5000 0x100>; + }; + + // TODO handle also "-foo-bar" which is against spec but accepted by DTC + + foo_bar { + compatible = "example,test-node-name"; + }; diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-prop-order-device-type.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-prop-order-device-type.yaml index e2c69e9ff452..c71fb2c0a3e5 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-prop-order-device-type.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-prop-order-device-type.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with device_type maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-prop-order.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-prop-order.yaml index 75582a3d2f6e..bf1480e97209 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-prop-order.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-prop-order.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with reg before compatible maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-prop-pairing.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-prop-pairing.yaml index 767ab21c39f3..51abc540af11 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-prop-pairing.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-prop-pairing.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture exercising <x>-names and pinctrl-names pairing maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-property-name.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-property-name.yaml new file mode 100644 index 000000000000..08e0d1eb152a --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/yaml-property-name.yaml @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/test-property-name.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Test fixture with incorrect property names + +maintainers: + - Rob Herring <robh@kernel.org> + +properties: + compatible: + const: example,test-property-name + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + foo@1000 { + compatible = "example,test-property-name"; + reg = <0x1000 0x100>; + + property#foo; + property+foo; + property-foo; + property-foo-; + property.foo; + property?foo; + property_foo; + + vendor,property#foo; + vendor,property+foo; + vendor,property,foo; + vendor,property-foo; + vendor,property-foo-; + vendor,property.foo; + vendor,property?foo; + vendor,property_foo; + }; diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-redundant-ws-strict.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-redundant-ws-strict.yaml new file mode 100644 index 000000000000..739c44fd7217 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/yaml-redundant-ws-strict.yaml @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/yaml-redundant-ws-strict.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Test fixture with redundant whitespace + +maintainers: + - Rob Herring <robh@kernel.org> + +properties: + compatible: + const: example,test-redundant + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + device@1000 { + compatible = "example,test-trailing"; + reg = <0x1000 0x100>; + clocks = <&clk 0>; /* comments { are okay = though ; */ + clock-names = "bus"; /* comments { are okay = though ; */ + } ; diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-redundant-ws.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-redundant-ws.yaml new file mode 100644 index 000000000000..b2f51969b0ff --- /dev/null +++ b/scripts/dtc/dt-style-selftest/bad/yaml-redundant-ws.yaml @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/yaml-redundant-ws.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Test fixture with redundant whitespace + +maintainers: + - Rob Herring <robh@kernel.org> + +properties: + compatible: + const: example,test-redundant + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + device@1000 { /* comments { are okay = though ; */ + compatible = "example,test-trailing"; + reg = <0x1000 0x100>, + <0x3000 0x100> ; + } ; + + device@2000 { /* comments { are okay = though ; */ + compatible = "example,test-trailing"; + reg = <0x2000 0x100>; + }; /* comments { are okay = though ; */ diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-required-blank.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-required-blank.yaml index 8bb53240cffa..0036d5e0c4ea 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-required-blank.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-required-blank.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture missing required blank lines maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-tab.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-tab.yaml index 487d07ff8cb6..937ecdd923b0 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-tab.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-tab.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with a tab in a DTS line maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-trailing-comment.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-trailing-comment.yaml index 2368ada8106f..695d046e8454 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-trailing-comment.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-trailing-comment.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with properties out of order behind trailing comments maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-trailing-ws.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-trailing-ws.yaml index 5c4b4bd833c5..f338c14174e6 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-trailing-ws.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-trailing-ws.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with trailing whitespace maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-unclosed-comment.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-unclosed-comment.yaml index 63c1c08712a5..191ed775384b 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-unclosed-comment.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-unclosed-comment.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with an unclosed /* block comment maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-unit-addr-prefix.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-unit-addr-prefix.yaml index 9b3fe508c5fd..62590948d2de 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-unit-addr-prefix.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-unit-addr-prefix.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with 0x-prefixed unit address maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-unit-addr.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-unit-addr.yaml index 93705cd45410..5bb19fba5c19 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-unit-addr.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-unit-addr.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with malformed unit address maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-unused-label.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-unused-label.yaml index 28d7176cbf08..7f862ae5a175 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-unused-label.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-unused-label.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with an unused label maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-value-ws-multiline.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-value-ws-multiline.yaml index 504bf0931c27..1d7bc8142fd7 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-value-ws-multiline.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-value-ws-multiline.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with extra whitespace in a multi-line cell array maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-value-ws.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-value-ws.yaml index 342ab9f399f1..a5082a158155 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-value-ws.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-value-ws.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture with extra whitespace inside <...> maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt index e2eea0862102..312a45ed913a 100644 --- a/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt +++ b/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt @@ -1,2 +1,3 @@ # mode=strict bad/dts-child-name-order.dts:16: [child-name-order] child node 'bar' out of name order +bad/dts-child-name-order.dts:21: [child-name-order] child node 'memory' out of name order diff --git a/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dtso.txt b/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dtso.txt new file mode 100644 index 000000000000..e44ceb24ece8 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dtso.txt @@ -0,0 +1,3 @@ +# mode=strict +bad/dts-child-name-order.dtso:17: [child-name-order] child node 'bar' out of name order +bad/dts-child-name-order.dtso:22: [child-name-order] child node 'memory' out of name order diff --git a/scripts/dtc/dt-style-selftest/expected/dts-cont-align.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-cont-align.dts.txt new file mode 100644 index 000000000000..a7ed62677a2b --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-cont-align.dts.txt @@ -0,0 +1,10 @@ +# mode=strict +bad/dts-cont-align.dts:13: [continuation-alignment] continuation should align to column 26 (to < or ") +bad/dts-cont-align.dts:14: [continuation-alignment] continuation should align to column 26 (to < or ") +bad/dts-cont-align.dts:16: [continuation-alignment] continuation should align to column 30 (to < or ") +bad/dts-cont-align.dts:17: [continuation-alignment] continuation should align to column 30 (to < or ") +bad/dts-cont-align.dts:19: [continuation-alignment] continuation should align to column 27 (to the value under <) +bad/dts-cont-align.dts:20: [continuation-alignment] continuation should align to column 26 (to < or ") +bad/dts-cont-align.dts:21: [continuation-alignment] continuation should align to column 27 (to the value under <) +bad/dts-cont-align.dts:23: [continuation-alignment] continuation should align to column 38 (to < or ") +bad/dts-cont-align.dts:24: [continuation-alignment] continuation should align to column 38 (to < or ") diff --git a/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dts.txt new file mode 100644 index 000000000000..1f41acdea0b0 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dts.txt @@ -0,0 +1,2 @@ +# mode=strict +bad/dts-digit-node-order.dts:29: [child-address-order] child node @10000 out of address order diff --git a/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dtso.txt b/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dtso.txt new file mode 100644 index 000000000000..21db32f6e639 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dtso.txt @@ -0,0 +1,2 @@ +# mode=strict +bad/dts-digit-node-order.dtso:30: [child-address-order] child node @10000 out of address order diff --git a/scripts/dtc/dt-style-selftest/expected/dts-extend-node-child-name-order.dtso.txt b/scripts/dtc/dt-style-selftest/expected/dts-extend-node-child-name-order.dtso.txt new file mode 100644 index 000000000000..d7941a891135 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-extend-node-child-name-order.dtso.txt @@ -0,0 +1,2 @@ +# mode=strict +bad/dts-extend-node-child-name-order.dtso:23: [child-name-order] child node 'bar' out of name order diff --git a/scripts/dtc/dt-style-selftest/expected/dts-extend-node-digit-node-order.dtso.txt b/scripts/dtc/dt-style-selftest/expected/dts-extend-node-digit-node-order.dtso.txt new file mode 100644 index 000000000000..408796d5bb03 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-extend-node-digit-node-order.dtso.txt @@ -0,0 +1,2 @@ +# mode=strict +bad/dts-extend-node-digit-node-order.dtso:24: [child-address-order] child node @10000 out of address order diff --git a/scripts/dtc/dt-style-selftest/expected/dts-line-length.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-line-length.dts.txt new file mode 100644 index 000000000000..8ed08c309632 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-line-length.dts.txt @@ -0,0 +1,2 @@ +# mode=stricter +bad/dts-line-length.dts:17: [line-length-dts] line exceeds 80 columns (101) diff --git a/scripts/dtc/dt-style-selftest/expected/dts-mixed-indent.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-mixed-indent.dts.txt index 93146cfb51c7..1706390f5664 100644 --- a/scripts/dtc/dt-style-selftest/expected/dts-mixed-indent.dts.txt +++ b/scripts/dtc/dt-style-selftest/expected/dts-mixed-indent.dts.txt @@ -6,4 +6,5 @@ bad/dts-mixed-indent.dts:12: [mixed-indent-chars] mixed tabs and spaces in inden bad/dts-mixed-indent.dts:13: [indent-consistent] indent mismatch (expected depth 2 * '\t') bad/dts-mixed-indent.dts:13: [mixed-indent-chars] mixed tabs and spaces in indent bad/dts-mixed-indent.dts:16: [mixed-indent-chars] mixed tabs and spaces in indent +bad/dts-mixed-indent.dts:18: [mixed-indent-chars] too many space characters in indent (more than 7) bad/dts-mixed-indent.dts:19: [indent-consistent] indent mismatch (expected depth 2 * '\t') diff --git a/scripts/dtc/dt-style-selftest/expected/dts-node-name.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-node-name.dts.txt new file mode 100644 index 000000000000..bd8d7e21e243 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-node-name.dts.txt @@ -0,0 +1,13 @@ +# mode=strict +bad/dts-node-name.dts:8: [node-name] node name "foo_bar" is using discouraged style +bad/dts-node-name.dts:12: [child-name-order] child node 'foo,bar' out of name order +bad/dts-node-name.dts:12: [node-name] node name "foo,bar" is using discouraged style +bad/dts-node-name.dts:16: [node-name] node name "foo.bar" is using discouraged style +bad/dts-node-name.dts:20: [child-name-order] child node 'foo+bar' out of name order +bad/dts-node-name.dts:20: [node-name] node name "foo+bar" is using discouraged style +bad/dts-node-name.dts:24: [node-name] node name "foo-bar-" is using discouraged style +bad/dts-node-name.dts:35: [node-name] node name "foo_bar" is using discouraged style +bad/dts-node-name.dts:40: [node-name] node name "foo,bar" is using discouraged style +bad/dts-node-name.dts:45: [node-name] node name "foo.bar" is using discouraged style +bad/dts-node-name.dts:50: [node-name] node name "foo+bar" is using discouraged style +bad/dts-node-name.dts:55: [node-name] node name "foo-bar-" is using discouraged style diff --git a/scripts/dtc/dt-style-selftest/expected/dts-property-name.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-property-name.dts.txt new file mode 100644 index 000000000000..f447743383da --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-property-name.dts.txt @@ -0,0 +1,14 @@ +# mode=strict +bad/dts-property-name.dts:11: [property-name] property name "property#foo" is using discouraged style +bad/dts-property-name.dts:12: [property-name] property name "property+foo" is using discouraged style +bad/dts-property-name.dts:14: [property-name] property name "property-foo-" is using discouraged style +bad/dts-property-name.dts:15: [property-name] property name "property.foo" is using discouraged style +bad/dts-property-name.dts:16: [property-name] property name "property?foo" is using discouraged style +bad/dts-property-name.dts:17: [property-name] property name "property_foo" is using discouraged style +bad/dts-property-name.dts:19: [property-name] property name "vendor,property#foo" is using discouraged style +bad/dts-property-name.dts:20: [property-name] property name "vendor,property+foo" is using discouraged style +bad/dts-property-name.dts:21: [property-name] property name "vendor,property,foo" is using discouraged style +bad/dts-property-name.dts:23: [property-name] property name "vendor,property-foo-" is using discouraged style +bad/dts-property-name.dts:24: [property-name] property name "vendor,property.foo" is using discouraged style +bad/dts-property-name.dts:25: [property-name] property name "vendor,property?foo" is using discouraged style +bad/dts-property-name.dts:26: [property-name] property name "vendor,property_foo" is using discouraged style diff --git a/scripts/dtc/dt-style-selftest/expected/dts-property-order.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dts.txt index 4bc21328625f..0ab832ccf07a 100644 --- a/scripts/dtc/dt-style-selftest/expected/dts-property-order.dts.txt +++ b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dts.txt @@ -1,6 +1,11 @@ # mode=strict -bad/dts-property-order.dts:15: [property-order] property 'compatible' out of canonical order (should sort before 'reg') -bad/dts-property-order.dts:16: [property-order] property 'device_type' out of canonical order (should sort before 'compatible') -bad/dts-property-order.dts:25: [property-order] property 'dma-coherent' out of canonical order (should sort before 'status') -bad/dts-property-order.dts:30: [property-order] property 'compatible' out of canonical order (should sort before 'ranges') -bad/dts-property-order.dts:40: [property-order] property 'compatible' out of canonical order (should sort before 'interrupts') +bad/dts-property-order.dts:10: [property-order] property 'model' out of canonical order (should sort before 'compatible') +bad/dts-property-order.dts:12: [property-order] property 'chassis-type' out of canonical order (should sort before 'qcom,board-id') +bad/dts-property-order.dts:20: [property-order] property 'compatible' out of canonical order (should sort before 'reg') +bad/dts-property-order.dts:21: [property-order] property 'device_type' out of canonical order (should sort before 'compatible') +bad/dts-property-order.dts:30: [property-order] property 'dma-coherent' out of canonical order (should sort before 'status') +bad/dts-property-order.dts:35: [property-order] property 'compatible' out of canonical order (should sort before 'ranges') +bad/dts-property-order.dts:45: [property-order] property 'compatible' out of canonical order (should sort before 'interrupts') +bad/dts-property-order.dts:50: [redundant-whitespace] extra whitespace before { +bad/dts-property-order.dts:52: [property-order] property 'model' out of canonical order (should sort before 'compatible') +bad/dts-property-order.dts:57: [property-order] property 'model' out of canonical order (should sort before 'compatible') diff --git a/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt new file mode 100644 index 000000000000..9f2a00916329 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt @@ -0,0 +1,11 @@ +# mode=strict +bad/dts-property-order.dtso:11: [property-order] property 'model' out of canonical order (should sort before 'compatible') +bad/dts-property-order.dtso:13: [property-order] property 'chassis-type' out of canonical order (should sort before 'qcom,board-id') +bad/dts-property-order.dtso:21: [property-order] property 'compatible' out of canonical order (should sort before 'reg') +bad/dts-property-order.dtso:22: [property-order] property 'device_type' out of canonical order (should sort before 'compatible') +bad/dts-property-order.dtso:31: [property-order] property 'dma-coherent' out of canonical order (should sort before 'status') +bad/dts-property-order.dtso:36: [property-order] property 'compatible' out of canonical order (should sort before 'ranges') +bad/dts-property-order.dtso:46: [property-order] property 'compatible' out of canonical order (should sort before 'interrupts') +bad/dts-property-order.dtso:51: [redundant-whitespace] extra whitespace before { +bad/dts-property-order.dtso:53: [property-order] property 'model' out of canonical order (should sort before 'compatible') +bad/dts-property-order.dtso:58: [property-order] property 'model' out of canonical order (should sort before 'compatible') diff --git a/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws-strict.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws-strict.dts.txt new file mode 100644 index 000000000000..ac0d57bdecdf --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws-strict.dts.txt @@ -0,0 +1,13 @@ +# mode=strict +bad/dts-redundant-ws-strict.dts:7: [redundant-whitespace] extra whitespace before { +bad/dts-redundant-ws-strict.dts:13: [redundant-whitespace] extra whitespace before { +bad/dts-redundant-ws-strict.dts:13: [redundant-whitespace] extra whitespace after : +bad/dts-redundant-ws-strict.dts:17: [redundant-whitespace-strict] extra whitespace before = +bad/dts-redundant-ws-strict.dts:18: [redundant-whitespace-strict] extra whitespace after = +bad/dts-redundant-ws-strict.dts:19: [redundant-whitespace] extra whitespace before ; +bad/dts-redundant-ws-strict.dts:22: [redundant-whitespace] extra whitespace before { +bad/dts-redundant-ws-strict.dts:23: [redundant-whitespace] extra whitespace before { +bad/dts-redundant-ws-strict.dts:23: [redundant-whitespace] extra whitespace after : +bad/dts-redundant-ws-strict.dts:24: [redundant-whitespace-strict] extra whitespace before = +bad/dts-redundant-ws-strict.dts:25: [redundant-whitespace-strict] extra whitespace after = +bad/dts-redundant-ws-strict.dts:26: [redundant-whitespace] extra whitespace before ; diff --git a/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws.dts.txt new file mode 100644 index 000000000000..3b2a989045ed --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws.dts.txt @@ -0,0 +1,10 @@ +# mode=relaxed +bad/dts-redundant-ws.dts:7: [redundant-whitespace] extra whitespace before { +bad/dts-redundant-ws.dts:13: [redundant-whitespace] extra whitespace before { +bad/dts-redundant-ws.dts:13: [redundant-whitespace] extra whitespace after : +bad/dts-redundant-ws.dts:19: [redundant-whitespace] extra whitespace before ; +bad/dts-redundant-ws.dts:22: [redundant-whitespace] extra whitespace before { +bad/dts-redundant-ws.dts:23: [redundant-whitespace] extra whitespace before { +bad/dts-redundant-ws.dts:23: [redundant-whitespace] extra whitespace after : +bad/dts-redundant-ws.dts:26: [redundant-whitespace] extra whitespace before ; +bad/dts-redundant-ws.dts:27: [redundant-whitespace] extra whitespace before ; diff --git a/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws.dtso.txt b/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws.dtso.txt new file mode 100644 index 000000000000..5f9a63061709 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-redundant-ws.dtso.txt @@ -0,0 +1,2 @@ +# mode=strict +bad/dts-redundant-ws.dtso:5: [redundant-whitespace] extra whitespace before { diff --git a/scripts/dtc/dt-style-selftest/expected/dts-trailing-ws.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-trailing-ws.dts.txt new file mode 100644 index 000000000000..94d9ae9d616c --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-trailing-ws.dts.txt @@ -0,0 +1,2 @@ +# mode=relaxed +bad/dts-trailing-ws.dts:5: [trailing-whitespace] trailing whitespace diff --git a/scripts/dtc/dt-style-selftest/expected/dts-unused-label.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-unused-label.dts.txt new file mode 100644 index 000000000000..4cdcaba3ba2f --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/dts-unused-label.dts.txt @@ -0,0 +1,2 @@ +# mode=stricter +bad/dts-unused-label.dts:16: [unused-labels-dts] label 'dev' defined but never &-referenced diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt index b5576dd0f6b1..eb9a84d5c222 100644 --- a/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt +++ b/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt @@ -1,2 +1,3 @@ # mode=strict -bad/yaml-cont-align.yaml:29: example 0 [continuation-alignment] continuation should align to column 11 (under "<" or \") +bad/yaml-cont-align.yaml:29: example 0 [continuation-alignment] continuation should align to column 11 (to < or ") +bad/yaml-cont-align.yaml:31: example 0 [continuation-alignment] continuation should align to column 12 (to the value under <) diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-mixed-indent.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-mixed-indent.yaml.txt index bc3fc3cf00cc..442f21f90e83 100644 --- a/scripts/dtc/dt-style-selftest/expected/yaml-mixed-indent.yaml.txt +++ b/scripts/dtc/dt-style-selftest/expected/yaml-mixed-indent.yaml.txt @@ -1,2 +1,3 @@ # mode=relaxed bad/yaml-mixed-indent.yaml:27: example 0 [tab-in-yaml] tab character not allowed in DTS example +bad/yaml-mixed-indent.yaml:30: example 0 [tab-in-yaml] tab character not allowed in DTS example diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-node-name.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-node-name.yaml.txt new file mode 100644 index 000000000000..d9cf749e35c2 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/yaml-node-name.yaml.txt @@ -0,0 +1,7 @@ +# mode=strict +bad/yaml-node-name.yaml:25: example 0 [node-name] node name "foo_bar" is using discouraged style +bad/yaml-node-name.yaml:30: example 0 [node-name] node name "foo,bar" is using discouraged style +bad/yaml-node-name.yaml:35: example 0 [node-name] node name "foo.bar" is using discouraged style +bad/yaml-node-name.yaml:40: example 0 [node-name] node name "foo+bar" is using discouraged style +bad/yaml-node-name.yaml:45: example 0 [node-name] node name "foo-bar-" is using discouraged style +bad/yaml-node-name.yaml:52: example 0 [node-name] node name "foo_bar" is using discouraged style diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-property-name.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-property-name.yaml.txt new file mode 100644 index 000000000000..6aa3a004532b --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/yaml-property-name.yaml.txt @@ -0,0 +1,14 @@ +# mode=strict +bad/yaml-property-name.yaml:30: example 0 [property-name] property name "property#foo" is using discouraged style +bad/yaml-property-name.yaml:31: example 0 [property-name] property name "property+foo" is using discouraged style +bad/yaml-property-name.yaml:33: example 0 [property-name] property name "property-foo-" is using discouraged style +bad/yaml-property-name.yaml:34: example 0 [property-name] property name "property.foo" is using discouraged style +bad/yaml-property-name.yaml:35: example 0 [property-name] property name "property?foo" is using discouraged style +bad/yaml-property-name.yaml:36: example 0 [property-name] property name "property_foo" is using discouraged style +bad/yaml-property-name.yaml:38: example 0 [property-name] property name "vendor,property#foo" is using discouraged style +bad/yaml-property-name.yaml:39: example 0 [property-name] property name "vendor,property+foo" is using discouraged style +bad/yaml-property-name.yaml:40: example 0 [property-name] property name "vendor,property,foo" is using discouraged style +bad/yaml-property-name.yaml:42: example 0 [property-name] property name "vendor,property-foo-" is using discouraged style +bad/yaml-property-name.yaml:43: example 0 [property-name] property name "vendor,property.foo" is using discouraged style +bad/yaml-property-name.yaml:44: example 0 [property-name] property name "vendor,property?foo" is using discouraged style +bad/yaml-property-name.yaml:45: example 0 [property-name] property name "vendor,property_foo" is using discouraged style diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-redundant-ws-strict.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-redundant-ws-strict.yaml.txt new file mode 100644 index 000000000000..fbf323832c91 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/yaml-redundant-ws-strict.yaml.txt @@ -0,0 +1,5 @@ +# mode=strict +bad/yaml-redundant-ws-strict.yaml:26: example 0 [redundant-whitespace] extra whitespace before { +bad/yaml-redundant-ws-strict.yaml:27: example 0 [redundant-whitespace-strict] extra whitespace before = +bad/yaml-redundant-ws-strict.yaml:28: example 0 [redundant-whitespace-strict] extra whitespace after = +bad/yaml-redundant-ws-strict.yaml:31: example 0 [redundant-whitespace] extra whitespace before ; diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-redundant-ws.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-redundant-ws.yaml.txt new file mode 100644 index 000000000000..a162967e4336 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/expected/yaml-redundant-ws.yaml.txt @@ -0,0 +1,4 @@ +# mode=relaxed +bad/yaml-redundant-ws.yaml:26: example 0 [redundant-whitespace] extra whitespace before { +bad/yaml-redundant-ws.yaml:29: example 0 [redundant-whitespace] extra whitespace before ; +bad/yaml-redundant-ws.yaml:30: example 0 [redundant-whitespace] extra whitespace before ; diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt index 3df55b1762d0..d25b5b425e3f 100644 --- a/scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt +++ b/scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt @@ -1,2 +1,3 @@ # mode=strict bad/yaml-value-ws-multiline.yaml:25: example 0 [value-whitespace] extra whitespace inside <...> +bad/yaml-value-ws-multiline.yaml:26: example 0 [continuation-alignment] continuation should align to column 12 (to the value under <) diff --git a/scripts/dtc/dt-style-selftest/good/dts-child-name-order.dtso b/scripts/dtc/dt-style-selftest/good/dts-child-name-order.dtso new file mode 100644 index 000000000000..1fd75a6285ce --- /dev/null +++ b/scripts/dtc/dt-style-selftest/good/dts-child-name-order.dtso @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + #address-cells = <1>; + #size-cells = <1>; + + memory@a0000000 { + device_type = "memory"; + reg = <0x0 0xa0000000 0x0 0x0>; + }; + + pmu { + compatible = "example,pmu"; + + /* Include labels to be sure they do not affect sorting */ + label_bar: bar { + label = "bar"; + }; + + foo: foo { + label = "foo"; + }; + }; + + pmu-2 { + compatible = "example,pmu"; + + /* Just reference labels to avoid strict warnings */ + example,foo = <&foo>, <&label_bar>; + }; +}; + +&pmu { + /* Include labels to be sure they do not affect sorting */ + label_bar_2: bar-2 { + label = "bar"; + }; + + foo_2: foo-2 { + label = "foo"; + }; +} diff --git a/scripts/dtc/dt-style-selftest/good/dts-cont-align.dts b/scripts/dtc/dt-style-selftest/good/dts-cont-align.dts index 36fb4eefcd83..b52ee6cccd8c 100644 --- a/scripts/dtc/dt-style-selftest/good/dts-cont-align.dts +++ b/scripts/dtc/dt-style-selftest/good/dts-cont-align.dts @@ -15,12 +15,15 @@ interrupt-controller@10000 { compatible = "example,intc"; reg = <0x10000 0x1000>; - interrupts = <1 2 3>, + interrupts = <1 2 3>, /* comments with " < , should not ... */ <4 5 6>, <7 8 9>; - pinmux = < - 0x01 - 0x02 - >; + pinmux = <0x01 + 0x02>, + <0x03 /* comments with " < , should not matter */ + 0x04>; + power-domain-names = "foo", /* comments with " < , should not */ + "bar", + "baz"; }; }; diff --git a/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts b/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts index cdf3f91ebe01..2b21dde7f3c8 100644 --- a/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts +++ b/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts @@ -5,13 +5,10 @@ #address-cells = <1>; #size-cells = <1>; - /* TODO: uncomment when child-address-order is fixed for top-level */ - /* memory@a0000000 { device_type = "memory"; reg = <0x0 0xa0000000 0x0 0x0>; }; - */ pmu { compatible = "example,pmu"; diff --git a/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dtso b/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dtso new file mode 100644 index 000000000000..efafa1cccc15 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dtso @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + #address-cells = <1>; + #size-cells = <1>; + + memory@a0000000 { + device_type = "memory"; + reg = <0x0 0xa0000000 0x0 0x0>; + }; + + pmu { + compatible = "example,pmu"; + }; + + soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + + interrupt-controller@10000 { + compatible = "example,intc"; + reg = <0x10000 0x1000>; + interrupts = <1 2 3>; + }; + + serial@20000 { + compatible = "example,serial"; + reg = <0x20000 0x1000>; + }; + + serial@30000 { + compatible = "example,serial"; + reg = <0x30000 0x1000>; + }; + }; +}; + +&soc { + interrupt-controller@110000 { + compatible = "example,intc"; + reg = <0x110000 0x1000>; + interrupts = <1 2 3>; + }; + + serial@120000 { + compatible = "example,serial"; + reg = <0x120000 0x1000>; + }; + + serial@130000 { + compatible = "example,serial"; + reg = <0x130000 0x1000>; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/good/dts-extend-node-child-name-order.dtso b/scripts/dtc/dt-style-selftest/good/dts-extend-node-child-name-order.dtso new file mode 100644 index 000000000000..b00c2a195179 --- /dev/null +++ b/scripts/dtc/dt-style-selftest/good/dts-extend-node-child-name-order.dtso @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + #address-cells = <1>; + #size-cells = <1>; + + pmu { + compatible = "example,pmu"; + + /* Just reference labels to avoid strict warnings */ + example,foo = <&foo>, <&label_bar>; + }; +}; + +&pmu { + /* Include labels to be sure they do not affect sorting */ + label_bar: bar { + label = "bar"; + }; + + foo: foo { + label = "foo"; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/good/dts-extend-node-digit-node-order.dtso b/scripts/dtc/dt-style-selftest/good/dts-extend-node-digit-node-order.dtso new file mode 100644 index 000000000000..1ce18afb80de --- /dev/null +++ b/scripts/dtc/dt-style-selftest/good/dts-extend-node-digit-node-order.dtso @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/dts-v1/; +/plugin/; + +&{/} { + #address-cells = <1>; + #size-cells = <1>; + + soc: soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + }; +}; + +&soc { + interrupt-controller@10000 { + compatible = "example,intc"; + reg = <0x10000 0x1000>; + interrupts = <1 2 3>; + }; + + serial@20000 { + compatible = "example,serial"; + reg = <0x20000 0x1000>; + }; + + serial@30000 { + compatible = "example,serial"; + reg = <0x30000 0x1000>; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/good/dts-property-order.dts b/scripts/dtc/dt-style-selftest/good/dts-property-order.dts index 0e183e3459cd..3d847cc9fa3e 100644 --- a/scripts/dtc/dt-style-selftest/good/dts-property-order.dts +++ b/scripts/dtc/dt-style-selftest/good/dts-property-order.dts @@ -6,6 +6,11 @@ /dts-v1/; / { + model = "DT style selftest"; + compatible = "example,test-board", "example,test-soc"; + chassis-type = "handset"; + qcom,board-id = <8 0>; + cpus { #address-cells = <1>; #size-cells = <0>; diff --git a/scripts/dtc/dt-style-selftest/good/dts-property-order.dtso b/scripts/dtc/dt-style-selftest/good/dts-property-order.dtso new file mode 100644 index 000000000000..5ae78541f68b --- /dev/null +++ b/scripts/dtc/dt-style-selftest/good/dts-property-order.dtso @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +/* + * Test fixture: Incorrect property order + */ + +/dts-v1/; +/plugin/; + +&{/} { + model = "DT style selftest"; + compatible = "example,test-board", "example,test-soc"; + chassis-type = "handset"; + qcom,board-id = <8 0>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a57"; + reg = <0x0 0x0>; + enable-method = "psci"; + }; + }; + + pmu { + compatible = "example,pmu"; + dma-coherent; + + status = "disabled"; + }; + + soc@0 { + compatible = "simple-bus"; + ranges = <0 0 0 0xc0000000>; + + #address-cells = <1>; + #size-cells = <1>; + + interrupt-controller@10000 { + compatible = "example,intc"; + reg = <0x10000 0x1000>; + interrupts = <1 2 3>; + }; + }; +}; diff --git a/scripts/dtc/dt-style-selftest/good/yaml-4space.yaml b/scripts/dtc/dt-style-selftest/good/yaml-4space.yaml index 1502f803c24c..b91b8a8a9512 100644 --- a/scripts/dtc/dt-style-selftest/good/yaml-4space.yaml +++ b/scripts/dtc/dt-style-selftest/good/yaml-4space.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Test fixture for dt-check-style maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/good/yaml-cont-align.yaml b/scripts/dtc/dt-style-selftest/good/yaml-cont-align.yaml new file mode 100644 index 000000000000..8463075f9f4c --- /dev/null +++ b/scripts/dtc/dt-style-selftest/good/yaml-cont-align.yaml @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/test-good-cont-align.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Test fixture with aligned multi-line property + +maintainers: + - Rob Herring <robh@kernel.org> + +properties: + compatible: + const: example,test-cont-align + reg: + maxItems: 2 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + foo@1000 { + compatible = "example,test-cont-align"; + reg = <0x1000 0x100>, + <0x2000 0x100>, + <0x3000 + 0x100>; + }; diff --git a/scripts/dtc/dt-style-selftest/good/yaml-tricky-parsing.yaml b/scripts/dtc/dt-style-selftest/good/yaml-tricky-parsing.yaml index a836d5f36b93..a95d07f883ef 100644 --- a/scripts/dtc/dt-style-selftest/good/yaml-tricky-parsing.yaml +++ b/scripts/dtc/dt-style-selftest/good/yaml-tricky-parsing.yaml @@ -17,7 +17,7 @@ description: | not leave the parser in block-comment state. maintainers: - - Test User <test@example.com> + - Rob Herring <robh@kernel.org> properties: compatible: diff --git a/scripts/dtc/dt-style-selftest/run.sh b/scripts/dtc/dt-style-selftest/run.sh index 8117dd9be90a..5691301d6a4a 100755 --- a/scripts/dtc/dt-style-selftest/run.sh +++ b/scripts/dtc/dt-style-selftest/run.sh @@ -26,7 +26,7 @@ run() { # good/ -- must exit 0 and produce no output in both modes for f in "$here"/good/*; do [ -e "$f" ] || continue - for mode in relaxed strict; do + for mode in relaxed strict stricter; do out=$(run "$f" "$mode") rc=$? if [ -n "$out" ] || [ "$rc" -ne 0 ]; then |
