Lines Matching refs:rc
18 struct uwb_rc *rc = dev_get_drvdata(dev);
20 if (rc->index == *index)
28 struct uwb_rc *rc = NULL;
32 rc = dev_get_drvdata(dev);
33 return rc;
54 struct uwb_rc *rc = container_of(uwb_dev, struct uwb_rc, uwb_dev);
56 uwb_rc_ie_release(rc);
57 kfree(rc);
61 void uwb_rc_init(struct uwb_rc *rc)
63 struct uwb_dev *uwb_dev = &rc->uwb_dev;
66 rc->uwb_dev.dev.class = &uwb_rc_class;
67 rc->uwb_dev.dev.release = uwb_rc_sys_release;
68 uwb_rc_neh_create(rc);
69 rc->beaconing = -1;
70 rc->scan_type = UWB_SCAN_DISABLED;
71 INIT_LIST_HEAD(&rc->notifs_chain.list);
72 mutex_init(&rc->notifs_chain.mutex);
73 INIT_LIST_HEAD(&rc->uwb_beca.list);
74 mutex_init(&rc->uwb_beca.mutex);
75 uwb_drp_avail_init(rc);
76 uwb_rc_ie_init(rc);
77 uwb_rsv_init(rc);
78 uwb_rc_pal_init(rc);
85 struct uwb_rc *rc;
86 rc = kzalloc(sizeof(*rc), GFP_KERNEL);
87 if (rc == NULL)
89 uwb_rc_init(rc);
90 return rc;
108 static int uwb_rc_sys_add(struct uwb_rc *rc)
110 return sysfs_create_group(&rc->uwb_dev.dev.kobj, &rc_attr_group);
114 static void __uwb_rc_sys_rm(struct uwb_rc *rc)
116 sysfs_remove_group(&rc->uwb_dev.dev.kobj, &rc_attr_group);
121 * @rc: the radio controller.
129 int uwb_rc_mac_addr_setup(struct uwb_rc *rc)
132 struct device *dev = &rc->uwb_dev.dev;
133 struct uwb_dev *uwb_dev = &rc->uwb_dev;
137 result = uwb_rc_mac_addr_get(rc, &addr);
147 result = uwb_rc_mac_addr_set(rc, &addr);
161 static int uwb_rc_setup(struct uwb_rc *rc)
164 struct device *dev = &rc->uwb_dev.dev;
166 result = uwb_radio_setup(rc);
171 result = uwb_rc_mac_addr_setup(rc);
176 result = uwb_rc_dev_addr_assign(rc);
181 result = uwb_rc_ie_setup(rc);
186 result = uwb_rsv_setup(rc);
191 uwb_dbg_add_rc(rc);
195 uwb_rc_ie_release(rc);
205 * Did you call uwb_rc_init() on your rc?
212 int uwb_rc_add(struct uwb_rc *rc, struct device *parent_dev, void *priv)
218 rc->index = uwb_rc_new_index();
220 dev = &rc->uwb_dev.dev;
221 dev_set_name(dev, "uwb%d", rc->index);
223 rc->priv = priv;
225 init_waitqueue_head(&rc->uwbd.wq);
226 INIT_LIST_HEAD(&rc->uwbd.event_list);
227 spin_lock_init(&rc->uwbd.event_list_lock);
229 uwbd_start(rc);
231 result = rc->start(rc);
235 result = uwb_rc_setup(rc);
241 result = uwb_dev_add(&rc->uwb_dev, parent_dev, rc);
245 result = uwb_rc_sys_add(rc);
252 uwb_mac_addr_print(macbuf, sizeof(macbuf), &rc->uwb_dev.mac_addr);
253 uwb_dev_addr_print(devbuf, sizeof(devbuf), &rc->uwb_dev.dev_addr);
257 rc->ready = 1;
261 uwb_dev_rm(&rc->uwb_dev);
264 rc->stop(rc);
266 uwbd_stop(rc);
276 return __uwb_dev_offair(uwb_dev, uwb_dev->rc);
282 void uwb_rc_rm(struct uwb_rc *rc)
284 rc->ready = 0;
286 uwb_dbg_del_rc(rc);
287 uwb_rsv_remove_all(rc);
288 uwb_radio_shutdown(rc);
290 rc->stop(rc);
292 uwbd_stop(rc);
293 uwb_rc_neh_destroy(rc);
295 uwb_dev_lock(&rc->uwb_dev);
296 rc->priv = NULL;
297 rc->cmd = NULL;
298 uwb_dev_unlock(&rc->uwb_dev);
299 mutex_lock(&rc->uwb_beca.mutex);
300 uwb_dev_for_each(rc, uwb_dev_offair_helper, NULL);
301 __uwb_rc_sys_rm(rc);
302 mutex_unlock(&rc->uwb_beca.mutex);
303 uwb_rsv_cleanup(rc);
304 uwb_beca_release(rc);
305 uwb_dev_rm(&rc->uwb_dev);
312 struct uwb_rc *rc = dev_get_drvdata(dev);
314 if (rc == NULL) {
318 if (rc == target_rc) {
319 if (rc->ready == 0)
330 * @returns NULL if the rc does not exist or is quiescing; the ptr to
336 struct uwb_rc *rc = NULL;
341 rc = dev_get_drvdata(dev);
342 __uwb_rc_get(rc);
344 return rc;
353 static inline struct uwb_rc *uwb_rc_get(struct uwb_rc *rc)
355 if (rc->ready == 0)
357 uwb_dev_get(&rc->uwb_dev);
358 return rc;
364 struct uwb_rc *rc = dev_get_drvdata(dev);
366 if (rc->uwb_dev.dev.parent->parent == grandpa_dev) {
367 rc = uwb_rc_get(rc);
377 * @returns NULL If the rc does not exist or is quiescing; the ptr to
392 struct uwb_rc *rc = NULL;
397 rc = dev_get_drvdata(dev);
398 return rc;
410 struct uwb_rc *rc = dev_get_drvdata(dev);
412 if (rc == NULL) {
416 if (!uwb_dev_addr_cmp(&rc->uwb_dev.dev_addr, addr)) {
417 rc = uwb_rc_get(rc);
426 struct uwb_rc *rc = NULL;
431 rc = dev_get_drvdata(dev);
433 return rc;
443 void uwb_rc_put(struct uwb_rc *rc)
445 __uwb_rc_put(rc);