Linux Audio

Check our new training course

Loading...
v4.6
 
 1/*
 2 *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
 3 *
 4 *  This program is free software; you can redistribute it and/or modify it
 5 *  under the terms of the GNU General Public License version 2 as published
 6 *  by the Free Software Foundation.
 7 *
 8 */
 9#include <linux/mm.h>
10#include <linux/string.h>
11#include <linux/slab.h>
12
13#include <asm/mips_machine.h>
14#include <asm/prom.h>
15
16static struct mips_machine *mips_machine __initdata;
17
18#define for_each_machine(mach) \
19	for ((mach) = (struct mips_machine *)&__mips_machines_start; \
20	     (mach) && \
21	     (unsigned long)(mach) < (unsigned long)&__mips_machines_end; \
22	     (mach)++)
23
24__init int mips_machtype_setup(char *id)
25{
26	struct mips_machine *mach;
27
28	for_each_machine(mach) {
29		if (mach->mach_id == NULL)
30			continue;
31
32		if (strcmp(mach->mach_id, id) == 0) {
33			mips_machtype = mach->mach_type;
34			return 0;
35		}
36	}
37
38	pr_err("MIPS: no machine found for id '%s', supported machines:\n", id);
39	pr_err("%-24s %s\n", "id", "name");
40	for_each_machine(mach)
41		pr_err("%-24s %s\n", mach->mach_id, mach->mach_name);
42
43	return 1;
44}
45
46__setup("machtype=", mips_machtype_setup);
47
48__init void mips_machine_setup(void)
49{
50	struct mips_machine *mach;
51
52	for_each_machine(mach) {
53		if (mips_machtype == mach->mach_type) {
54			mips_machine = mach;
55			break;
56		}
57	}
58
59	if (!mips_machine)
60		return;
61
62	mips_set_machine_name(mips_machine->mach_name);
63
64	if (mips_machine->mach_setup)
65		mips_machine->mach_setup();
66}
v5.4
 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>
 8
 9#include <asm/mips_machine.h>
10#include <asm/prom.h>
11
12static struct mips_machine *mips_machine __initdata;
13
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)++)
19
20__init int mips_machtype_setup(char *id)
21{
22	struct mips_machine *mach;
23
24	for_each_machine(mach) {
25		if (mach->mach_id == NULL)
26			continue;
27
28		if (strcmp(mach->mach_id, id) == 0) {
29			mips_machtype = mach->mach_type;
30			return 0;
31		}
32	}
33
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);
38
39	return 1;
40}
41
42__setup("machtype=", mips_machtype_setup);
43
44__init void mips_machine_setup(void)
45{
46	struct mips_machine *mach;
47
48	for_each_machine(mach) {
49		if (mips_machtype == mach->mach_type) {
50			mips_machine = mach;
51			break;
52		}
53	}
54
55	if (!mips_machine)
56		return;
57
58	mips_set_machine_name(mips_machine->mach_name);
59
60	if (mips_machine->mach_setup)
61		mips_machine->mach_setup();
62}