Re: [PATCH] tty: hvc: hvc_opal: eliminate uses of of_node_put()

2024-05-03 Thread Javier Carrasco
On 5/3/24 13:43, Lu Dai wrote:
> Make use of the __free() cleanup handler to automatically free nodes
> when they get out of scope.
> 
> Removes the need for a 'goto' as an effect.
> 
> Signed-off-by: Lu Dai 
> ---
>  drivers/tty/hvc/hvc_opal.c | 9 +++--
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
> index 095c33ad10f8..67e90fa993a3 100644
> --- a/drivers/tty/hvc/hvc_opal.c
> +++ b/drivers/tty/hvc/hvc_opal.c
> @@ -327,14 +327,14 @@ static void udbg_init_opal_common(void)
>  
>  void __init hvc_opal_init_early(void)
>  {
> - struct device_node *stdout_node = of_node_get(of_stdout);
> + struct device_node *stdout_node __free(device_node) = 
> of_node_get(of_stdout);
>   const __be32 *termno;
>   const struct hv_ops *ops;
>   u32 index;
>  
>   /* If the console wasn't in /chosen, try /ibm,opal */
>   if (!stdout_node) {
> - struct device_node *opal, *np;

Generally, you should always initialize the variable where it is
declared. What would happen if the variable goes out of scope before it
gets initialized? Now it is not dangerous, but if new code is added and
it returns because of some error, we might run into trouble.

In this particular case you can solve this easily by putting together
your modification and the assignment right after the comment.


> + struct device_node *opal __free(device_node), *np;
>  
>   /* Current OPAL takeover doesn't provide the stdout
>* path, so we hard wire it
> @@ -356,7 +356,6 @@ void __init hvc_opal_init_early(void)
>   break;
>   }
>   }
> - of_node_put(opal);
>   }
>   if (!stdout_node)
>   return;
> @@ -382,13 +381,11 @@ void __init hvc_opal_init_early(void)
>   hvsilib_establish(_opal_boot_priv.hvsi);
>   pr_devel("hvc_opal: Found HVSI console\n");
>   } else
> - goto out;
> + return;
>   hvc_opal_boot_termno = index;
>   udbg_init_opal_common();
>   add_preferred_console("hvc", index, NULL);
>   hvc_instantiate(index, index, ops);
> -out:
> - of_node_put(stdout_node);
>  }
>  
>  #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW


Best regards,
Javier Carrasco


[PATCH v3 5/5] dt-bindings: hwmon: ibm,p8-occ-hwmon: move to trivial devices

2024-03-22 Thread Javier Carrasco
This binding meets the requirements to be converted to dtschema
via trivial-devices.yaml.

Reviewed-by: Rob Herring 
Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt | 25 --
 .../devicetree/bindings/trivial-devices.yaml   |  2 ++
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt 
b/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt
deleted file mode 100644
index 5dc5d2e2573d..
--- a/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Device-tree bindings for I2C-based On-Chip Controller hwmon device
---
-
-Required properties:
- - compatible = "ibm,p8-occ-hwmon";
- - reg = ;: I2C bus address
-
-Examples:
-
-i2c-bus@100 {
-#address-cells = <1>;
-#size-cells = <0>;
-clock-frequency = <10>;
-< more properties >
-
-occ-hwmon@1 {
-compatible = "ibm,p8-occ-hwmon";
-reg = <0x50>;
-};
-
-occ-hwmon@2 {
-compatible = "ibm,p8-occ-hwmon";
-reg = <0x51>;
-};
-};
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml 
b/Documentation/devicetree/bindings/trivial-devices.yaml
index e07be7bf8395..87b0dd9b0734 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -126,6 +126,8 @@ properties:
   - ibm,cffps1
 # IBM Common Form Factor Power Supply Versions 2
   - ibm,cffps2
+# IBM On-Chip Controller hwmon device
+  - ibm,p8-occ-hwmon
 # Infineon barometric pressure and temperature sensor
   - infineon,dps310
 # Infineon IR36021 digital POL buck controller

-- 
2.40.1



[PATCH v3 4/5] dt-bindings: hwmon: stts751: convert to dtschema

2024-03-22 Thread Javier Carrasco
Convert existing binding to support validation.

This is a straightforward conversion with no new properties.

Reviewed-by: Conor Dooley 
Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/st,stts751.yaml  | 41 ++
 .../devicetree/bindings/hwmon/stts751.txt  | 15 
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/st,stts751.yaml 
b/Documentation/devicetree/bindings/hwmon/st,stts751.yaml
new file mode 100644
index ..9c825adbed58
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/st,stts751.yaml
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/st,stts751.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STTS751 Thermometer
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+const: st,stts751
+
+  reg:
+maxItems: 1
+
+  smbus-timeout-disable:
+description:
+  When set, the smbus timeout function will be disabled.
+$ref: /schemas/types.yaml#/definitions/flag
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+i2c {
+#address-cells = <1>;
+#size-cells = <0>;
+
+thermometer@48 {
+compatible = "st,stts751";
+reg = <0x48>;
+smbus-timeout-disable;
+};
+};
diff --git a/Documentation/devicetree/bindings/hwmon/stts751.txt 
b/Documentation/devicetree/bindings/hwmon/stts751.txt
deleted file mode 100644
index 3ee1dc30e72f..
--- a/Documentation/devicetree/bindings/hwmon/stts751.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-* STTS751 thermometer.
-
-Required node properties:
-- compatible: "stts751"
-- reg: I2C bus address of the device
-
-Optional properties:
-- smbus-timeout-disable: when set, the smbus timeout function will be disabled
-
-Example stts751 node:
-
-temp-sensor {
-   compatible = "stts751";
-   reg = <0x48>;
-}

-- 
2.40.1



[PATCH v3 1/5] dt-bindings: hwmon: as370: convert to dtschema

2024-03-22 Thread Javier Carrasco
Convert existing binding to support validation.

This is a straightforward conversion with now new properties.

Reviewed-by: Rob Herring 
Signed-off-by: Javier Carrasco 
---
 Documentation/devicetree/bindings/hwmon/as370.txt  | 11 
 .../devicetree/bindings/hwmon/syna,as370.yaml  | 32 ++
 2 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/as370.txt 
b/Documentation/devicetree/bindings/hwmon/as370.txt
deleted file mode 100644
index d102fe765124..
--- a/Documentation/devicetree/bindings/hwmon/as370.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Bindings for Synaptics AS370 PVT sensors
-
-Required properties:
-- compatible : "syna,as370-hwmon"
-- reg: address and length of the register set.
-
-Example:
-   hwmon@ea0810 {
-   compatible = "syna,as370-hwmon";
-   reg = <0xea0810 0xc>;
-   };
diff --git a/Documentation/devicetree/bindings/hwmon/syna,as370.yaml 
b/Documentation/devicetree/bindings/hwmon/syna,as370.yaml
new file mode 100644
index ..1f7005f55247
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/syna,as370.yaml
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/syna,as370.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synaptics AS370 PVT sensors
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+const: syna,as370-hwmon
+
+  reg:
+description:
+  Address and length of the register set.
+maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+sensor@ea0810 {
+compatible = "syna,as370-hwmon";
+reg = <0xea0810 0xc>;
+};

-- 
2.40.1



[PATCH v3 0/5] dt-bindings: hwmon: convert multiple devices to dtschema

2024-03-22 Thread Javier Carrasco
This series converts the following existing bindings to dtschema:

- as370
- ibmpowernv (renamed to ibm,opal-sensor to match compatibles)
- stts751
- ibm,p8-occ-hwmon (moved to trivial-devices.yaml)

Additionally, pwm-fan.txt has been dropped because it was converted a
year ago, and it is not mentioned anywhere in the tree.
I could not find the rationale, but its current state does not seem to
provide any valuable information.

Signed-off-by: Javier Carrasco 
---
Changes in v3:
- Rename ibmpowernv to ibm,opal-sensor to match compatibles.
- Link to v2: 
https://lore.kernel.org/r/20240322-hwmon_dtschema-v2-0-570bee1ac...@gmail.com

Changes in v2:
- ibmpowernv: fix compatible string in the example.
- Link to v1: 
https://lore.kernel.org/r/20240321-hwmon_dtschema-v1-0-96c3810c3...@gmail.com

---
Javier Carrasco (5):
  dt-bindings: hwmon: as370: convert to dtschema
  dt-bindings: hwmon: ibmpowernv: convert to dtschema
  dt-bindings: hwmon: pwm-fan: drop text file
  dt-bindings: hwmon: stts751: convert to dtschema
  dt-bindings: hwmon: ibm,p8-occ-hwmon: move to trivial devices

 Documentation/devicetree/bindings/hwmon/as370.txt  | 11 --
 .../devicetree/bindings/hwmon/ibm,opal-sensor.yaml | 37 +++
 .../devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt | 25 -
 .../devicetree/bindings/hwmon/ibmpowernv.txt   | 23 
 .../devicetree/bindings/hwmon/pwm-fan.txt  |  1 -
 .../devicetree/bindings/hwmon/st,stts751.yaml  | 41 ++
 .../devicetree/bindings/hwmon/stts751.txt  | 15 
 .../devicetree/bindings/hwmon/syna,as370.yaml  | 32 +
 .../devicetree/bindings/trivial-devices.yaml   |  2 ++
 9 files changed, 112 insertions(+), 75 deletions(-)
---
base-commit: ebc9bee8814d12ec247de117aa2f7fd39ff11127
change-id: 20240320-hwmon_dtschema-7f58f49118aa

Best regards,
-- 
Javier Carrasco 



[PATCH v3 2/5] dt-bindings: hwmon: ibmpowernv: convert to dtschema

2024-03-22 Thread Javier Carrasco
Convert existing binding to support validation.

The binding has been renamed to match its compatible strings, with no
further additions.

Reviewed-by: Conor Dooley 
Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/ibm,opal-sensor.yaml | 37 ++
 .../devicetree/bindings/hwmon/ibmpowernv.txt   | 23 --
 2 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/ibm,opal-sensor.yaml 
b/Documentation/devicetree/bindings/hwmon/ibm,opal-sensor.yaml
new file mode 100644
index ..376ee7f1cdb7
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/ibm,opal-sensor.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/ibm,opal-sensor.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: IBM POWERNV platform sensors
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+enum:
+  - ibm,opal-sensor-cooling-fan
+  - ibm,opal-sensor-amb-temp
+  - ibm,opal-sensor-power-supply
+  - ibm,opal-sensor-power
+
+  sensor-id:
+description:
+  An opaque id provided by the firmware to the kernel, identifies a
+  given sensor and its attribute data.
+$ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+  - compatible
+  - sensor-id
+
+additionalProperties: false
+
+examples:
+  - |
+sensor {
+compatible = "ibm,opal-sensor-cooling-fan";
+sensor-id = <0x7052107>;
+};
diff --git a/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt 
b/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt
deleted file mode 100644
index f93242be60a1..
--- a/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-IBM POWERNV platform sensors
-
-
-Required node properties:
-- compatible: must be one of
-   "ibm,opal-sensor-cooling-fan"
-   "ibm,opal-sensor-amb-temp"
-   "ibm,opal-sensor-power-supply"
-   "ibm,opal-sensor-power"
-- sensor-id: an opaque id provided by the firmware to the kernel, identifies a
-given sensor and its attribute data
-
-Example sensors node:
-
-cooling-fan#8-data {
-   sensor-id = <0x7052107>;
-   compatible = "ibm,opal-sensor-cooling-fan";
-};
-
-amb-temp#1-thrs {
-   sensor-id = <0x5096000>;
-   compatible = "ibm,opal-sensor-amb-temp";
-};

-- 
2.40.1



[PATCH v3 3/5] dt-bindings: hwmon: pwm-fan: drop text file

2024-03-22 Thread Javier Carrasco
This binding was converted to dtschema a year ago.

Acked-by: Rob Herring 
Signed-off-by: Javier Carrasco 
---
 Documentation/devicetree/bindings/hwmon/pwm-fan.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.txt 
b/Documentation/devicetree/bindings/hwmon/pwm-fan.txt
deleted file mode 100644
index 48886f0ce415..
--- a/Documentation/devicetree/bindings/hwmon/pwm-fan.txt
+++ /dev/null
@@ -1 +0,0 @@
-This file has moved to pwm-fan.yaml.

-- 
2.40.1



[PATCH v2 5/5] dt-bindings: hwmon: ibm,p8-occ-hwmon: move to trivial devices

2024-03-22 Thread Javier Carrasco
This binding meets the requirements to be converted to dtschema
via trivial-devices.yaml.

Reviewed-by: Rob Herring 
Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt | 25 --
 .../devicetree/bindings/trivial-devices.yaml   |  2 ++
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt 
b/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt
deleted file mode 100644
index 5dc5d2e2573d..
--- a/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Device-tree bindings for I2C-based On-Chip Controller hwmon device
---
-
-Required properties:
- - compatible = "ibm,p8-occ-hwmon";
- - reg = ;: I2C bus address
-
-Examples:
-
-i2c-bus@100 {
-#address-cells = <1>;
-#size-cells = <0>;
-clock-frequency = <10>;
-< more properties >
-
-occ-hwmon@1 {
-compatible = "ibm,p8-occ-hwmon";
-reg = <0x50>;
-};
-
-occ-hwmon@2 {
-compatible = "ibm,p8-occ-hwmon";
-reg = <0x51>;
-};
-};
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml 
b/Documentation/devicetree/bindings/trivial-devices.yaml
index e07be7bf8395..87b0dd9b0734 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -126,6 +126,8 @@ properties:
   - ibm,cffps1
 # IBM Common Form Factor Power Supply Versions 2
   - ibm,cffps2
+# IBM On-Chip Controller hwmon device
+  - ibm,p8-occ-hwmon
 # Infineon barometric pressure and temperature sensor
   - infineon,dps310
 # Infineon IR36021 digital POL buck controller

-- 
2.40.1



[PATCH v2 4/5] dt-bindings: hwmon: stts751: convert to dtschema

2024-03-22 Thread Javier Carrasco
Convert existing binding to support validation.

This is a straightforward conversion with no new properties.

Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/st,stts751.yaml  | 41 ++
 .../devicetree/bindings/hwmon/stts751.txt  | 15 
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/st,stts751.yaml 
b/Documentation/devicetree/bindings/hwmon/st,stts751.yaml
new file mode 100644
index ..9c825adbed58
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/st,stts751.yaml
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/st,stts751.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STTS751 Thermometer
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+const: st,stts751
+
+  reg:
+maxItems: 1
+
+  smbus-timeout-disable:
+description:
+  When set, the smbus timeout function will be disabled.
+$ref: /schemas/types.yaml#/definitions/flag
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+i2c {
+#address-cells = <1>;
+#size-cells = <0>;
+
+thermometer@48 {
+compatible = "st,stts751";
+reg = <0x48>;
+smbus-timeout-disable;
+};
+};
diff --git a/Documentation/devicetree/bindings/hwmon/stts751.txt 
b/Documentation/devicetree/bindings/hwmon/stts751.txt
deleted file mode 100644
index 3ee1dc30e72f..
--- a/Documentation/devicetree/bindings/hwmon/stts751.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-* STTS751 thermometer.
-
-Required node properties:
-- compatible: "stts751"
-- reg: I2C bus address of the device
-
-Optional properties:
-- smbus-timeout-disable: when set, the smbus timeout function will be disabled
-
-Example stts751 node:
-
-temp-sensor {
-   compatible = "stts751";
-   reg = <0x48>;
-}

-- 
2.40.1



[PATCH v2 3/5] dt-bindings: hwmon: pwm-fan: drop text file

2024-03-22 Thread Javier Carrasco
This binding was converted to dtschema a year ago.

Acked-by: Rob Herring 
Signed-off-by: Javier Carrasco 
---
 Documentation/devicetree/bindings/hwmon/pwm-fan.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.txt 
b/Documentation/devicetree/bindings/hwmon/pwm-fan.txt
deleted file mode 100644
index 48886f0ce415..
--- a/Documentation/devicetree/bindings/hwmon/pwm-fan.txt
+++ /dev/null
@@ -1 +0,0 @@
-This file has moved to pwm-fan.yaml.

-- 
2.40.1



[PATCH v2 2/5] dt-bindings: hwmon: ibmpowernv: convert to dtschema

2024-03-22 Thread Javier Carrasco
Convert existing binding to support validation.

This is a straightforward conversion with now new properties.

Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/ibm,powernv.yaml | 37 ++
 .../devicetree/bindings/hwmon/ibmpowernv.txt   | 23 --
 2 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/ibm,powernv.yaml 
b/Documentation/devicetree/bindings/hwmon/ibm,powernv.yaml
new file mode 100644
index ..b26d42bce938
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/ibm,powernv.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/ibm,powernv.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: IBM POWERNV platform sensors
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+enum:
+  - ibm,opal-sensor-cooling-fan
+  - ibm,opal-sensor-amb-temp
+  - ibm,opal-sensor-power-supply
+  - ibm,opal-sensor-power
+
+  sensor-id:
+description:
+  An opaque id provided by the firmware to the kernel, identifies a
+  given sensor and its attribute data.
+$ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+  - compatible
+  - sensor-id
+
+additionalProperties: false
+
+examples:
+  - |
+sensor {
+compatible = "ibm,opal-sensor-cooling-fan";
+sensor-id = <0x7052107>;
+};
diff --git a/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt 
b/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt
deleted file mode 100644
index f93242be60a1..
--- a/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-IBM POWERNV platform sensors
-
-
-Required node properties:
-- compatible: must be one of
-   "ibm,opal-sensor-cooling-fan"
-   "ibm,opal-sensor-amb-temp"
-   "ibm,opal-sensor-power-supply"
-   "ibm,opal-sensor-power"
-- sensor-id: an opaque id provided by the firmware to the kernel, identifies a
-given sensor and its attribute data
-
-Example sensors node:
-
-cooling-fan#8-data {
-   sensor-id = <0x7052107>;
-   compatible = "ibm,opal-sensor-cooling-fan";
-};
-
-amb-temp#1-thrs {
-   sensor-id = <0x5096000>;
-   compatible = "ibm,opal-sensor-amb-temp";
-};

-- 
2.40.1



[PATCH v2 0/5] dt-bindings: hwmon: convert multiple devices to dtschema

2024-03-22 Thread Javier Carrasco
This series converts the following existing bindings to dtschema:

- as370
- ibmpowernv
- stts751
- ibm,p8-occ-hwmon (moved to trivial-devices.yaml)

Additionally, pwm-fan.txt has been dropped because it was converted a
year ago, and it is not mentioned anywhere in the tree.
I could not find the rationale, but its current state does not seem to
provide any valuable information.

The binding of the as370 looks very simple, but given that the reg
property is not a single address, I have written a dedicated file for
it. If reg =  is valid in trivial-devices.yaml, I have
nothing against moving this device as well.

Signed-off-by: Javier Carrasco 
---
Changes in v2:
- ibmpowernv: fix compatible string in the example.
- Link to v1: 
https://lore.kernel.org/r/20240321-hwmon_dtschema-v1-0-96c3810c3...@gmail.com

---
Javier Carrasco (5):
  dt-bindings: hwmon: as370: convert to dtschema
  dt-bindings: hwmon: ibmpowernv: convert to dtschema
  dt-bindings: hwmon: pwm-fan: drop text file
  dt-bindings: hwmon: stts751: convert to dtschema
  dt-bindings: hwmon: ibm,p8-occ-hwmon: move to trivial devices

 Documentation/devicetree/bindings/hwmon/as370.txt  | 11 --
 .../devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt | 25 -
 .../devicetree/bindings/hwmon/ibm,powernv.yaml | 37 +++
 .../devicetree/bindings/hwmon/ibmpowernv.txt   | 23 
 .../devicetree/bindings/hwmon/pwm-fan.txt  |  1 -
 .../devicetree/bindings/hwmon/st,stts751.yaml  | 41 ++
 .../devicetree/bindings/hwmon/stts751.txt  | 15 
 .../devicetree/bindings/hwmon/syna,as370.yaml  | 32 +
 .../devicetree/bindings/trivial-devices.yaml   |  2 ++
 9 files changed, 112 insertions(+), 75 deletions(-)
---
base-commit: ebc9bee8814d12ec247de117aa2f7fd39ff11127
change-id: 20240320-hwmon_dtschema-7f58f49118aa

Best regards,
-- 
Javier Carrasco 



[PATCH v2 1/5] dt-bindings: hwmon: as370: convert to dtschema

2024-03-22 Thread Javier Carrasco
Convert existing binding to support validation.

This is a straightforward conversion with now new properties.

Reviewed-by: Rob Herring 
Signed-off-by: Javier Carrasco 
---
 Documentation/devicetree/bindings/hwmon/as370.txt  | 11 
 .../devicetree/bindings/hwmon/syna,as370.yaml  | 32 ++
 2 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/as370.txt 
b/Documentation/devicetree/bindings/hwmon/as370.txt
deleted file mode 100644
index d102fe765124..
--- a/Documentation/devicetree/bindings/hwmon/as370.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Bindings for Synaptics AS370 PVT sensors
-
-Required properties:
-- compatible : "syna,as370-hwmon"
-- reg: address and length of the register set.
-
-Example:
-   hwmon@ea0810 {
-   compatible = "syna,as370-hwmon";
-   reg = <0xea0810 0xc>;
-   };
diff --git a/Documentation/devicetree/bindings/hwmon/syna,as370.yaml 
b/Documentation/devicetree/bindings/hwmon/syna,as370.yaml
new file mode 100644
index ..1f7005f55247
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/syna,as370.yaml
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/syna,as370.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synaptics AS370 PVT sensors
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+const: syna,as370-hwmon
+
+  reg:
+description:
+  Address and length of the register set.
+maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+sensor@ea0810 {
+compatible = "syna,as370-hwmon";
+reg = <0xea0810 0xc>;
+};

-- 
2.40.1



Re: [PATCH 2/5] dt-bindings: hwmon: ibmpowernv: convert to dtschema

2024-03-21 Thread Javier Carrasco
On 3/21/24 21:45, Rob Herring wrote:
> 
> On Thu, 21 Mar 2024 19:43:43 +0100, Javier Carrasco wrote:
>> Convert existing binding to support validation.
>>
>> This is a straightforward conversion with now new properties.
>>
>> Signed-off-by: Javier Carrasco 
>> ---
>>  .../devicetree/bindings/hwmon/ibm,powernv.yaml | 37 
>> ++
>>  .../devicetree/bindings/hwmon/ibmpowernv.txt   | 23 --
>>  2 files changed, 37 insertions(+), 23 deletions(-)
>>
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Documentation/devicetree/bindings/hwmon/ibm,powernv.example.dtb: 
> /example-0/sensor: failed to match any schema with compatible: ['st,stts751']
> 

Obvious mistake, this compatible belongs to another patch of the series.

Will be fixed for v2.

> doc reference errors (make refcheckdocs):
> 
> See 
> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240321-hwmon_dtschema-v1-2-96c3810c3...@gmail.com
> 
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.
> 

Best regards,
Javier Carrasco


[PATCH 5/5] dt-bindings: hwmon: ibm,p8-occ-hwmon: move to trivial devices

2024-03-21 Thread Javier Carrasco
This binding meets the requirements to be converted to dtschema
via trivial-devices.yaml.

Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt | 25 --
 .../devicetree/bindings/trivial-devices.yaml   |  2 ++
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt 
b/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt
deleted file mode 100644
index 5dc5d2e2573d..
--- a/Documentation/devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Device-tree bindings for I2C-based On-Chip Controller hwmon device
---
-
-Required properties:
- - compatible = "ibm,p8-occ-hwmon";
- - reg = ;: I2C bus address
-
-Examples:
-
-i2c-bus@100 {
-#address-cells = <1>;
-#size-cells = <0>;
-clock-frequency = <10>;
-< more properties >
-
-occ-hwmon@1 {
-compatible = "ibm,p8-occ-hwmon";
-reg = <0x50>;
-};
-
-occ-hwmon@2 {
-compatible = "ibm,p8-occ-hwmon";
-reg = <0x51>;
-};
-};
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml 
b/Documentation/devicetree/bindings/trivial-devices.yaml
index e07be7bf8395..87b0dd9b0734 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -126,6 +126,8 @@ properties:
   - ibm,cffps1
 # IBM Common Form Factor Power Supply Versions 2
   - ibm,cffps2
+# IBM On-Chip Controller hwmon device
+  - ibm,p8-occ-hwmon
 # Infineon barometric pressure and temperature sensor
   - infineon,dps310
 # Infineon IR36021 digital POL buck controller

-- 
2.40.1



[PATCH 4/5] dt-bindings: hwmon: stts751: convert to dtschema

2024-03-21 Thread Javier Carrasco
Convert existing binding to support validation.

This is a straightforward conversion with no new properties.

Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/st,stts751.yaml  | 41 ++
 .../devicetree/bindings/hwmon/stts751.txt  | 15 
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/st,stts751.yaml 
b/Documentation/devicetree/bindings/hwmon/st,stts751.yaml
new file mode 100644
index ..9c825adbed58
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/st,stts751.yaml
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/st,stts751.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STTS751 Thermometer
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+const: st,stts751
+
+  reg:
+maxItems: 1
+
+  smbus-timeout-disable:
+description:
+  When set, the smbus timeout function will be disabled.
+$ref: /schemas/types.yaml#/definitions/flag
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+i2c {
+#address-cells = <1>;
+#size-cells = <0>;
+
+thermometer@48 {
+compatible = "st,stts751";
+reg = <0x48>;
+smbus-timeout-disable;
+};
+};
diff --git a/Documentation/devicetree/bindings/hwmon/stts751.txt 
b/Documentation/devicetree/bindings/hwmon/stts751.txt
deleted file mode 100644
index 3ee1dc30e72f..
--- a/Documentation/devicetree/bindings/hwmon/stts751.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-* STTS751 thermometer.
-
-Required node properties:
-- compatible: "stts751"
-- reg: I2C bus address of the device
-
-Optional properties:
-- smbus-timeout-disable: when set, the smbus timeout function will be disabled
-
-Example stts751 node:
-
-temp-sensor {
-   compatible = "stts751";
-   reg = <0x48>;
-}

-- 
2.40.1



[PATCH 3/5] dt-bindings: hwmon: pwm-fan: drop text file

2024-03-21 Thread Javier Carrasco
This binding was converted to dtschema a year ago.

Signed-off-by: Javier Carrasco 
---
 Documentation/devicetree/bindings/hwmon/pwm-fan.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.txt 
b/Documentation/devicetree/bindings/hwmon/pwm-fan.txt
deleted file mode 100644
index 48886f0ce415..
--- a/Documentation/devicetree/bindings/hwmon/pwm-fan.txt
+++ /dev/null
@@ -1 +0,0 @@
-This file has moved to pwm-fan.yaml.

-- 
2.40.1



[PATCH 0/5] dt-bindings: hwmon: convert multiple devices to dtschema

2024-03-21 Thread Javier Carrasco
This series converts the following existing bindings to dtschema:

- as370
- ibmpowernv
- stts751
- ibm,p8-occ-hwmon (moved to trivial-devices.yaml)

Additionally, pwm-fan.txt has been dropped because it was converted a
year ago, and it is not mentioned anywhere in the tree.
I could not find the rationale, but its current state does not seem to
provide any valuable information.

The binding of the as370 looks very simple, but given that the reg
property is not a single address, I have written a dedicated file for
it. If reg =  is valid in trivial-devices.yaml, I have
nothing against moving this device as well.

Signed-off-by: Javier Carrasco 
---
Javier Carrasco (5):
  dt-bindings: hwmon: as370: convert to dtschema
  dt-bindings: hwmon: ibmpowernv: convert to dtschema
  dt-bindings: hwmon: pwm-fan: drop text file
  dt-bindings: hwmon: stts751: convert to dtschema
  dt-bindings: hwmon: ibm,p8-occ-hwmon: move to trivial devices

 Documentation/devicetree/bindings/hwmon/as370.txt  | 11 --
 .../devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt | 25 -
 .../devicetree/bindings/hwmon/ibm,powernv.yaml | 37 +++
 .../devicetree/bindings/hwmon/ibmpowernv.txt   | 23 
 .../devicetree/bindings/hwmon/pwm-fan.txt  |  1 -
 .../devicetree/bindings/hwmon/st,stts751.yaml  | 41 ++
 .../devicetree/bindings/hwmon/stts751.txt  | 15 
 .../devicetree/bindings/hwmon/syna,as370.yaml  | 32 +
 .../devicetree/bindings/trivial-devices.yaml   |  2 ++
 9 files changed, 112 insertions(+), 75 deletions(-)
---
base-commit: ebc9bee8814d12ec247de117aa2f7fd39ff11127
change-id: 20240320-hwmon_dtschema-7f58f49118aa

Best regards,
-- 
Javier Carrasco 



[PATCH 1/5] dt-bindings: hwmon: as370: convert to dtschema

2024-03-21 Thread Javier Carrasco
Convert existing binding to support validation.

This is a straightforward conversion with now new properties.

Signed-off-by: Javier Carrasco 
---
 Documentation/devicetree/bindings/hwmon/as370.txt  | 11 
 .../devicetree/bindings/hwmon/syna,as370.yaml  | 32 ++
 2 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/as370.txt 
b/Documentation/devicetree/bindings/hwmon/as370.txt
deleted file mode 100644
index d102fe765124..
--- a/Documentation/devicetree/bindings/hwmon/as370.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Bindings for Synaptics AS370 PVT sensors
-
-Required properties:
-- compatible : "syna,as370-hwmon"
-- reg: address and length of the register set.
-
-Example:
-   hwmon@ea0810 {
-   compatible = "syna,as370-hwmon";
-   reg = <0xea0810 0xc>;
-   };
diff --git a/Documentation/devicetree/bindings/hwmon/syna,as370.yaml 
b/Documentation/devicetree/bindings/hwmon/syna,as370.yaml
new file mode 100644
index ..1f7005f55247
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/syna,as370.yaml
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/syna,as370.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synaptics AS370 PVT sensors
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+const: syna,as370-hwmon
+
+  reg:
+description:
+  Address and length of the register set.
+maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+sensor@ea0810 {
+compatible = "syna,as370-hwmon";
+reg = <0xea0810 0xc>;
+};

-- 
2.40.1



[PATCH 2/5] dt-bindings: hwmon: ibmpowernv: convert to dtschema

2024-03-21 Thread Javier Carrasco
Convert existing binding to support validation.

This is a straightforward conversion with now new properties.

Signed-off-by: Javier Carrasco 
---
 .../devicetree/bindings/hwmon/ibm,powernv.yaml | 37 ++
 .../devicetree/bindings/hwmon/ibmpowernv.txt   | 23 --
 2 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/ibm,powernv.yaml 
b/Documentation/devicetree/bindings/hwmon/ibm,powernv.yaml
new file mode 100644
index ..27c949b94c7b
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/ibm,powernv.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/ibm,powernv.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: IBM POWERNV platform sensors
+
+maintainers:
+  - Javier Carrasco 
+
+properties:
+  compatible:
+enum:
+  - ibm,opal-sensor-cooling-fan
+  - ibm,opal-sensor-amb-temp
+  - ibm,opal-sensor-power-supply
+  - ibm,opal-sensor-power
+
+  sensor-id:
+description:
+  An opaque id provided by the firmware to the kernel, identifies a
+  given sensor and its attribute data.
+$ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+  - compatible
+  - sensor-id
+
+additionalProperties: false
+
+examples:
+  - |
+sensor {
+compatible = "st,stts751";
+sensor-id = <0x7052107>;
+};
diff --git a/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt 
b/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt
deleted file mode 100644
index f93242be60a1..
--- a/Documentation/devicetree/bindings/hwmon/ibmpowernv.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-IBM POWERNV platform sensors
-
-
-Required node properties:
-- compatible: must be one of
-   "ibm,opal-sensor-cooling-fan"
-   "ibm,opal-sensor-amb-temp"
-   "ibm,opal-sensor-power-supply"
-   "ibm,opal-sensor-power"
-- sensor-id: an opaque id provided by the firmware to the kernel, identifies a
-given sensor and its attribute data
-
-Example sensors node:
-
-cooling-fan#8-data {
-   sensor-id = <0x7052107>;
-   compatible = "ibm,opal-sensor-cooling-fan";
-};
-
-amb-temp#1-thrs {
-   sensor-id = <0x5096000>;
-   compatible = "ibm,opal-sensor-amb-temp";
-};

-- 
2.40.1