ib_unregiste...vice_and_put(9)
π ib_unregiste...vice_and_put(9) β bestie edition π
so this is a page from the Kernel API Manual, and the star of the show is ib_unregister_device_and_put β¨ (yes the header abbreviates it as ib_unregiste...vice_and_put(9), that's just the title doing its little truncated thing, don't worry about it π)
π¦ NAME π¦
ib_unregister_device_and_put β unregister a device while holding a 'get'. that's it. that's the whole vibe check π
β¨ SYNOPSIS β¨
void ib_unregister_device_and_put (struct ib_device *ib_dev );
like, it returns void, so don't go looking for a return value, there isn't one, periodt π
π ARGUMENTS π
ib_devβ the device to unregister. the main character of this whole operation π
πΈ DESCRIPTION πΈ
okay so listen π«Ά β this function is literally the same as ib_unregister_device, except it also does an internal ib_device_put for you, and that put is supposed to match a 'get' that you (the caller) already grabbed. so you're not creating a get out of nowhere, you're squaring up a get you already had. no cap.
it is safe to call this routine concurrently from multiple threads while holding the 'get' π₯ like, multiple threads can roll up at once, it's fine. and when the function returns, the device is fully unregistered. done. finished. ate and left no crumbs π
β οΈ drivers using this flow MUST use the driver_unregister callback to clean up their resources associated with the device and dealloc it. MUST. not "should", not "maybe if you feel like it" β MUST, bestie ππ
π§ SEE ALSO π§
the kernel file ./drivers/infiniband/core/device.c β that's where the magic lives π¦
and the whole extended friend group, all of them, in order, no one left out π:
rdma_dev_access_netns(9)rdma_dev_has_raw_cap(9)ib_device_put(9)_ib_alloc_device(9)ib_dealloc_device(9)ib_port_immutable_read(9)ib_register_device(9)ib_unregister_device(9)ib_unregister_driver(9)ib_unregister_device_queued(9)ib_register_client(9)ib_unregister_client(9)ib_get_client_nl_info(9)ib_set_client_data(9)ib_register_event_handler(9)ib_unregister_event_handler(9)ib_query_port(9)ib_device_set_netdev(9)ib_query_netdev_port(9)ib_device_get_by_netdev(9)ib_enum_roce_netdev(9)ib_enum_all_roce_netdevs(9)ib_device_enable_gid_updates(9)ib_device_disable_gid_updates(9)ib_query_pkey(9)ib_modify_device(9)ib_modify_port(9)ib_find_gid(9)ib_find_pkey(9)ib_get_net_dev_by_params(9)
and that's the whole page, bestie πβ¨ straight from ./drivers/infiniband/core, dated October 2026, in the Kernel API Manual β go forth and unregister responsibly π«Άππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms