Skip to content

Commit cba266a

Browse files
miquelraynalsre
authored andcommitted
power: reset: at91-reset: change the power on reason prototype
It is quite uncommon to use a driver helper with parameters like *pdev and __iomem *base. It is much cleaner and close to today's standards to provide the per-device driver structure and then access its internals. Let's do this with the helper which returns the power on reason. While we change the parameters, we can as well rename the function from at91_reset_status() to at91_reset_reason() to be more accurate with what the helper actually does, and finally because we don't really need the pdev argument in this helper besides for printing the reset reason, we can move the dev_info() call into the probe. All these modifications prepare the introduction of a sysfs entry to access this information. This way the diff will be much smaller. Thus, there is no intended functional change. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 4dea2fd commit cba266a

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/power/reset/at91-reset.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,10 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
149149
return NOTIFY_DONE;
150150
}
151151

152-
static void __init at91_reset_status(struct platform_device *pdev,
153-
void __iomem *base)
152+
static const char * __init at91_reset_reason(struct at91_reset *reset)
154153
{
154+
u32 reg = readl(reset->rstc_base + AT91_RSTC_SR);
155155
const char *reason;
156-
u32 reg = readl(base + AT91_RSTC_SR);
157156

158157
switch ((reg & AT91_RSTC_RSTTYP) >> 8) {
159158
case RESET_TYPE_GENERAL:
@@ -185,7 +184,7 @@ static void __init at91_reset_status(struct platform_device *pdev,
185184
break;
186185
}
187186

188-
dev_info(&pdev->dev, "Starting after %s\n", reason);
187+
return reason;
189188
}
190189

191190
static const struct of_device_id at91_ramc_of_match[] = {
@@ -392,7 +391,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
392391
if (ret)
393392
goto disable_clk;
394393

395-
at91_reset_status(pdev, reset->rstc_base);
394+
dev_info(&pdev->dev, "Starting after %s\n", at91_reset_reason(reset));
396395

397396
return 0;
398397

0 commit comments

Comments
 (0)