diff mbox series

[v3,06/15] MIPS: generic: Allow boards to set system type

Message ID 20200906192935.107086-7-paul@crapouillou.net (mailing list archive)
State Accepted
Commit 8405419942f2f012dc23b5c8817eded2d591b033
Headers show
Series MIPS: Convert Ingenic to a generic board v3 | expand

Commit Message

Paul Cercueil Sept. 6, 2020, 7:29 p.m. UTC
Check for the (already existing) "system_type" variable in the
get_system_type() function. If non-NULL, return it as the system type.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---

Notes:
    v2: Instead of adding a .get_system_type callback to the mips_machine
    	struct, the boards now simply override the "system_type" variable
    	when they want to set a custom one.
    
    v3: No change

 arch/mips/generic/proc.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Philippe Mathieu-Daudé Sept. 8, 2020, 4:27 p.m. UTC | #1
On Sun, Sep 6, 2020 at 9:31 PM Paul Cercueil <paul@crapouillou.net> wrote:
>
> Check for the (already existing) "system_type" variable in the
> get_system_type() function. If non-NULL, return it as the system type.

Nitpick: It is not already "existing", simply declared in asm/bootinfo.h.

>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>
> Notes:
>     v2: Instead of adding a .get_system_type callback to the mips_machine
>         struct, the boards now simply override the "system_type" variable
>         when they want to set a custom one.
>
>     v3: No change
>
>  arch/mips/generic/proc.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/mips/generic/proc.c b/arch/mips/generic/proc.c
> index 4c992809cc3f..cce2fde219a3 100644
> --- a/arch/mips/generic/proc.c
> +++ b/arch/mips/generic/proc.c
> @@ -8,11 +8,16 @@
>
>  #include <asm/bootinfo.h>
>
> +char *system_type;
> +
>  const char *get_system_type(void)
>  {
>         const char *str;
>         int err;
>
> +       if (system_type)
> +               return system_type;
> +
>         err = of_property_read_string(of_root, "model", &str);
>         if (!err)
>                 return str;
> --
> 2.28.0
>
diff mbox series

Patch

diff --git a/arch/mips/generic/proc.c b/arch/mips/generic/proc.c
index 4c992809cc3f..cce2fde219a3 100644
--- a/arch/mips/generic/proc.c
+++ b/arch/mips/generic/proc.c
@@ -8,11 +8,16 @@ 
 
 #include <asm/bootinfo.h>
 
+char *system_type;
+
 const char *get_system_type(void)
 {
 	const char *str;
 	int err;
 
+	if (system_type)
+		return system_type;
+
 	err = of_property_read_string(of_root, "model", &str);
 	if (!err)
 		return str;