Files
android_kernel_xiaomi_sm8450/include/uapi/linux
David Howells 9607871f37 UAPI: ndctl: Fix g++-unsupported initialisation in headers
The following code in the linux/ndctl header file:

	static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
	{
		static const char * const names[] = {
			[ND_CMD_ARS_CAP] = "ars_cap",
			[ND_CMD_ARS_START] = "ars_start",
			[ND_CMD_ARS_STATUS] = "ars_status",
			[ND_CMD_CLEAR_ERROR] = "clear_error",
			[ND_CMD_CALL] = "cmd_call",
		};

		if (cmd < ARRAY_SIZE(names) && names[cmd])
			return names[cmd];
		return "unknown";
	}

is broken in a number of ways:

 (1) ARRAY_SIZE() is not generally defined.

 (2) g++ does not support "non-trivial" array initialisers fully yet.

 (3) Every file that calls this function will acquire a copy of names[].

The same goes for nvdimm_cmd_name().

Fix all three by converting to a switch statement where each case returns a
string.  That way if cmd is a constant, the compiler can trivially reduce it
and, if not, the compiler can use a shared lookup table if it thinks that is
more efficient.

A better way would be to remove these functions and their arrays from the
header entirely.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2018-10-17 13:56:54 -07:00
..
2018-07-23 19:18:10 +01:00
2018-08-06 10:24:33 +02:00
2018-08-22 10:52:49 -07:00
2018-07-25 06:59:23 -04:00
2018-07-19 13:58:44 -07:00
2018-06-18 15:11:53 +10:00
2018-07-17 15:33:47 +02:00
2018-07-07 17:41:38 +02:00
2018-08-03 10:03:57 -07:00
2017-11-28 16:54:00 +01:00
2018-04-11 10:28:37 -07:00
2018-03-05 10:43:37 -05:00
2018-01-14 23:06:30 -05:00
2018-01-16 16:47:29 +01:00
2018-08-15 14:59:06 -05:00
2018-07-24 14:44:00 -07:00
2018-06-15 18:10:01 -03:00
2018-02-06 22:53:56 +00:00
2018-05-31 00:13:56 +08:00
2018-03-20 03:17:41 +02:00
2018-04-14 11:59:31 -04:00
2017-11-24 10:18:41 +00:00
2017-11-16 10:49:00 +09:00
2018-04-11 10:28:37 -07:00
2018-04-11 10:28:37 -07:00
2018-04-26 15:08:04 -04:00
2018-02-06 18:32:44 -08:00
2018-03-26 13:22:58 -06:00
2016-12-16 00:13:32 +02:00