Lines Matching refs:rdev
84 struct cfg802154_registered_device *result = NULL, *rdev; in cfg802154_rdev_by_wpan_phy_idx() local
88 list_for_each_entry(rdev, &cfg802154_rdev_list, list) { in cfg802154_rdev_by_wpan_phy_idx()
89 if (rdev->wpan_phy_idx == wpan_phy_idx) { in cfg802154_rdev_by_wpan_phy_idx()
90 result = rdev; in cfg802154_rdev_by_wpan_phy_idx()
102 struct cfg802154_registered_device *rdev; in wpan_phy_new() local
105 alloc_size = sizeof(*rdev) + priv_size; in wpan_phy_new()
106 rdev = kzalloc(alloc_size, GFP_KERNEL); in wpan_phy_new()
107 if (!rdev) in wpan_phy_new()
110 rdev->ops = ops; in wpan_phy_new()
112 rdev->wpan_phy_idx = atomic_inc_return(&wpan_phy_counter); in wpan_phy_new()
114 if (unlikely(rdev->wpan_phy_idx < 0)) { in wpan_phy_new()
117 kfree(rdev); in wpan_phy_new()
122 rdev->wpan_phy_idx--; in wpan_phy_new()
124 mutex_init(&rdev->wpan_phy.pib_lock); in wpan_phy_new()
126 INIT_LIST_HEAD(&rdev->wpan_dev_list); in wpan_phy_new()
127 device_initialize(&rdev->wpan_phy.dev); in wpan_phy_new()
128 dev_set_name(&rdev->wpan_phy.dev, PHY_NAME "%d", rdev->wpan_phy_idx); in wpan_phy_new()
130 rdev->wpan_phy.dev.class = &wpan_phy_class; in wpan_phy_new()
131 rdev->wpan_phy.dev.platform_data = rdev; in wpan_phy_new()
133 init_waitqueue_head(&rdev->dev_wait); in wpan_phy_new()
135 return &rdev->wpan_phy; in wpan_phy_new()
141 struct cfg802154_registered_device *rdev = wpan_phy_to_rdev(phy); in wpan_phy_register() local
151 list_add_rcu(&rdev->list, &cfg802154_rdev_list); in wpan_phy_register()
165 struct cfg802154_registered_device *rdev = wpan_phy_to_rdev(phy); in wpan_phy_unregister() local
167 wait_event(rdev->dev_wait, ({ in wpan_phy_unregister()
170 __count = rdev->opencount; in wpan_phy_unregister()
178 WARN_ON(!list_empty(&rdev->wpan_dev_list)); in wpan_phy_unregister()
183 list_del_rcu(&rdev->list); in wpan_phy_unregister()
200 void cfg802154_dev_free(struct cfg802154_registered_device *rdev) in cfg802154_dev_free() argument
202 kfree(rdev); in cfg802154_dev_free()
206 cfg802154_update_iface_num(struct cfg802154_registered_device *rdev, in cfg802154_update_iface_num() argument
211 rdev->num_running_ifaces += num; in cfg802154_update_iface_num()
219 struct cfg802154_registered_device *rdev; in cfg802154_netdev_notifier_call() local
224 rdev = wpan_phy_to_rdev(wpan_dev->wpan_phy); in cfg802154_netdev_notifier_call()
232 wpan_dev->identifier = ++rdev->wpan_dev_id; in cfg802154_netdev_notifier_call()
233 list_add_rcu(&wpan_dev->list, &rdev->wpan_dev_list); in cfg802154_netdev_notifier_call()
234 rdev->devlist_generation++; in cfg802154_netdev_notifier_call()
239 cfg802154_update_iface_num(rdev, wpan_dev->iftype, -1); in cfg802154_netdev_notifier_call()
241 rdev->opencount--; in cfg802154_netdev_notifier_call()
242 wake_up(&rdev->dev_wait); in cfg802154_netdev_notifier_call()
245 cfg802154_update_iface_num(rdev, wpan_dev->iftype, 1); in cfg802154_netdev_notifier_call()
247 rdev->opencount++; in cfg802154_netdev_notifier_call()
258 rdev->devlist_generation++; in cfg802154_netdev_notifier_call()