@@ -44,6 +44,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
struct syscon_reboot_context *ctx;
struct device *dev = &pdev->dev;
int mask_err, value_err;
+ bool is_child = false;
int err;
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
@@ -55,10 +56,14 @@ static int syscon_reboot_probe(struct platform_device *pdev)
ctx->map = syscon_node_to_regmap(dev->parent->of_node);
if (IS_ERR(ctx->map))
return PTR_ERR(ctx->map);
+ is_child = true;
}
- if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset))
- return -EINVAL;
+ if (!is_child ||
+ of_property_read_u32(dev->of_node, "reg", &ctx->offset)) {
+ if (of_property_read_u32(dev->of_node, "offset", &ctx->offset))
+ return -EINVAL;
+ }
value_err = of_property_read_u32(pdev->dev.of_node, "value", &ctx->value);
mask_err = of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask);