Re: [PATCH v1 1/2] dt-bindings: hwmon: Add starfive,jhb100-fan-tach

Rob Herring <[email protected]> Tue, 5 May 2026 20:22:41 -0500
Newsgroups dev.linux.lists.sashiko,org.kernel.vger.linux-hwmon
Message-ID <[email protected]>
On Tue, Apr 28, 2026 at 07:39:52PM +0000, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] The `tach-ch` property in the device tree example uses incorrect comma-separated syntax that evaluates to a 5-byte array rather than the intended 2-byte array.
> --
> 
> commit 4bf196984d444742e611042f289ee38d6b5ced8c
> Author: Changhuang Liang <[email protected]>
> 
> dt-bindings: hwmon: Add starfive,jhb100-fan-tach
> 
> This commit adds the compatible string "starfive,jhb100-fan-tach" and the
> corresponding binding schema for the StarFive JHB100 Fan-Tach controller.
> The controller supports up to 16 fan tach inputs.
> 
> > diff --git a/Documentation/devicetree/bindings/hwmon/starfive,jhb100-fan-tach.yaml b/Documentation/devicetree/bindings/hwmon/starfive,jhb100-fan-tach.yaml
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hwmon/starfive,jhb100-fan-tach.yaml
> [ ... ]
> > +examples:
> > +  - |
> > +    fan-tach-controller@11be0000 {
> > +        compatible = "starfive,jhb100-fan-tach";
> > +        reg = <0x11be0000 0x400>;
> > +        interrupts = <128>;
> > +        clocks = <&per2crg 33>;
> > +        resets = <&per2crg 5>;
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        fan@0 {
> > +            reg = <0>;
> > +            tach-ch = /bits/ 8 <0x0>, <0x8>;
> 
> Is the comma-separated syntax in tach-ch intentional? In Device Tree Source
> syntax, the /bits/ 8 directive applies only to the immediately following
> angle-bracket block.
> 
> Because tach-ch = /bits/ 8 <0x0>, <0x8>; separates the values with a comma,
> the second block reverts to the default 32-bit cell size. This produces a
> 5-byte array [0x00, 0x00, 0x00, 0x00, 0x08] rather than the intended 2-byte
> array.
> 
> If a developer copies this example into a real device tree, will the driver
> incorrectly interpret it as 5 separate tachometer channels (0, 0, 0, 0, 8)
> instead of the intended 2 channels (0, 8)?
> 
> Should this be written as /bits/ 8 <0x0 0x8>; or using byte array syntax
> like [00 08] instead?

Yes. The former style though.

Rob