summaryrefslogtreecommitdiffstats
path: root/drivers/misc/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/state.c')
-rw-r--r--drivers/misc/state.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/misc/state.c b/drivers/misc/state.c
index d7e385d0b5..05b02aa91d 100644
--- a/drivers/misc/state.c
+++ b/drivers/misc/state.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2013 Sascha Hauer <s.hauer@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <common.h>
@@ -21,9 +12,9 @@
#include <linux/err.h>
-static int state_probe(struct device_d *dev)
+static int state_probe(struct device *dev)
{
- struct device_node *np = dev->device_node;
+ struct device_node *np = dev->of_node;
struct state *state;
bool readonly = false;
int ret;
@@ -37,7 +28,9 @@ static int state_probe(struct device_d *dev)
}
ret = state_load(state);
- if (ret)
+ if (ret == -ENOMEDIUM)
+ dev_info(dev, "Fresh state detected, continuing with defaults\n");
+ else if (ret)
dev_warn(dev, "Failed to load persistent state, continuing with defaults, %d\n",
ret);
@@ -51,8 +44,9 @@ static __maybe_unused struct of_device_id state_ids[] = {
/* sentinel */
}
};
+MODULE_DEVICE_TABLE(of, state_ids);
-static struct driver_d state_driver = {
+static struct driver state_driver = {
.name = "state",
.probe = state_probe,
.of_compatible = DRV_OF_COMPAT(state_ids),