ARM: dma-api: fix max_pfn off-by-one error in __dma_supported()
[linux/fpc-iii.git] / arch / mips / kernel / mips_machine.c
blob4c509641723c41fa9ca144300204eee37c9c8560
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
4 */
5 #include <linux/mm.h>
6 #include <linux/string.h>
7 #include <linux/slab.h>
9 #include <asm/mips_machine.h>
10 #include <asm/prom.h>
12 static struct mips_machine *mips_machine __initdata;
14 #define for_each_machine(mach) \
15 for ((mach) = (struct mips_machine *)&__mips_machines_start; \
16 (mach) && \
17 (unsigned long)(mach) < (unsigned long)&__mips_machines_end; \
18 (mach)++)
20 __init int mips_machtype_setup(char *id)
22 struct mips_machine *mach;
24 for_each_machine(mach) {
25 if (mach->mach_id == NULL)
26 continue;
28 if (strcmp(mach->mach_id, id) == 0) {
29 mips_machtype = mach->mach_type;
30 return 0;
34 pr_err("MIPS: no machine found for id '%s', supported machines:\n", id);
35 pr_err("%-24s %s\n", "id", "name");
36 for_each_machine(mach)
37 pr_err("%-24s %s\n", mach->mach_id, mach->mach_name);
39 return 1;
42 __setup("machtype=", mips_machtype_setup);
44 __init void mips_machine_setup(void)
46 struct mips_machine *mach;
48 for_each_machine(mach) {
49 if (mips_machtype == mach->mach_type) {
50 mips_machine = mach;
51 break;
55 if (!mips_machine)
56 return;
58 mips_set_machine_name(mips_machine->mach_name);
60 if (mips_machine->mach_setup)
61 mips_machine->mach_setup();