Skip to content

Commit

Permalink
power: reset: brcmstb: Use device_get_match_data() for matching
Browse files Browse the repository at this point in the history
Use device_get_match_data() for finding the matching node and fetching
the match data all in one.

Signed-off-by: Andrew Davis <[email protected]>
Acked-by: Florian Fainelli <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sebastian Reichel <[email protected]>
  • Loading branch information
glneo authored and sre committed Aug 27, 2024
1 parent 0174d12 commit cf37f16
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions drivers/power/reset/brcmstb-reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,16 @@ static const struct reset_reg_mask reset_bits_65nm = {
.sw_mstr_rst_mask = BIT(31),
};

static const struct of_device_id of_match[] = {
{ .compatible = "brcm,brcmstb-reboot", .data = &reset_bits_40nm },
{ .compatible = "brcm,bcm7038-reboot", .data = &reset_bits_65nm },
{},
};

static int brcmstb_reboot_probe(struct platform_device *pdev)
{
int rc;
struct device_node *np = pdev->dev.of_node;
const struct of_device_id *of_id;

of_id = of_match_node(of_match, np);
if (!of_id) {
pr_err("failed to look up compatible string\n");
reset_masks = device_get_match_data(&pdev->dev);
if (!reset_masks) {
pr_err("failed to get match data\n");
return -EINVAL;
}
reset_masks = of_id->data;

regmap = syscon_regmap_lookup_by_phandle(np, "syscon");
if (IS_ERR(regmap)) {
Expand Down Expand Up @@ -130,6 +122,12 @@ static int brcmstb_reboot_probe(struct platform_device *pdev)
return rc;
}

static const struct of_device_id of_match[] = {
{ .compatible = "brcm,brcmstb-reboot", .data = &reset_bits_40nm },
{ .compatible = "brcm,bcm7038-reboot", .data = &reset_bits_65nm },
{},
};

static struct platform_driver brcmstb_reboot_driver = {
.probe = brcmstb_reboot_probe,
.driver = {
Expand Down

0 comments on commit cf37f16

Please sign in to comment.