xref: /openbsd/sys/dev/pci/drm/include/linux/device.h (revision d89ec533)
1 /* Public domain. */
2 
3 #ifndef _LINUX_DEVICE_H
4 #define _LINUX_DEVICE_H
5 
6 #include <sys/types.h>
7 #include <sys/systm.h>
8 #include <sys/device.h>
9 #include <sys/param.h>
10 #include <sys/proc.h>
11 #include <linux/slab.h>
12 #include <linux/ioport.h>
13 #include <linux/lockdep.h>
14 #include <linux/pm.h>
15 #include <linux/kobject.h>
16 #include <linux/ratelimit.h> /* dev_printk.h -> ratelimit.h */
17 
18 struct device_node;
19 
20 struct device_driver {
21 	struct device *dev;
22 };
23 
24 struct device_attribute {
25 	struct attribute attr;
26 	ssize_t (*show)(struct device *, struct device_attribute *, char *);
27 };
28 
29 #define DEVICE_ATTR(_name, _mode, _show, _store) \
30 	struct device_attribute dev_attr_##_name
31 
32 #define device_create_file(a, b)	0
33 #define device_remove_file(a, b)
34 
35 #define dev_get_drvdata(x)	NULL
36 #define dev_set_drvdata(x, y)
37 
38 #define dev_pm_set_driver_flags(x, y)
39 
40 #define devm_kzalloc(x, y, z)	kzalloc(y, z)
41 
42 #define dev_warn(dev, fmt, arg...)				\
43 	printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid,	\
44 	    __func__ , ## arg)
45 #define dev_notice(dev, fmt, arg...)				\
46 	printf("drm:pid%d:%s *NOTICE* " fmt, curproc->p_p->ps_pid,	\
47 	    __func__ , ## arg)
48 #define dev_crit(dev, fmt, arg...)				\
49 	printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid,	\
50 	    __func__ , ## arg)
51 #define dev_err(dev, fmt, arg...)				\
52 	printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid,	\
53 	    __func__ , ## arg)
54 #define dev_emerg(dev, fmt, arg...)				\
55 	printf("drm:pid%d:%s *EMERGENCY* " fmt, curproc->p_p->ps_pid,	\
56 	    __func__ , ## arg)
57 #define dev_printk(level, dev, fmt, arg...)				\
58 	printf("drm:pid%d:%s *PRINTK* " fmt, curproc->p_p->ps_pid,	\
59 	    __func__ , ## arg)
60 
61 #define dev_warn_ratelimited(dev, fmt, arg...)				\
62 	printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid,	\
63 	    __func__ , ## arg)
64 #define dev_notice_ratelimited(dev, fmt, arg...)			\
65 	printf("drm:pid%d:%s *NOTICE* " fmt, curproc->p_p->ps_pid,	\
66 	    __func__ , ## arg)
67 
68 #define dev_err_once(dev, fmt, arg...)				\
69 	printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid,	\
70 	    __func__ , ## arg)
71 
72 #ifdef DRMDEBUG
73 #define dev_info(dev, fmt, arg...)				\
74 	printf("drm: " fmt, ## arg)
75 #define dev_info_once(dev, fmt, arg...)				\
76 	printf("drm: " fmt, ## arg)
77 #define dev_dbg(dev, fmt, arg...)				\
78 	printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid,	\
79 	    __func__ , ## arg)
80 #else
81 #define dev_info(dev, fmt, arg...) 				\
82 	    do { } while(0)
83 #define dev_info_once(dev, fmt, arg...) 			\
84 	    do { } while(0)
85 #define dev_dbg(dev, fmt, arg...) 				\
86 	    do { } while(0)
87 #endif
88 
89 static inline const char *
90 dev_driver_string(struct device *dev)
91 {
92 	return dev->dv_cfdata->cf_driver->cd_name;
93 }
94 
95 /* should be bus id as string, ie 0000:00:02.0 */
96 #define dev_name(dev)		""
97 
98 #endif
99