Lines Matching full:major
14 #include <linux/major.h>
36 unsigned int major; member
44 static inline int major_to_index(unsigned major) in major_to_index() argument
46 return major % CHRDEV_MAJOR_HASH_SIZE; in major_to_index()
57 if (cd->major == offset) in chrdev_show()
58 seq_printf(f, "%3d %s\n", cd->major, cd->name); in chrdev_show()
78 if (cd->major == i) in find_dynamic_major()
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, in __register_chrdev_region() argument
104 if (major >= CHRDEV_MAJOR_MAX) { in __register_chrdev_region()
105 pr_err("CHRDEV \"%s\" major requested (%u) is greater than the maximum (%u)\n", in __register_chrdev_region()
106 name, major, CHRDEV_MAJOR_MAX-1); in __register_chrdev_region()
111 …"%s\" minor range requested (%u-%u) is out of range of maximum range (%u-%u) for a single major\n", in __register_chrdev_region()
122 if (major == 0) { in __register_chrdev_region()
129 major = ret; in __register_chrdev_region()
133 i = major_to_index(major); in __register_chrdev_region()
135 if (curr->major < major) in __register_chrdev_region()
138 if (curr->major > major) in __register_chrdev_region()
150 cd->major = major; in __register_chrdev_region()
172 __unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct) in __unregister_chrdev_region() argument
175 int i = major_to_index(major); in __unregister_chrdev_region()
179 if ((*cp)->major == major && in __unregister_chrdev_region()
194 * the major number.
207 next = MKDEV(MAJOR(n)+1, 0); in register_chrdev_region()
210 cd = __register_chrdev_region(MAJOR(n), MINOR(n), in register_chrdev_region()
219 next = MKDEV(MAJOR(n)+1, 0); in register_chrdev_region()
220 kfree(__unregister_chrdev_region(MAJOR(n), MINOR(n), next - n)); in register_chrdev_region()
232 * Allocates a range of char device numbers. The major number will be
243 *dev = MKDEV(cd->major, cd->baseminor); in alloc_chrdev_region()
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, in __register_chrdev() argument
276 cd = __register_chrdev_region(major, baseminor, count, name); in __register_chrdev()
288 err = cdev_add(cdev, MKDEV(cd->major, baseminor), count); in __register_chrdev()
294 return major ? 0 : cd->major; in __register_chrdev()
298 kfree(__unregister_chrdev_region(cd->major, baseminor, count)); in __register_chrdev()
317 next = MKDEV(MAJOR(n)+1, 0); in unregister_chrdev_region()
320 kfree(__unregister_chrdev_region(MAJOR(n), MINOR(n), next - n)); in unregister_chrdev_region()
326 * @major: major device number
332 * @major, @baseminor and @count. This function undoes what
335 void __unregister_chrdev(unsigned int major, unsigned int baseminor, in __unregister_chrdev() argument
340 cd = __unregister_chrdev_region(major, baseminor, count); in __unregister_chrdev()
661 if (request_module("char-major-%d-%d", MAJOR(dev), MINOR(dev)) > 0) in base_probe()
663 request_module("char-major-%d", MAJOR(dev)); in base_probe()