aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-11-27 03:16:48 -0500
committerHenrik Rydberg <rydberg@euromail.se>2010-12-16 04:39:57 -0500
commit47c78e891323513e9909729b44033e2c6649e2b7 (patch)
tree828e0da90418a890653ef2f0af3cf81714fe5c80 /drivers/input/input.c
parentc8ddb2713c624f432fa5fe3c7ecffcdda46ea0d4 (diff)
input: mt: Break out slots handling
In preparation for common code to handle a larger set of MT slots devices, move the slots handling over to a separate file. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
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 d092ef9291d..37708d1d86e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -12,7 +12,7 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/input.h> 15#include <linux/input/mt.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/random.h> 18#include <linux/random.h>
@@ -1691,52 +1691,6 @@ void input_free_device(struct input_dev *dev)
1691EXPORT_SYMBOL(input_free_device); 1691EXPORT_SYMBOL(input_free_device);
1692 1692
1693/** 1693/**
1694 * input_mt_create_slots() - create MT input slots
1695 * @dev: input device supporting MT events and finger tracking
1696 * @num_slots: number of slots used by the device
1697 *
1698 * This function allocates all necessary memory for MT slot handling in the
1699 * input device, and adds ABS_MT_SLOT to the device capabilities. All slots
1700 * are initially marked as unused by setting ABS_MT_TRACKING_ID to -1.
1701 */
1702int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots)
1703{
1704 int i;
1705
1706 if (!num_slots)
1707 return 0;
1708
1709 dev->mt = kcalloc(num_slots, sizeof(struct input_mt_slot), GFP_KERNEL);
1710 if (!dev->mt)
1711 return -ENOMEM;
1712
1713 dev->mtsize = num_slots;
1714 input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
1715
1716 /* Mark slots as 'unused' */
1717 for (i = 0; i < num_slots; i++)
1718 dev->mt[i].abs[ABS_MT_TRACKING_ID - ABS_MT_FIRST] = -1;
1719
1720 return 0;
1721}
1722EXPORT_SYMBOL(input_mt_create_slots);
1723
1724/**
1725 * input_mt_destroy_slots() - frees the MT slots of the input device
1726 * @dev: input device with allocated MT slots
1727 *
1728 * This function is only needed in error path as the input core will
1729 * automatically free the MT slots when the device is destroyed.
1730 */
1731void input_mt_destroy_slots(struct input_dev *dev)
1732{
1733 kfree(dev->mt);
1734 dev->mt = NULL;
1735 dev->mtsize = 0;
1736}
1737EXPORT_SYMBOL(input_mt_destroy_slots);
1738
1739/**
1740 * input_set_capability - mark device as capable of a certain event 1694 * input_set_capability - mark device as capable of a certain event
1741 * @dev: device that is capable of emitting or accepting event 1695 * @dev: device that is capable of emitting or accepting event
1742 * @type: type of the event (EV_KEY, EV_REL, etc...) 1696 * @type: type of the event (EV_KEY, EV_REL, etc...)