ums: fix incorrect mouse button reporting via evdev
[dragonfly.git] / sys / dev / drm / linux_compat.c
blob79a617ef81c5c399764d56b0a9c8551c47e402e8
1 /*-
2 * Copyright (c) 2010 Isilon Systems, Inc.
3 * Copyright (c) 2010 iX Systems, Inc.
4 * Copyright (c) 2010 Panasas, Inc.
5 * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
6 * Copyright (c) 2020 François Tigeot <ftigeot@wolfpond.org>
7 * All rights reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice unmodified, this list of conditions, and the following
14 * disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include <sys/param.h>
32 #include <linux/rbtree.h>
34 int
35 panic_cmp(struct rb_node *one, struct rb_node *two)
37 panic("no cmp");
40 RB_GENERATE(linux_root, rb_node, __entry, panic_cmp);
42 #include <linux/string.h>
43 #include <linux/slab.h>
45 void *
46 kmemdup(const void *src, size_t len, gfp_t gfp)
48 void *dst;
50 dst = kmalloc(len, M_DRM, gfp);
51 if (dst)
52 memcpy(dst, src, len);
53 return (dst);
56 #include <linux/fb.h>
58 struct fb_info *
59 framebuffer_alloc(size_t size, struct device *dev)
61 return kzalloc(sizeof(struct fb_info), GFP_KERNEL);
64 void
65 framebuffer_release(struct fb_info *info)
67 kfree(info);
70 #include <asm/processor.h>
72 struct cpuinfo_x86 boot_cpu_data;
74 static int
75 init_boot_cpu_data(void *arg)
77 boot_cpu_data.x86_clflush_size = cpu_clflush_line_size;
79 return 0;
82 SYSINIT(boot_cpu_data_init, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, init_boot_cpu_data, NULL);
84 #include <linux/sched.h>
86 pid_t get_task_pid(struct task_struct *task, enum pid_type type)
88 if (task->dfly_td == NULL)
89 return -1;
91 if (task->dfly_td->td_proc == NULL)
92 return -1;
94 return task->dfly_td->td_proc->p_pid;
97 #include <linux/mm.h>
99 void
100 si_meminfo(struct sysinfo *si)
102 si->totalram = physmem;
103 si->totalhigh = 0;
104 si->mem_unit = PAGE_SIZE;