-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Linux Device Driver Development
By :

Before the events that are supported by an input device can be seen by the system, memory needs to be allocated for this device first using the devm_input_allocate_device()
API. Then, the device needs to be registered with the system using input_device_register()
. The former API will take care of freeing up the memory and unregistering the device when it leaves the system. However, non-managed allocation is still available but not recommended, input_allocate_device()
. By using non-managed allocation, the driver becomes responsible for making sure that input_unregister_device()
and input_free_device()
are called to unregister the device and free its memory when they're on the unloading path of the driver, respectively. The following are the respective prototypes of these APIs:
struct input_dev *input_allocate_device(void) struct input_dev *devm_input_allocate_device( ...