v4l2_device_set_name(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– v4l2_device_set_name(9) πŸ’–

okay bestie, welcome to the Kernel API Manual page for v4l2_device_set_name(9) β€” it’s giving optional function realness, and yes, we’re about to make the name field of struct &v4l2_device make sense 🫢


✨ NAME ✨

v4l2_device_set_name β€” optional function to initialize the name field of struct &v4l2_device

🌸 SYNOPSIS 🌸

int v4l2_device_set_name (struct v4l2_device *v4l2_dev , const char
       *basename , atomic_t *instance );

πŸŽ€ ARGUMENTS πŸŽ€

  • v4l2_dev β€” pointer to struct v4l2_device
  • basename β€” base name for the device name
  • instance β€” pointer to a static atomic_t var with the instance usage for the device driver.

πŸ’… DESCRIPTION πŸ’…

v4l2_device_set_name initializes the name field of struct v4l2_device using the driver name and a driver-global atomic_t instance.

This function will increment the instance counter and returns the instance value used in the name.

πŸ¦‹ EXAMPLE πŸ¦‹

static atomic_t drv_instance = ATOMIC_INIT(0);

...

instance = v4l2_device_set_name(& v4l2_dev, "foo", & drv_instance);

The first time this is called the name field will be set to foo0 and this function returns 0. If the name ends with a digit (e.g. cx18), then the name will be set to cx18-0 since cx180 would look really odd.

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/media/v4l2-device.h:


that’s the whole vibe, bestie πŸ’œ this one lives under ./include/media, is dated October 2026, and belongs to the v4l2_device_set_name(9) title β€” mwah πŸ’‹

πŸ“¦ where this page comes from