Skip to content

Commit a4ceaab

Browse files
glneosre
authored andcommitted
power: reset: brcmstb: Use syscon_regmap_lookup_by_phandle_args() helper
Simplify probe by fetching the regmap and its arguments in one call. Signed-off-by: Andrew Davis <[email protected]> Reviewed-by: Dhruva Gole <[email protected]> Acked-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]>
1 parent cf37f16 commit a4ceaab

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

drivers/power/reset/brcmstb-reboot.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#include <linux/smp.h>
1919
#include <linux/mfd/syscon.h>
2020

21-
#define RESET_SOURCE_ENABLE_REG 1
22-
#define SW_MASTER_RESET_REG 2
23-
2421
static struct regmap *regmap;
2522
static u32 rst_src_en;
2623
static u32 sw_mstr_rst;
@@ -87,32 +84,21 @@ static int brcmstb_reboot_probe(struct platform_device *pdev)
8784
{
8885
int rc;
8986
struct device_node *np = pdev->dev.of_node;
87+
unsigned int args[2];
9088

9189
reset_masks = device_get_match_data(&pdev->dev);
9290
if (!reset_masks) {
9391
pr_err("failed to get match data\n");
9492
return -EINVAL;
9593
}
9694

97-
regmap = syscon_regmap_lookup_by_phandle(np, "syscon");
95+
regmap = syscon_regmap_lookup_by_phandle_args(np, "syscon", ARRAY_SIZE(args), args);
9896
if (IS_ERR(regmap)) {
9997
pr_err("failed to get syscon phandle\n");
10098
return -EINVAL;
10199
}
102-
103-
rc = of_property_read_u32_index(np, "syscon", RESET_SOURCE_ENABLE_REG,
104-
&rst_src_en);
105-
if (rc) {
106-
pr_err("can't get rst_src_en offset (%d)\n", rc);
107-
return -EINVAL;
108-
}
109-
110-
rc = of_property_read_u32_index(np, "syscon", SW_MASTER_RESET_REG,
111-
&sw_mstr_rst);
112-
if (rc) {
113-
pr_err("can't get sw_mstr_rst offset (%d)\n", rc);
114-
return -EINVAL;
115-
}
100+
rst_src_en = args[0];
101+
sw_mstr_rst = args[1];
116102

117103
rc = register_restart_handler(&brcmstb_restart_nb);
118104
if (rc)

0 commit comments

Comments
 (0)