Re: [v5 PATCH] RISC-V: Fix unsupported isa string info.

From: Christoph Hellwig
Date: Mon Aug 12 2019 - 11:02:18 EST


> + for (e = mandatory_ext; *e != '\0'; ++e) {
> + if (isa[0] != e[0]) {
> +#if defined(CONFIG_FP)
> + if ((isa[0] == 'f') || (isa[0] == 'd'))
> + continue;
> +#endif
> + unsupported_isa[index] = e[0];
> + index++;
> + }

I'd just use if (IS_ENABLED()) here to get full compiler coverage.
Also no need for the inner braces.

> + if (isa[0] != '\0') {
> + /* Add remainging isa strings */
> + for (e = isa; *e != '\0'; ++e) {
> +#if !defined(CONFIG_VIRTUALIZATION)
> + if (e[0] != 'h')
> +#endif
> + seq_write(f, e, 1);
> + }
> + }

This one I don't get. Why do we want to check CONFIG_VIRTUALIZATION?

> seq_puts(f, "\n");
>
> /*
> * If we were given an unsupported ISA in the device tree then print
> * a bit of info describing what went wrong.
> */
> - if (isa[0] != '\0')
> - pr_info("unsupported ISA \"%s\" in device tree\n", orig_isa);
> + if (unsupported_isa[0])
> + pr_info("unsupported ISA extensions \"%s\" in device tree for cpu [%ld]\n",
> + unsupported_isa, cpuid);

And I'm not even sure why we care about unsupported extensions. Sooner
or late a few will op up and they should be harmless.