On Tue, Mar 30, 2021 at 09:27:17PM +0200, Martin Kaiser wrote:
What in-kernel misc drivers do not do that that you feel should?
My misunderstanding was that quite a few drivers set the parent pointer but hardly anyone uses the parent pointer in the file_operations.
What parent pointer in struct file_operations? I don't see one...
It seems that most drivers have their miscdevice as part of their global structure and use container_of in the file_operations, e.g. ipmb_read in drivers/char/ipmi/ipmb_dev_int.c.
That's one way to use it, there are I think at least 3 ways to use it, maybe more... Don't confuse the struct device parent pointer with the private pointer to get back to your local device-specific data. They are different things. thanks, greg k-h