Skip to main content.

5.3.2. Device numbers

API: Device numbers

type:

dev_t

include/linux/types.h

creation, accessors:

MKDEV(int major, int minor)
MAJOR(dev_t dev)
MINOR(dev_t dev)

include/linux/kdev_t.h

register a (known) range of numbers:

int register_chrdev_region(dev_t first, unsigned int count, char *name);

allocate a range of free numbers:

int alloc_chrdev_region(dev_t *dev, unsigned int firstminor, unsigned int count, char *name);

free allocated or registered range of numbers:

void unregister_chrdev_region(dev_t first, unsigned int count);

include/linux/fs.h

5.3.1. Introduction to character drivers 1. Denx Training Topics 5.3.3. Registering a character driver
Prev Home Next