Re: [RFC PATCH 3/8] qaic: Create char dev

From: Jeffrey Hugo
Date: Fri May 15 2020 - 17:09:13 EST


On 5/14/2020 10:24 AM, Jeffrey Hugo wrote:
On 5/14/2020 9:56 AM, Greg KH wrote:
Please use misc.

Ok, will investigate.


Misc looks like it'll work, and I'm expecting to have that in the next revision. However, a few of us looked at misc vs chardev, and didn't see much of a difference.

We were hoping you'd be kind enough to educate us on the considerations between the two, in-case we missed something that ends up being very relevant. We attempted to find relevant documentation within the kernel, and in Linux Device Drivers 3rd edition, but did not find any besides just reading the misc dev code. If we missed something, please point us to it.

By going with a misc device, we see two possible limitations -

1. You don't have your own major number, so userspace may have to do a bit more work to identify your device. However, given that the driver assigns the device name, one would think that the device name would be pretty unique. So, it seems like this would have a minor impact to udev rules.

2. There are a limited number of dynamic minor numbers for misc devs (64), so if you are expecting more devices than that, a misc dev is not appropiate. Also, these minors are shared with other misc dev users, so depending on the system configuration, you might have significantly less than 64 minors available for use.

--
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.