static int parse_cpu_cap(struct cr_options *opts, const char *optarg) { bool inverse = false; #define ____cpu_set_cap(__opts, __cap, __inverse) \ do { \ if ((__inverse)) \ (__opts)->cpu_cap &= ~(__cap); \ else \ (__opts)->cpu_cap |= (__cap); \ } while (0) if (!optarg) { ____cpu_set_cap(opts, CPU_CAP_ALL, false); return 0; } while (*optarg) { if (optarg[0] == '^') { inverse = !inverse; optarg++; continue; } else if (optarg[0] == ',') { inverse = false; optarg++; continue; } if (!strncmp(optarg, "fpu", 3)) { ____cpu_set_cap(opts, CPU_CAP_FPU, inverse); optarg += 3; } else if (!strncmp(optarg, "all", 3)) { ____cpu_set_cap(opts, CPU_CAP_ALL, inverse); optarg += 3; } else if (!strncmp(optarg, "none", 4)) { if (inverse) opts->cpu_cap = CPU_CAP_ALL; else opts->cpu_cap = CPU_CAP_NONE; optarg += 4; } else if (!strncmp(optarg, "cpu", 3)) { ____cpu_set_cap(opts, CPU_CAP_CPU, inverse); optarg += 3; } else if (!strncmp(optarg, "ins", 3)) { ____cpu_set_cap(opts, CPU_CAP_INS, inverse); optarg += 3; } else goto Esyntax; } #undef ____cpu_set_cap return 0; Esyntax: pr_err("Unknown FPU mode `%s' selected\n", optarg); return -1; }
static int parse_cpu_cap(struct cr_options *opts, const char *optarg) { bool inverse = false; #define ____cpu_set_cap(__opts, __cap, __inverse) \ do { \ if ((__inverse)) \ (__opts)->cpu_cap &= ~(__cap); \ else \ (__opts)->cpu_cap |= (__cap); \ } while (0) for (; *optarg; optarg++) { if (optarg[0] == '^') { inverse = !inverse; continue; } else if (optarg[0] == ',') { inverse = false; continue; } if (!strncmp(optarg, "fpu", 3)) ____cpu_set_cap(opts, CPU_CAP_FPU, inverse); if (!strncmp(optarg, "all", 3)) ____cpu_set_cap(opts, CPU_CAP_ALL, inverse); else goto Esyntax; } #undef ____cpu_set_cap return 0; Esyntax: pr_err("Unknown FPU mode `%s' selected\n", optarg); return -1; }