Lines Matching full:major

15 #include <linux/major.h>
37 unsigned int major; member
45 static inline int major_to_index(unsigned major) in major_to_index() argument
47 return major % CHRDEV_MAJOR_HASH_SIZE; in major_to_index()
58 if (cd->major == offset) in chrdev_show()
59 seq_printf(f, "%3d %s\n", cd->major, cd->name); in chrdev_show()
79 if (cd->major == i) in find_dynamic_major()
90 * Register a single major with a specified minor range.
92 * If major == 0 this function will dynamically allocate an unused major.
93 * If major > 0 this function will attempt to reserve the range of minors
94 * with given major.
98 __register_chrdev_region(unsigned int major, unsigned int baseminor, in __register_chrdev_region() argument
106 if (major >= CHRDEV_MAJOR_MAX) { in __register_chrdev_region()
107 pr_err("CHRDEV \"%s\" major requested (%u) is greater than the maximum (%u)\n", in __register_chrdev_region()
108 name, major, CHRDEV_MAJOR_MAX-1); in __register_chrdev_region()
113 …"%s\" minor range requested (%u-%u) is out of range of maximum range (%u-%u) for a single major\n", in __register_chrdev_region()
124 if (major == 0) { in __register_chrdev_region()
131 major = ret; in __register_chrdev_region()
135 i = major_to_index(major); in __register_chrdev_region()
137 if (curr->major < major) in __register_chrdev_region()
140 if (curr->major > major) in __register_chrdev_region()
152 cd->major = major; in __register_chrdev_region()
169 __unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct) in __unregister_chrdev_region() argument
172 int i = major_to_index(major); in __unregister_chrdev_region()
176 if ((*cp)->major == major && in __unregister_chrdev_region()
191 * the major number.
204 next = MKDEV(MAJOR(n)+1, 0); in register_chrdev_region()
207 cd = __register_chrdev_region(MAJOR(n), MINOR(n), in register_chrdev_region()
216 next = MKDEV(MAJOR(n)+1, 0); in register_chrdev_region()
217 kfree(__unregister_chrdev_region(MAJOR(n), MINOR(n), next - n)); in register_chrdev_region()
229 * Allocates a range of char device numbers. The major number will be
240 *dev = MKDEV(cd->major, cd->baseminor); in alloc_chrdev_region()
246 * @major: major device number or 0 for dynamic allocation
252 * If @major == 0 this functions will dynamically allocate a major and return
255 * If @major > 0 this function will attempt to reserve a device with the given
256 * major number and will return zero on success.
265 int __register_chrdev(unsigned int major, unsigned int baseminor, in __register_chrdev() argument
273 cd = __register_chrdev_region(major, baseminor, count, name); in __register_chrdev()
285 err = cdev_add(cdev, MKDEV(cd->major, baseminor), count); in __register_chrdev()
291 return major ? 0 : cd->major; in __register_chrdev()
295 kfree(__unregister_chrdev_region(cd->major, baseminor, count)); in __register_chrdev()
314 next = MKDEV(MAJOR(n)+1, 0); in unregister_chrdev_region()
317 kfree(__unregister_chrdev_region(MAJOR(n), MINOR(n), next - n)); in unregister_chrdev_region()
323 * @major: major device number
329 * @major, @baseminor and @count. This function undoes what
332 void __unregister_chrdev(unsigned int major, unsigned int baseminor, in __unregister_chrdev() argument
337 cd = __unregister_chrdev_region(major, baseminor, count); in __unregister_chrdev()
665 if (request_module("char-major-%d-%d", MAJOR(dev), MINOR(dev)) > 0) in base_probe()
667 request_module("char-major-%d", MAJOR(dev)); in base_probe()