This source file includes following definitions.
- beacon_timeout_ms_show
 
- beacon_timeout_ms_store
 
- uwb_subsys_init
 
- uwb_subsys_exit
 
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 
  26 
  27 
  28 
  29 
  30 
  31 
  32 
  33 
  34 
  35 #include <linux/kernel.h>
  36 #include <linux/init.h>
  37 #include <linux/module.h>
  38 #include <linux/device.h>
  39 #include <linux/err.h>
  40 #include <linux/kdev_t.h>
  41 #include <linux/random.h>
  42 
  43 #include "uwb-internal.h"
  44 
  45 
  46 
  47 
  48 
  49 
  50 
  51 
  52 
  53 
  54 
  55 
  56 
  57 
  58 
  59 
  60 unsigned long beacon_timeout_ms = 500;
  61 
  62 static
  63 ssize_t beacon_timeout_ms_show(struct class *class,
  64                                 struct class_attribute *attr,
  65                                 char *buf)
  66 {
  67         return scnprintf(buf, PAGE_SIZE, "%lu\n", beacon_timeout_ms);
  68 }
  69 
  70 static
  71 ssize_t beacon_timeout_ms_store(struct class *class,
  72                                 struct class_attribute *attr,
  73                                 const char *buf, size_t size)
  74 {
  75         unsigned long bt;
  76         ssize_t result;
  77         result = sscanf(buf, "%lu", &bt);
  78         if (result != 1)
  79                 return -EINVAL;
  80         beacon_timeout_ms = bt;
  81         return size;
  82 }
  83 static CLASS_ATTR_RW(beacon_timeout_ms);
  84 
  85 static struct attribute *uwb_class_attrs[] = {
  86         &class_attr_beacon_timeout_ms.attr,
  87         NULL,
  88 };
  89 ATTRIBUTE_GROUPS(uwb_class);
  90 
  91 
  92 struct class uwb_rc_class = {
  93         .name        = "uwb_rc",
  94         .class_groups = uwb_class_groups,
  95 };
  96 
  97 
  98 static int __init uwb_subsys_init(void)
  99 {
 100         int result = 0;
 101 
 102         result = uwb_est_create();
 103         if (result < 0) {
 104                 printk(KERN_ERR "uwb: Can't initialize EST subsystem\n");
 105                 goto error_est_init;
 106         }
 107 
 108         result = class_register(&uwb_rc_class);
 109         if (result < 0)
 110                 goto error_uwb_rc_class_register;
 111 
 112         
 113         result = bus_register(&uwb_bus_type);
 114         if (result) {
 115                 pr_err("%s - registering bus driver failed\n", __func__);
 116                 goto exit_bus;
 117         }
 118 
 119         uwb_dbg_init();
 120         return 0;
 121 
 122 exit_bus:
 123         class_unregister(&uwb_rc_class);
 124 error_uwb_rc_class_register:
 125         uwb_est_destroy();
 126 error_est_init:
 127         return result;
 128 }
 129 module_init(uwb_subsys_init);
 130 
 131 static void __exit uwb_subsys_exit(void)
 132 {
 133         uwb_dbg_exit();
 134         bus_unregister(&uwb_bus_type);
 135         class_unregister(&uwb_rc_class);
 136         uwb_est_destroy();
 137         return;
 138 }
 139 module_exit(uwb_subsys_exit);
 140 
 141 MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
 142 MODULE_DESCRIPTION("Ultra Wide Band core");
 143 MODULE_LICENSE("GPL");