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/ioport.h> 12 #include <linux/lockdep.h> 13 #include <linux/pm.h> 14 #include <linux/kobject.h> 15 #include <linux/ratelimit.h> /* dev_printk.h -> ratelimit.h */ 16 #include <linux/module.h> /* via device/driver.h */ 17 18 struct device_node; 19 20 struct bus_type { 21 }; 22 23 struct device_driver { 24 struct device *dev; 25 }; 26 27 struct device_attribute { 28 struct attribute attr; 29 ssize_t (*show)(struct device *, struct device_attribute *, char *); 30 }; 31 32 #define DEVICE_ATTR(_name, _mode, _show, _store) \ 33 struct device_attribute dev_attr_##_name 34 #define DEVICE_ATTR_RO(_name) \ 35 struct device_attribute dev_attr_##_name 36 37 #define device_create_file(a, b) 0 38 #define device_remove_file(a, b) 39 40 void *dev_get_drvdata(struct device *); 41 void dev_set_drvdata(struct device *, void *); 42 43 #define dev_pm_set_driver_flags(x, y) 44 45 #define devm_kzalloc(x, y, z) kzalloc(y, z) 46 #define devm_kfree(x, y) kfree(y) 47 48 static inline int 49 devm_device_add_group(struct device *dev, const struct attribute_group *g) 50 { 51 return 0; 52 } 53 54 #define dev_warn(dev, fmt, arg...) \ 55 printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \ 56 __func__ , ## arg) 57 #define dev_WARN(dev, fmt, arg...) \ 58 WARN(1, "drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \ 59 __func__ , ## arg) 60 #define dev_notice(dev, fmt, arg...) \ 61 printf("drm:pid%d:%s *NOTICE* " fmt, curproc->p_p->ps_pid, \ 62 __func__ , ## arg) 63 #define dev_crit(dev, fmt, arg...) \ 64 printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \ 65 __func__ , ## arg) 66 #define dev_err(dev, fmt, arg...) \ 67 printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \ 68 __func__ , ## arg) 69 #define dev_emerg(dev, fmt, arg...) \ 70 printf("drm:pid%d:%s *EMERGENCY* " fmt, curproc->p_p->ps_pid, \ 71 __func__ , ## arg) 72 #define dev_printk(level, dev, fmt, arg...) \ 73 printf("drm:pid%d:%s *PRINTK* " fmt, curproc->p_p->ps_pid, \ 74 __func__ , ## arg) 75 76 #define dev_warn_ratelimited(dev, fmt, arg...) \ 77 printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \ 78 __func__ , ## arg) 79 #define dev_notice_ratelimited(dev, fmt, arg...) \ 80 printf("drm:pid%d:%s *NOTICE* " fmt, curproc->p_p->ps_pid, \ 81 __func__ , ## arg) 82 #define dev_err_ratelimited(dev, fmt, arg...) \ 83 printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \ 84 __func__ , ## arg) 85 86 #define dev_warn_once(dev, fmt, arg...) \ 87 printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \ 88 __func__ , ## arg) 89 #define dev_WARN_ONCE(dev, cond, fmt, arg...) \ 90 WARN_ONCE(cond, "drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \ 91 __func__ , ## arg) 92 #define dev_err_once(dev, fmt, arg...) \ 93 printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \ 94 __func__ , ## arg) 95 96 #define dev_err_probe(dev, err, fmt, arg...) \ 97 printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \ 98 __func__ , ## arg), err 99 100 #ifdef DRMDEBUG 101 #define dev_info(dev, fmt, arg...) \ 102 printf("drm: " fmt, ## arg) 103 #define dev_info_once(dev, fmt, arg...) \ 104 printf("drm: " fmt, ## arg) 105 #define dev_dbg(dev, fmt, arg...) \ 106 printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid, \ 107 __func__ , ## arg) 108 #define dev_dbg_once(dev, fmt, arg...) \ 109 printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid, \ 110 __func__ , ## arg) 111 #define dev_dbg_ratelimited(dev, fmt, arg...) \ 112 printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid, \ 113 __func__ , ## arg) 114 #else 115 #define dev_info(dev, fmt, arg...) \ 116 do { } while(0) 117 #define dev_info_once(dev, fmt, arg...) \ 118 do { } while(0) 119 #define dev_dbg(dev, fmt, arg...) \ 120 do { } while(0) 121 #define dev_dbg_once(dev, fmt, arg...) \ 122 do { } while(0) 123 #define dev_dbg_ratelimited(dev, fmt, arg...) \ 124 do { } while(0) 125 #endif 126 127 static inline const char * 128 dev_driver_string(struct device *dev) 129 { 130 return dev->dv_cfdata->cf_driver->cd_name; 131 } 132 133 /* XXX return true for thunderbolt/USB4 */ 134 #define dev_is_removable(x) false 135 136 /* should be bus id as string, ie 0000:00:02.0 */ 137 #define dev_name(dev) "" 138 139 static inline void 140 device_set_wakeup_path(struct device *dev) 141 { 142 } 143 144 #endif 145