Commit 09f16612 authored by Andrew Davis's avatar Andrew Davis Committed by Philipp Zabel
Browse files

reset: lpc18xx: Use devm_register_sys_off_handler()



Function register_restart_handler() is deprecated. Using this new API
removes our need to keep and manage a struct notifier_block and to
later unregister the handler.

Signed-off-by: default avatarAndrew Davis <afd@ti.com>
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 8bfef0c2
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@

struct lpc18xx_rgu_data {
	struct reset_controller_dev rcdev;
	struct notifier_block restart_nb;
	struct clk *clk_delay;
	struct clk *clk_reg;
	void __iomem *base;
@@ -41,11 +40,9 @@ struct lpc18xx_rgu_data {

#define to_rgu_data(p) container_of(p, struct lpc18xx_rgu_data, rcdev)

static int lpc18xx_rgu_restart(struct notifier_block *nb, unsigned long mode,
			       void *cmd)
static int lpc18xx_rgu_restart(struct sys_off_data *data)
{
	struct lpc18xx_rgu_data *rc = container_of(nb, struct lpc18xx_rgu_data,
						   restart_nb);
	struct lpc18xx_rgu_data *rc = data->cb_data;

	writel(BIT(LPC18XX_RGU_CORE_RST), rc->base + LPC18XX_RGU_CTRL0);
	mdelay(2000);
@@ -178,9 +175,8 @@ static int lpc18xx_rgu_probe(struct platform_device *pdev)
	if (ret)
		return dev_err_probe(&pdev->dev, ret, "unable to register device\n");

	rc->restart_nb.priority = 192,
	rc->restart_nb.notifier_call = lpc18xx_rgu_restart,
	ret = register_restart_handler(&rc->restart_nb);
	ret = devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART, 192,
					    lpc18xx_rgu_restart, rc);
	if (ret)
		dev_warn(&pdev->dev, "failed to register restart handler\n");