Merge tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / perf / trace / beauty / drm_ioctl.sh
blob9aa94fd523a9c2ddddf14f6dbd3790b559d78ee6
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1
4 [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/drm/
6 printf "#ifndef DRM_COMMAND_BASE\n"
7 grep "#define DRM_COMMAND_BASE" $header_dir/drm.h
8 printf "#endif\n"
10 printf "static const char *drm_ioctl_cmds[] = {\n"
11 grep "^#define DRM_IOCTL.*DRM_IO" $header_dir/drm.h | \
12 sed -r 's/^#define +DRM_IOCTL_([A-Z0-9_]+)[ ]+DRM_IO[A-Z]* *\( *(0x[[:xdigit:]]+),*.*/ [\2] = "\1",/g'
13 grep "^#define DRM_I915_[A-Z_0-9]\+[ ]\+0x" $header_dir/i915_drm.h | \
14 sed -r 's/^#define +DRM_I915_([A-Z0-9_]+)[ ]+(0x[[:xdigit:]]+)/\t[DRM_COMMAND_BASE + \2] = "I915_\1",/g'
15 printf "};\n"