Skip to content

Commit 6f3bdbb

Browse files
robherringmpe
authored andcommitted
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: Rob Herring <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 93cfa6f commit 6f3bdbb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/macintosh/smu.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
#include <linux/delay.h>
3434
#include <linux/poll.h>
3535
#include <linux/mutex.h>
36-
#include <linux/of_device.h>
36+
#include <linux/of.h>
37+
#include <linux/of_address.h>
3738
#include <linux/of_irq.h>
3839
#include <linux/of_platform.h>
3940
#include <linux/slab.h>
@@ -470,7 +471,7 @@ EXPORT_SYMBOL(smu_present);
470471
int __init smu_init (void)
471472
{
472473
struct device_node *np;
473-
const u32 *data;
474+
u64 data;
474475
int ret = 0;
475476

476477
np = of_find_node_by_type(NULL, "smu");
@@ -514,8 +515,7 @@ int __init smu_init (void)
514515
ret = -ENXIO;
515516
goto fail_bootmem;
516517
}
517-
data = of_get_property(smu->db_node, "reg", NULL);
518-
if (data == NULL) {
518+
if (of_property_read_reg(smu->db_node, 0, &data, NULL)) {
519519
printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n");
520520
ret = -ENXIO;
521521
goto fail_db_node;
@@ -525,7 +525,7 @@ int __init smu_init (void)
525525
* and ack. GPIOs are at 0x50, best would be to find that out
526526
* in the device-tree though.
527527
*/
528-
smu->doorbell = *data;
528+
smu->doorbell = data;
529529
if (smu->doorbell < 0x50)
530530
smu->doorbell += 0x50;
531531

@@ -534,13 +534,12 @@ int __init smu_init (void)
534534
smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt");
535535
if (smu->msg_node == NULL)
536536
break;
537-
data = of_get_property(smu->msg_node, "reg", NULL);
538-
if (data == NULL) {
537+
if (of_property_read_reg(smu->msg_node, 0, &data, NULL)) {
539538
of_node_put(smu->msg_node);
540539
smu->msg_node = NULL;
541540
break;
542541
}
543-
smu->msg = *data;
542+
smu->msg = data;
544543
if (smu->msg < 0x50)
545544
smu->msg += 0x50;
546545
} while(0);

0 commit comments

Comments
 (0)