diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-02 23:26:55 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-02 23:26:55 -0500 |
commit | 1447190e39847cc2cc8a826e7061989c83ff4362 (patch) | |
tree | 22353af22bc854d8a203b3cb8a4281de607a48bd /drivers/input | |
parent | b435fdcda126db42343b8055d04a0a27c229717b (diff) |
Input: add comments to input_{allocate|free}_device()
Hopefully this will stop people from using input_free_device()
incorrectly.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/input.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 1c8c8a5bc4a9..7cf2b4f603a3 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -37,7 +37,7 @@ static struct input_handler *input_table[8]; | |||
37 | 37 | ||
38 | /** | 38 | /** |
39 | * input_event() - report new input event | 39 | * input_event() - report new input event |
40 | * @handle: device that generated the event | 40 | * @dev: device that generated the event |
41 | * @type: type of the event | 41 | * @type: type of the event |
42 | * @code: event code | 42 | * @code: event code |
43 | * @value: value of the event | 43 | * @value: value of the event |
@@ -900,6 +900,15 @@ struct class input_class = { | |||
900 | }; | 900 | }; |
901 | EXPORT_SYMBOL_GPL(input_class); | 901 | EXPORT_SYMBOL_GPL(input_class); |
902 | 902 | ||
903 | /** | ||
904 | * input_allocate_device - allocate memory for new input device | ||
905 | * | ||
906 | * Returns prepared struct input_dev or NULL. | ||
907 | * | ||
908 | * NOTE: Use input_free_device() to free devices that have not been | ||
909 | * registered; input_unregister_device() should be used for already | ||
910 | * registered devices. | ||
911 | */ | ||
903 | struct input_dev *input_allocate_device(void) | 912 | struct input_dev *input_allocate_device(void) |
904 | { | 913 | { |
905 | struct input_dev *dev; | 914 | struct input_dev *dev; |
@@ -919,6 +928,20 @@ struct input_dev *input_allocate_device(void) | |||
919 | } | 928 | } |
920 | EXPORT_SYMBOL(input_allocate_device); | 929 | EXPORT_SYMBOL(input_allocate_device); |
921 | 930 | ||
931 | /** | ||
932 | * input_free_device - free memory occupied by input_dev structure | ||
933 | * @dev: input device to free | ||
934 | * | ||
935 | * This function should only be used if input_register_device() | ||
936 | * was not called yet or if it failed. Once device was registered | ||
937 | * use input_unregister_device() and memory will be freed once last | ||
938 | * refrence to the device is dropped. | ||
939 | * | ||
940 | * Device should be allocated by input_allocate_device(). | ||
941 | * | ||
942 | * NOTE: If there are references to the input device then memory | ||
943 | * will not be freed until last reference is dropped. | ||
944 | */ | ||
922 | void input_free_device(struct input_dev *dev) | 945 | void input_free_device(struct input_dev *dev) |
923 | { | 946 | { |
924 | if (dev) { | 947 | if (dev) { |