aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-12-16 12:17:48 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-12-16 12:17:48 -0500
commit67b989a0c17e34a7c2c095e58a2f3d1b4408e3cb (patch)
treec076d2f0b5d4ae8726a50206042d3e3a41620fe4 /drivers/input/input.c
parent56a8bd6dcf81693e61a712097216904f3a4ab536 (diff)
parent69479f8da68f1930b2078b2ebf6533fb00339918 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt into next
Conflicts: drivers/input/Makefile
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c48
1 files changed, 1 insertions, 47 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index c7a1e826c580..3312e20016bf 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/input.h> 17#include <linux/input/mt.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/random.h> 20#include <linux/random.h>
@@ -1726,52 +1726,6 @@ void input_free_device(struct input_dev *dev)
1726EXPORT_SYMBOL(input_free_device); 1726EXPORT_SYMBOL(input_free_device);
1727 1727
1728/** 1728/**
1729 * input_mt_create_slots() - create MT input slots
1730 * @dev: input device supporting MT events and finger tracking
1731 * @num_slots: number of slots used by the device
1732 *
1733 * This function allocates all necessary memory for MT slot handling in the
1734 * input device, and adds ABS_MT_SLOT to the device capabilities. All slots
1735 * are initially marked as unused by setting ABS_MT_TRACKING_ID to -1.
1736 */
1737int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots)
1738{
1739 int i;
1740
1741 if (!num_slots)
1742 return 0;
1743
1744 dev->mt = kcalloc(num_slots, sizeof(struct input_mt_slot), GFP_KERNEL);
1745 if (!dev->mt)
1746 return -ENOMEM;
1747
1748 dev->mtsize = num_slots;
1749 input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
1750
1751 /* Mark slots as 'unused' */
1752 for (i = 0; i < num_slots; i++)
1753 dev->mt[i].abs[ABS_MT_TRACKING_ID - ABS_MT_FIRST] = -1;
1754
1755 return 0;
1756}
1757EXPORT_SYMBOL(input_mt_create_slots);
1758
1759/**
1760 * input_mt_destroy_slots() - frees the MT slots of the input device
1761 * @dev: input device with allocated MT slots
1762 *
1763 * This function is only needed in error path as the input core will
1764 * automatically free the MT slots when the device is destroyed.
1765 */
1766void input_mt_destroy_slots(struct input_dev *dev)
1767{
1768 kfree(dev->mt);
1769 dev->mt = NULL;
1770 dev->mtsize = 0;
1771}
1772EXPORT_SYMBOL(input_mt_destroy_slots);
1773
1774/**
1775 * input_set_capability - mark device as capable of a certain event 1729 * input_set_capability - mark device as capable of a certain event
1776 * @dev: device that is capable of emitting or accepting event 1730 * @dev: device that is capable of emitting or accepting event
1777 * @type: type of the event (EV_KEY, EV_REL, etc...) 1731 * @type: type of the event (EV_KEY, EV_REL, etc...)