Commit 6f3bdbbe authored by Rob Herring's avatar Rob Herring Committed by Michael Ellerman

macintosh: 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: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230609182926.1763589-1-robh@kernel.org
parent 93cfa6fb
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/of_device.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -470,7 +471,7 @@ EXPORT_SYMBOL(smu_present); ...@@ -470,7 +471,7 @@ EXPORT_SYMBOL(smu_present);
int __init smu_init (void) int __init smu_init (void)
{ {
struct device_node *np; struct device_node *np;
const u32 *data; u64 data;
int ret = 0; int ret = 0;
np = of_find_node_by_type(NULL, "smu"); np = of_find_node_by_type(NULL, "smu");
...@@ -514,8 +515,7 @@ int __init smu_init (void) ...@@ -514,8 +515,7 @@ int __init smu_init (void)
ret = -ENXIO; ret = -ENXIO;
goto fail_bootmem; goto fail_bootmem;
} }
data = of_get_property(smu->db_node, "reg", NULL); if (of_property_read_reg(smu->db_node, 0, &data, NULL)) {
if (data == NULL) {
printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n"); printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n");
ret = -ENXIO; ret = -ENXIO;
goto fail_db_node; goto fail_db_node;
...@@ -525,7 +525,7 @@ int __init smu_init (void) ...@@ -525,7 +525,7 @@ int __init smu_init (void)
* and ack. GPIOs are at 0x50, best would be to find that out * and ack. GPIOs are at 0x50, best would be to find that out
* in the device-tree though. * in the device-tree though.
*/ */
smu->doorbell = *data; smu->doorbell = data;
if (smu->doorbell < 0x50) if (smu->doorbell < 0x50)
smu->doorbell += 0x50; smu->doorbell += 0x50;
...@@ -534,13 +534,12 @@ int __init smu_init (void) ...@@ -534,13 +534,12 @@ int __init smu_init (void)
smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt"); smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt");
if (smu->msg_node == NULL) if (smu->msg_node == NULL)
break; break;
data = of_get_property(smu->msg_node, "reg", NULL); if (of_property_read_reg(smu->msg_node, 0, &data, NULL)) {
if (data == NULL) {
of_node_put(smu->msg_node); of_node_put(smu->msg_node);
smu->msg_node = NULL; smu->msg_node = NULL;
break; break;
} }
smu->msg = *data; smu->msg = data;
if (smu->msg < 0x50) if (smu->msg < 0x50)
smu->msg += 0x50; smu->msg += 0x50;
} while(0); } while(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment