summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2019-08-25 17:58:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-08-28 13:33:42 +0200
commit935446094311ccbc6888dc2dbe238b764a8e073e (patch)
tree325c999d1d692de382b6b6803daec0e8ed0b6f8c
parent06a912b046aa0661f6eae29ea26bc883d5d6041b (diff)
downloadbarebox-935446094311ccbc6888dc2dbe238b764a8e073e.tar.gz
reset_source: drop reset_source_set_instance()
The semantic of reset_source_set_instance() required a separate call to reset_source_set() (or reset_source_set_priority()) and checked right usage only using the type. Make the set of functions a bit easier to use by dropping reset_source_set_instance() and instead introduce a function that can set all relevant parameters (source, priority and instance) in one go. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-imx/imx.c4
-rw-r--r--common/reset_source.c15
-rw-r--r--drivers/watchdog/stm32_iwdg.c3
-rw-r--r--include/reset_source.h14
4 files changed, 16 insertions, 20 deletions
diff --git a/arch/arm/mach-imx/imx.c b/arch/arm/mach-imx/imx.c
index 63914d3..43b540b 100644
--- a/arch/arm/mach-imx/imx.c
+++ b/arch/arm/mach-imx/imx.c
@@ -199,9 +199,7 @@ void imx_set_reset_reason(void __iomem *srsr,
}
}
- reset_source_set_priority(type,
- RESET_SOURCE_DEFAULT_PRIORITY);
- reset_source_set_instance(type, instance);
+ reset_source_set_prinst(type, RESET_SOURCE_DEFAULT_PRIORITY, instance);
pr_info("i.MX reset reason %s (SRSR: 0x%08x)\n",
reset_source_name(), reg);
diff --git a/common/reset_source.c b/common/reset_source.c
index f400112..f32b4ea 100644
--- a/common/reset_source.c
+++ b/common/reset_source.c
@@ -53,26 +53,20 @@ int reset_source_get_instance(void)
}
EXPORT_SYMBOL(reset_source_get_instance);
-void reset_source_set_priority(enum reset_src_type st, unsigned int priority)
+void reset_source_set_prinst(enum reset_src_type st,
+ unsigned int priority, int instance)
{
if (priority <= reset_source_priority)
return;
reset_source = st;
reset_source_priority = priority;
- reset_source_instance = -1;
+ reset_source_instance = instance;
pr_debug("Setting reset source to %s with priority %d\n",
reset_src_names[reset_source], priority);
}
-EXPORT_SYMBOL(reset_source_set_priority);
-
-void reset_source_set_instance(enum reset_src_type type, int instance)
-{
- if (reset_source == type)
- reset_source_instance = instance;
-}
-EXPORT_SYMBOL(reset_source_set_instance);
+EXPORT_SYMBOL(reset_source_set_prinst);
static int reset_source_init(void)
{
@@ -83,7 +77,6 @@ static int reset_source_init(void)
"%d");
return 0;
}
-
coredevice_initcall(reset_source_init);
/**
diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
index 7c2dc07..20536cb 100644
--- a/drivers/watchdog/stm32_iwdg.c
+++ b/drivers/watchdog/stm32_iwdg.c
@@ -182,8 +182,7 @@ static int stm32_set_reset_reason(struct regmap *rcc)
}
}
- reset_source_set_priority(type, RESET_SOURCE_DEFAULT_PRIORITY);
- reset_source_set_instance(type, instance);
+ reset_source_set_prinst(type, RESET_SOURCE_DEFAULT_PRIORITY, instance);
pr_info("STM32 RCC reset reason %s (MP_RSTSR: 0x%08x)\n",
reset_source_name(), reg);
diff --git a/include/reset_source.h b/include/reset_source.h
index 85329c8..22c51a0 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -31,8 +31,8 @@ enum reset_src_type reset_source_get(void);
const char *reset_source_name(void);
int reset_source_get_instance(void);
-void reset_source_set_priority(enum reset_src_type, unsigned int priority);
-void reset_source_set_instance(enum reset_src_type type, int instance);
+void reset_source_set_prinst(enum reset_src_type,
+ unsigned int priority, int instance);
unsigned int of_get_reset_source_priority(struct device_node *node);
@@ -53,8 +53,8 @@ static inline int reset_source_get_instance(void)
return -1;
}
-static inline void reset_source_set_priority(enum reset_src_type type,
- unsigned int priority)
+static inline void reset_source_set_prinst(enum reset_src_type type,
+ unsigned int priority, int instance)
{
}
@@ -70,6 +70,12 @@ static inline unsigned int of_get_reset_source_priority(struct device_node *node
#define RESET_SOURCE_DEFAULT_PRIORITY 100
+static inline void reset_source_set_priority(enum reset_src_type type,
+ unsigned int priority)
+{
+ reset_source_set_prinst(type, priority, -1);
+}
+
static inline void reset_source_set(enum reset_src_type type)
{
reset_source_set_priority(type, RESET_SOURCE_DEFAULT_PRIORITY);