Skip to content

Commit 17161c3

Browse files
robherringdavem330
authored andcommitted
dt-bindings: net: ethernet-controller: Rework 'fixed-link' schema
While the if/then schemas mostly work, there's a few issues. The 'allOf' schema will also be true if 'fixed-link' is not an array or object as a false 'if' schema (without an 'else') will be true. In the array case doesn't set the type (uint32-array) in the 'then' clause. In the node case, 'additionalProperties' is missing. Rework the schema to use oneOf with each possible type. Signed-off-by: Rob Herring <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b20a7ca commit 17161c3

File tree

1 file changed

+59
-64
lines changed

1 file changed

+59
-64
lines changed

Documentation/devicetree/bindings/net/ethernet-controller.yaml

Lines changed: 59 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -167,70 +167,65 @@ properties:
167167
- in-band-status
168168

169169
fixed-link:
170-
allOf:
171-
- if:
172-
type: array
173-
then:
174-
deprecated: true
175-
items:
176-
- minimum: 0
177-
maximum: 31
178-
description:
179-
Emulated PHY ID, choose any but unique to the all
180-
specified fixed-links
181-
182-
- enum: [0, 1]
183-
description:
184-
Duplex configuration. 0 for half duplex or 1 for
185-
full duplex
186-
187-
- enum: [10, 100, 1000, 2500, 10000]
188-
description:
189-
Link speed in Mbits/sec.
190-
191-
- enum: [0, 1]
192-
description:
193-
Pause configuration. 0 for no pause, 1 for pause
194-
195-
- enum: [0, 1]
196-
description:
197-
Asymmetric pause configuration. 0 for no asymmetric
198-
pause, 1 for asymmetric pause
199-
200-
201-
- if:
202-
type: object
203-
then:
204-
properties:
205-
speed:
206-
description:
207-
Link speed.
208-
$ref: /schemas/types.yaml#/definitions/uint32
209-
enum: [10, 100, 1000, 2500, 10000]
210-
211-
full-duplex:
212-
$ref: /schemas/types.yaml#/definitions/flag
213-
description:
214-
Indicates that full-duplex is used. When absent, half
215-
duplex is assumed.
216-
217-
pause:
218-
$ref: /schemas/types.yaml#definitions/flag
219-
description:
220-
Indicates that pause should be enabled.
221-
222-
asym-pause:
223-
$ref: /schemas/types.yaml#/definitions/flag
224-
description:
225-
Indicates that asym_pause should be enabled.
226-
227-
link-gpios:
228-
maxItems: 1
229-
description:
230-
GPIO to determine if the link is up
231-
232-
required:
233-
- speed
170+
oneOf:
171+
- $ref: /schemas/types.yaml#/definitions/uint32-array
172+
deprecated: true
173+
items:
174+
- minimum: 0
175+
maximum: 31
176+
description:
177+
Emulated PHY ID, choose any but unique to the all
178+
specified fixed-links
179+
180+
- enum: [0, 1]
181+
description:
182+
Duplex configuration. 0 for half duplex or 1 for
183+
full duplex
184+
185+
- enum: [10, 100, 1000, 2500, 10000]
186+
description:
187+
Link speed in Mbits/sec.
188+
189+
- enum: [0, 1]
190+
description:
191+
Pause configuration. 0 for no pause, 1 for pause
192+
193+
- enum: [0, 1]
194+
description:
195+
Asymmetric pause configuration. 0 for no asymmetric
196+
pause, 1 for asymmetric pause
197+
- type: object
198+
additionalProperties: false
199+
properties:
200+
speed:
201+
description:
202+
Link speed.
203+
$ref: /schemas/types.yaml#/definitions/uint32
204+
enum: [10, 100, 1000, 2500, 10000]
205+
206+
full-duplex:
207+
$ref: /schemas/types.yaml#/definitions/flag
208+
description:
209+
Indicates that full-duplex is used. When absent, half
210+
duplex is assumed.
211+
212+
pause:
213+
$ref: /schemas/types.yaml#definitions/flag
214+
description:
215+
Indicates that pause should be enabled.
216+
217+
asym-pause:
218+
$ref: /schemas/types.yaml#/definitions/flag
219+
description:
220+
Indicates that asym_pause should be enabled.
221+
222+
link-gpios:
223+
maxItems: 1
224+
description:
225+
GPIO to determine if the link is up
226+
227+
required:
228+
- speed
234229

235230
additionalProperties: true
236231

0 commit comments

Comments
 (0)