Lines Matching refs:major

14 #include <linux/major.h>
36 unsigned int major;
44 static inline int major_to_index(unsigned major)
46 return major % CHRDEV_MAJOR_HASH_SIZE;
57 if (cd->major == offset)
58 seq_printf(f, "%3d %s\n", cd->major, cd->name);
78 if (cd->major == i)
89 * Register a single major with a specified minor range.
91 * If major == 0 this function will dynamically allocate an unused major.
92 * If major > 0 this function will attempt to reserve the range of minors
93 * with given major.
97 __register_chrdev_region(unsigned int major, unsigned int baseminor,
104 if (major >= CHRDEV_MAJOR_MAX) {
105 pr_err("CHRDEV \"%s\" major requested (%u) is greater than the maximum (%u)\n",
106 name, major, CHRDEV_MAJOR_MAX-1);
111 pr_err("CHRDEV \"%s\" minor range requested (%u-%u) is out of range of maximum range (%u-%u) for a single major\n",
122 if (major == 0) {
129 major = ret;
133 i = major_to_index(major);
135 if (curr->major < major)
138 if (curr->major > major)
150 cd->major = major;
172 __unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct)
175 int i = major_to_index(major);
179 if ((*cp)->major == major &&
194 * the major number.
232 * Allocates a range of char device numbers. The major number will be
243 *dev = MKDEV(cd->major, cd->baseminor);
249 * @major: major device number or 0 for dynamic allocation
255 * If @major == 0 this functions will dynamically allocate a major and return
258 * If @major > 0 this function will attempt to reserve a device with the given
259 * major number and will return zero on success.
268 int __register_chrdev(unsigned int major, unsigned int baseminor,
276 cd = __register_chrdev_region(major, baseminor, count, name);
288 err = cdev_add(cdev, MKDEV(cd->major, baseminor), count);
294 return major ? 0 : cd->major;
298 kfree(__unregister_chrdev_region(cd->major, baseminor, count));
326 * @major: major device number
332 * @major, @baseminor and @count. This function undoes what
335 void __unregister_chrdev(unsigned int major, unsigned int baseminor,
340 cd = __unregister_chrdev_region(major, baseminor, count);
668 if (request_module("char-major-%d-%d", MAJOR(dev), MINOR(dev)) > 0)
670 request_module("char-major-%d", MAJOR(dev));