Skip to content

Commit 9d178e0

Browse files
robherringwsakernel
authored andcommitted
i2c: mpc: Use of_property_read_reg() to parse "reg"
Use the recently added of_property_read_reg() helper to get the untranslated "reg" address value. Signed-off-by: Rob Herring <[email protected]> Acked-by: Andi Shyti <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent c21a17b commit 9d178e0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/i2c/busses/i2c-mpc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,10 @@ static void mpc_i2c_setup_512x(struct device_node *node,
316316
if (node_ctrl) {
317317
ctrl = of_iomap(node_ctrl, 0);
318318
if (ctrl) {
319+
u64 addr;
319320
/* Interrupt enable bits for i2c-0/1/2: bit 24/26/28 */
320-
pval = of_get_property(node, "reg", NULL);
321-
idx = (*pval & 0xff) / 0x20;
321+
of_property_read_reg(node, 0, &addr, NULL);
322+
idx = (addr & 0xff) / 0x20;
322323
setbits32(ctrl, 1 << (24 + idx * 2));
323324
iounmap(ctrl);
324325
}

0 commit comments

Comments
 (0)