xref: /openbsd/sys/dev/pci/drm/include/linux/device.h (revision 905646f0)
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_printk(level, dev, fmt, arg...)				\
55 	printf("drm:pid%d:%s *PRINTK* " fmt, curproc->p_p->ps_pid,	\
56 	    __func__ , ## arg)
57 
58 #define dev_warn_ratelimited(dev, fmt, arg...)				\
59 	printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid,	\
60 	    __func__ , ## arg)
61 #define dev_notice_ratelimited(dev, fmt, arg...)			\
62 	printf("drm:pid%d:%s *NOTICE* " fmt, curproc->p_p->ps_pid,	\
63 	    __func__ , ## arg)
64 
65 #define dev_err_once(dev, fmt, arg...)				\
66 	printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid,	\
67 	    __func__ , ## arg)
68 
69 #ifdef DRMDEBUG
70 #define dev_info(dev, fmt, arg...)				\
71 	printf("drm: " fmt, ## arg)
72 #define dev_dbg(dev, fmt, arg...)				\
73 	printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid,	\
74 	    __func__ , ## arg)
75 #else
76 #define dev_info(dev, fmt, arg...) 				\
77 	    do { } while(0)
78 #define dev_dbg(dev, fmt, arg...) 				\
79 	    do { } while(0)
80 #endif
81 
82 static inline const char *
83 dev_driver_string(struct device *dev)
84 {
85 	return dev->dv_cfdata->cf_driver->cd_name;
86 }
87 
88 /* should be bus id as string, ie 0000:00:02.0 */
89 #define dev_name(dev)		""
90 
91 #endif
92