From 7489c2eb20ec1643b5fa6b1f5aa463c6becb46ae Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 8 Jan 2013 09:10:31 -0800 Subject: [PATCH] --- yaml --- r: 349789 b: refs/heads/master c: b666263b71cb1f3b96fb79e69de7f119062b0da2 h: refs/heads/master i: 349787: 4ca8e80700ad2b37e09c3b3b3f9577f3f18dcf13 v: v3 --- [refs] | 2 +- trunk/drivers/input/input.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 044365713591..306ff46eee0a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bec7a4bbecf7da86b6e64bb78d22c92ea1ba4afe +refs/heads/master: b666263b71cb1f3b96fb79e69de7f119062b0da2 diff --git a/trunk/drivers/input/input.c b/trunk/drivers/input/input.c index ce01332f7b3a..c04469928925 100644 --- a/trunk/drivers/input/input.c +++ b/trunk/drivers/input/input.c @@ -1785,12 +1785,13 @@ static void devm_input_device_release(struct device *dev, void *res) * its driver (or binding fails). Once managed input device is allocated, * it is ready to be set up and registered in the same fashion as regular * input device. There are no special devm_input_device_[un]register() - * variants, regular ones work with both managed and unmanaged devices. + * variants, regular ones work with both managed and unmanaged devices, + * should you need them. In most cases however, managed input device need + * not be explicitly unregistered or freed. * * NOTE: the owner device is set up as parent of input device and users * should not override it. */ - struct input_dev *devm_input_allocate_device(struct device *dev) { struct input_dev *input; @@ -2004,6 +2005,17 @@ static void devm_input_device_unregister(struct device *dev, void *res) * Once device has been successfully registered it can be unregistered * with input_unregister_device(); input_free_device() should not be * called in this case. + * + * Note that this function is also used to register managed input devices + * (ones allocated with devm_input_allocate_device()). Such managed input + * devices need not be explicitly unregistered or freed, their tear down + * is controlled by the devres infrastructure. It is also worth noting + * that tear down of managed input devices is internally a 2-step process: + * registered managed input device is first unregistered, but stays in + * memory and can still handle input_event() calls (although events will + * not be delivered anywhere). The freeing of managed input device will + * happen later, when devres stack is unwound to the point where device + * allocation was made. */ int input_register_device(struct input_dev *dev) {