Miscellaneous Devices

intmisc_register(structmiscdevice*misc)

register a miscellaneous device

Parameters

structmiscdevice*misc

device structure

Description

Register a miscellaneous device with the kernel. If the minornumber is set toMISC_DYNAMIC_MINOR a minor number is assignedand placed in the minor field of the structure. For other casesthe minor number requested is used.

The structure passed is linked into the kernel and may not bedestroyed until it has been unregistered. By default, an open()syscall to the device sets file->private_data to point to thestructure. Drivers don’t need open in fops for this.

A zero is returned on success and a negative errno code forfailure.

voidmisc_deregister(structmiscdevice*misc)

unregister a miscellaneous device

Parameters

structmiscdevice*misc

device to unregister

Description

Unregister a miscellaneous device that was previouslysuccessfully registered withmisc_register().