Lines Matching refs:rdev
70 struct cfg802154_registered_device *result = NULL, *rdev; in cfg802154_rdev_by_wpan_phy_idx() local
74 list_for_each_entry(rdev, &cfg802154_rdev_list, list) { in cfg802154_rdev_by_wpan_phy_idx()
75 if (rdev->wpan_phy_idx == wpan_phy_idx) { in cfg802154_rdev_by_wpan_phy_idx()
76 result = rdev; in cfg802154_rdev_by_wpan_phy_idx()
86 struct cfg802154_registered_device *rdev; in wpan_phy_idx_to_wpan_phy() local
90 rdev = cfg802154_rdev_by_wpan_phy_idx(wpan_phy_idx); in wpan_phy_idx_to_wpan_phy()
91 if (!rdev) in wpan_phy_idx_to_wpan_phy()
93 return &rdev->wpan_phy; in wpan_phy_idx_to_wpan_phy()
100 struct cfg802154_registered_device *rdev; in wpan_phy_new() local
103 alloc_size = sizeof(*rdev) + priv_size; in wpan_phy_new()
104 rdev = kzalloc(alloc_size, GFP_KERNEL); in wpan_phy_new()
105 if (!rdev) in wpan_phy_new()
108 rdev->ops = ops; in wpan_phy_new()
110 rdev->wpan_phy_idx = atomic_inc_return(&wpan_phy_counter); in wpan_phy_new()
112 if (unlikely(rdev->wpan_phy_idx < 0)) { in wpan_phy_new()
115 kfree(rdev); in wpan_phy_new()
120 rdev->wpan_phy_idx--; in wpan_phy_new()
122 INIT_LIST_HEAD(&rdev->wpan_dev_list); in wpan_phy_new()
123 device_initialize(&rdev->wpan_phy.dev); in wpan_phy_new()
124 dev_set_name(&rdev->wpan_phy.dev, PHY_NAME "%d", rdev->wpan_phy_idx); in wpan_phy_new()
126 rdev->wpan_phy.dev.class = &wpan_phy_class; in wpan_phy_new()
127 rdev->wpan_phy.dev.platform_data = rdev; in wpan_phy_new()
129 wpan_phy_net_set(&rdev->wpan_phy, &init_net); in wpan_phy_new()
131 init_waitqueue_head(&rdev->dev_wait); in wpan_phy_new()
132 init_waitqueue_head(&rdev->wpan_phy.sync_txq); in wpan_phy_new()
134 spin_lock_init(&rdev->wpan_phy.queue_lock); in wpan_phy_new()
136 return &rdev->wpan_phy; in wpan_phy_new()
142 struct cfg802154_registered_device *rdev = wpan_phy_to_rdev(phy); in wpan_phy_register() local
152 list_add_rcu(&rdev->list, &cfg802154_rdev_list); in wpan_phy_register()
166 struct cfg802154_registered_device *rdev = wpan_phy_to_rdev(phy); in wpan_phy_unregister() local
168 wait_event(rdev->dev_wait, ({ in wpan_phy_unregister()
171 __count = rdev->opencount; in wpan_phy_unregister()
179 WARN_ON(!list_empty(&rdev->wpan_dev_list)); in wpan_phy_unregister()
184 list_del_rcu(&rdev->list); in wpan_phy_unregister()
201 int cfg802154_switch_netns(struct cfg802154_registered_device *rdev, in cfg802154_switch_netns() argument
207 list_for_each_entry(wpan_dev, &rdev->wpan_dev_list, list) { in cfg802154_switch_netns()
219 net = wpan_phy_net(&rdev->wpan_phy); in cfg802154_switch_netns()
222 &rdev->wpan_dev_list, in cfg802154_switch_netns()
236 wpan_phy_net_set(&rdev->wpan_phy, net); in cfg802154_switch_netns()
238 err = device_rename(&rdev->wpan_phy.dev, dev_name(&rdev->wpan_phy.dev)); in cfg802154_switch_netns()
244 void cfg802154_dev_free(struct cfg802154_registered_device *rdev) in cfg802154_dev_free() argument
246 kfree(rdev); in cfg802154_dev_free()
250 cfg802154_update_iface_num(struct cfg802154_registered_device *rdev, in cfg802154_update_iface_num() argument
255 rdev->num_running_ifaces += num; in cfg802154_update_iface_num()
263 struct cfg802154_registered_device *rdev; in cfg802154_netdev_notifier_call() local
268 rdev = wpan_phy_to_rdev(wpan_dev->wpan_phy); in cfg802154_netdev_notifier_call()
276 wpan_dev->identifier = ++rdev->wpan_dev_id; in cfg802154_netdev_notifier_call()
277 list_add_rcu(&wpan_dev->list, &rdev->wpan_dev_list); in cfg802154_netdev_notifier_call()
278 rdev->devlist_generation++; in cfg802154_netdev_notifier_call()
283 cfg802154_update_iface_num(rdev, wpan_dev->iftype, -1); in cfg802154_netdev_notifier_call()
285 rdev->opencount--; in cfg802154_netdev_notifier_call()
286 wake_up(&rdev->dev_wait); in cfg802154_netdev_notifier_call()
289 cfg802154_update_iface_num(rdev, wpan_dev->iftype, 1); in cfg802154_netdev_notifier_call()
291 rdev->opencount++; in cfg802154_netdev_notifier_call()
302 rdev->devlist_generation++; in cfg802154_netdev_notifier_call()
325 struct cfg802154_registered_device *rdev; in cfg802154_pernet_exit() local
328 list_for_each_entry(rdev, &cfg802154_rdev_list, list) { in cfg802154_pernet_exit()
329 if (net_eq(wpan_phy_net(&rdev->wpan_phy), net)) in cfg802154_pernet_exit()
330 WARN_ON(cfg802154_switch_netns(rdev, &init_net)); in cfg802154_pernet_exit()