Messages in this thread | | | Date | Tue, 11 Aug 2020 14:43:10 +0200 | From | Paul Cercueil <> | Subject | Re: [PATCH 06/13] MIPS: generic: Call the machine's .get_system_type callback if provided |
| |
Le lun. 3 août 2020 à 19:01, Paul Cercueil <paul@crapouillou.net> a écrit : > 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@crapouillou.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);
The 'mach' variable is __initconst, so there's a section violation right here. I'll send a V2.
-Paul
> + > + 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@mips.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 >
| |