[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200803170124.231110-7-paul@crapouillou.net>
Date: Mon, 3 Aug 2020 19:01:17 +0200
From: Paul Cercueil <paul@...pouillou.net>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: Paul Burton <paulburton@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
周琰杰 <zhouyanjie@...yeetech.com>,
od@...c.me, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, Paul Cercueil <paul@...pouillou.net>
Subject: [PATCH 06/13] MIPS: generic: Call the machine's .get_system_type callback if provided
Call the machine's .get_system_type callback in the global
get_system_type() function, if it was provided by the mips_machine
implementation.
The get_system_type() function had to be moved within init.c to be able
to use the static variable "mach". Therefore the proc.c, now empty, has
been removed.
Signed-off-by: Paul Cercueil <paul@...pouillou.net>
---
arch/mips/generic/Makefile | 1 -
arch/mips/generic/init.c | 19 +++++++++++++++++++
arch/mips/generic/proc.c | 25 -------------------------
3 files changed, 19 insertions(+), 26 deletions(-)
delete mode 100644 arch/mips/generic/proc.c
diff --git a/arch/mips/generic/Makefile b/arch/mips/generic/Makefile
index 2384a6b09e4c..f49aeede93c2 100644
--- a/arch/mips/generic/Makefile
+++ b/arch/mips/generic/Makefile
@@ -6,7 +6,6 @@
obj-y += init.o
obj-y += irq.o
-obj-y += proc.o
obj-$(CONFIG_YAMON_DT_SHIM) += yamon-dt.o
obj-$(CONFIG_LEGACY_BOARD_SEAD3) += board-sead3.o
diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
index 805d0135a9f4..7d82b436939e 100644
--- a/arch/mips/generic/init.c
+++ b/arch/mips/generic/init.c
@@ -207,3 +207,22 @@ void __init arch_init_irq(void)
void __init prom_free_prom_memory(void)
{
}
+
+const char *get_system_type(void)
+{
+ const char *str;
+ int err;
+
+ if (mach && mach->get_system_type)
+ return mach->get_system_type(of_root);
+
+ err = of_property_read_string(of_root, "model", &str);
+ if (!err)
+ return str;
+
+ err = of_property_read_string_index(of_root, "compatible", 0, &str);
+ if (!err)
+ return str;
+
+ return "Unknown";
+}
diff --git a/arch/mips/generic/proc.c b/arch/mips/generic/proc.c
deleted file mode 100644
index 4c992809cc3f..000000000000
--- a/arch/mips/generic/proc.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2016 Imagination Technologies
- * Author: Paul Burton <paul.burton@...s.com>
- */
-
-#include <linux/of.h>
-
-#include <asm/bootinfo.h>
-
-const char *get_system_type(void)
-{
- const char *str;
- int err;
-
- err = of_property_read_string(of_root, "model", &str);
- if (!err)
- return str;
-
- err = of_property_read_string_index(of_root, "compatible", 0, &str);
- if (!err)
- return str;
-
- return "Unknown";
-}
--
2.27.0
Powered by blists - more mailing lists