Messages in this thread | | | Subject | Dynamic allocation of char majors in the new world order | From | Jonathan Corbet <> | Date | Tue, 16 Sep 2003 13:24:49 -0600 |
| |
Once again, I'm trying to figure out how char drivers are really going to work once the dust has settled around the dev_t changes. The new register_chrdev_region() and cdev_* functions are reasonably easy to get a grasp of, for the most part. But I'm curious about one thing: what do you do if you want to use the new functions with dynamic major number allocation?
Passing zero for the major number into register_chrdev_region() does almost what one would want - it allocates a number for the caller. The one thing it does *not* do, however, is communicate that number back to the caller in any way. If you want to know what number you got, you have to call __register_chrdev_region(), but that's static and uses a private structure type - clearly not meant to be used that way.
Now, it wouldn't be that hard to hack register_chrdev_region() to save out the actual major number and return it to the caller. But I get the sense that things ultimately are not meant to work that way. I'm not a particularly sensitive guy, but even I can notice little things like comments reading "/* temporary */". So...is there some grand design out there on how dynamic majors are really supposed to work in 2.6? Is it rational to be trying to write something about char device registration at this point?
Thanks,
jon
Jonathan Corbet Executive editor, LWN.net corbet@lwn.net
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |