i2c: mpc: Use of_property_read_reg() to parse "reg"
authorRob Herring <robh@kernel.org>
Fri, 9 Jun 2023 18:30:44 +0000 (12:30 -0600)
committerWolfram Sang <wsa@kernel.org>
Wed, 14 Jun 2023 08:36:33 +0000 (10:36 +0200)
Use the recently added of_property_read_reg() helper to get the
untranslated "reg" address value.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-mpc.c

index a308afb3cca5131d980fcc4e7ed0cc8b3c9e2824..fb1b640f33b7bf7cf6788c89898183f78b682f0a 100644 (file)
@@ -316,9 +316,10 @@ static void mpc_i2c_setup_512x(struct device_node *node,
        if (node_ctrl) {
                ctrl = of_iomap(node_ctrl, 0);
                if (ctrl) {
+                       u64 addr;
                        /* Interrupt enable bits for i2c-0/1/2: bit 24/26/28 */
-                       pval = of_get_property(node, "reg", NULL);
-                       idx = (*pval & 0xff) / 0x20;
+                       of_property_read_reg(node, 0, &addr, NULL);
+                       idx = (addr & 0xff) / 0x20;
                        setbits32(ctrl, 1 << (24 + idx * 2));
                        iounmap(ctrl);
                }