March 30, 2021
7:27 p.m.
Hi Greg and all, Thus wrote Greg KH (greg@kroah.com):
Not at all, this is what you should be done, and is what many misc devices do, that's why the parent pointer is there :)
thanks for the confirmation.
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. 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. Best regards, Martin