drm/rockchip: Don't change hdmi reference clock rate
[drm/drm-misc.git] / tools / perf / trace / beauty / pkey_alloc.c
blobf9596ed02cc4b7e8d691e7b70661399f41ea9261
1 // SPDX-License-Identifier: LGPL-2.1
2 /*
3 * trace/beauty/pkey_alloc.c
5 * Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
6 */
8 #include "trace/beauty/beauty.h"
9 #include <linux/kernel.h>
10 #include <linux/log2.h>
12 size_t strarray__scnprintf_flags(struct strarray *sa, char *bf, size_t size, bool show_prefix, unsigned long flags)
14 int i, printed = 0;
16 if (flags == 0) {
17 const char *s = sa->entries[0];
18 if (s)
19 return scnprintf(bf, size, "%s%s", show_prefix ? sa->prefix : "", s);
20 return scnprintf(bf, size, "%d", 0);
23 for (i = 1; i < sa->nr_entries; ++i) {
24 unsigned long bit = 1UL << (i - 1);
26 if (!(flags & bit))
27 continue;
29 if (printed != 0)
30 printed += scnprintf(bf + printed, size - printed, "|");
32 if (sa->entries[i] != NULL)
33 printed += scnprintf(bf + printed, size - printed, "%s%s", show_prefix ? sa->prefix : "", sa->entries[i]);
34 else
35 printed += scnprintf(bf + printed, size - printed, "0x%#", bit);
38 return printed;
41 static size_t pkey_alloc__scnprintf_access_rights(int access_rights, char *bf, size_t size, bool show_prefix)
43 #include "trace/beauty/generated/pkey_alloc_access_rights_array.c"
44 static DEFINE_STRARRAY(pkey_alloc_access_rights, "PKEY_");
46 return strarray__scnprintf_flags(&strarray__pkey_alloc_access_rights, bf, size, show_prefix, access_rights);
49 size_t syscall_arg__scnprintf_pkey_alloc_access_rights(char *bf, size_t size, struct syscall_arg *arg)
51 unsigned long cmd = arg->val;
53 return pkey_alloc__scnprintf_access_rights(cmd, bf, size, arg->show_string_prefix);