Skip to contentSkip to conversation

Input: add input_get_poll_interval()

PATCH In review Dmitry Torokhov 3 participants 4 messages Oct 2, 2019 – Oct 4, 2019

Subsystems (2)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

PATCH 1/1 Input: add input_get_poll_interval()

Some drivers need to be able to know the current polling interval for devices working in polling mode, let's allow them fetching it.

---
 drivers/input/input-poller.c | 9 +++++++++
 include/linux/input.h        | 1 +
 2 files changed, 10 insertions(+)
drivers/input/input-poller.c +9 -0
index 1b3d28964bb2..7d6b4e8879f1 100644
@@ -123,6 +123,15 @@ void input_set_max_poll_interval(struct input_dev *dev, unsigned int interval)
 }
 EXPORT_SYMBOL(input_set_max_poll_interval);
 
+int input_get_poll_interval(struct input_dev *dev)
+{
+	if (!dev->poller)
+		return -EINVAL;
+
+	return dev->poller->poll_interval;
+}
+EXPORT_SYMBOL(input_get_poll_interval);
+
 /* SYSFS interface */
 
 static ssize_t input_dev_get_poll_interval(struct device *dev,
include/linux/input.h +1 -0
index 31da4feaa1d8..a420324b7882 100644
@@ -387,6 +387,7 @@ int input_setup_polling(struct input_dev *dev,
 void input_set_poll_interval(struct input_dev *dev, unsigned int interval);
 void input_set_min_poll_interval(struct input_dev *dev, unsigned int interval);
 void input_set_max_poll_interval(struct input_dev *dev, unsigned int interval);
+int input_get_poll_interval(struct input_dev *dev);
 
 int __must_check input_register_handler(struct input_handler *);
 void input_unregister_handler(struct input_handler *);
Signature · 5 lines
2.23.0.444.g18eeb5a265-goog


-- 
Dmitry
Acked-by on v1 1/1
#1 lore raw

Hi Dmitry,

Quoted 5 lines · Dmitry Torokhov

Some drivers need to be able to know the current polling interval for devices working in polling mode, let's allow them fetching it.

Not sure if you really need my input on this one, but, sure, looks good to me:

Cheers,
Benjamin

Quoted 43 lines
---
 drivers/input/input-poller.c | 9 +++++++++
 include/linux/input.h        | 1 +
 2 files changed, 10 insertions(+)
drivers/input/input-poller.c +9 -0
index 1b3d28964bb2..7d6b4e8879f1 100644
@@ -123,6 +123,15 @@ void input_set_max_poll_interval(struct input_dev *dev, unsigned int interval)
 }
 EXPORT_SYMBOL(input_set_max_poll_interval);
 
+int input_get_poll_interval(struct input_dev *dev)
+{
+       if (!dev->poller)
+               return -EINVAL;
+
+       return dev->poller->poll_interval;
+}
+EXPORT_SYMBOL(input_get_poll_interval);
+
 /* SYSFS interface */
 
 static ssize_t input_dev_get_poll_interval(struct device *dev,
include/linux/input.h +1 -1
index 31da4feaa1d8..a420324b7882 100644
@@ -387,6 +387,7 @@ int input_setup_polling(struct input_dev *dev,
 void input_set_poll_interval(struct input_dev *dev, unsigned int interval);
 void input_set_min_poll_interval(struct input_dev *dev, unsigned int interval);
 void input_set_max_poll_interval(struct input_dev *dev, unsigned int interval);
+int input_get_poll_interval(struct input_dev *dev);
 
 int __must_check input_register_handler(struct input_handler *);
 void input_unregister_handler(struct input_handler *);
--

2.23.0.444.g18eeb5a265-goog

--
Dmitry

author maintainer
#2 lore raw

Hi Benjamin,

Quoted 5 lines · Benjamin Tissoires

Hi Dmitry,

Quoted 1 line · Dmitry Torokhov
Quoted 7 lines
Quoted 4 lines

Some drivers need to be able to know the current polling interval for devices working in polling mode, let's allow them fetching it.

Not sure if you really need my input on this one, but, sure, looks good to me:

Thanks!

I like for someone to have taken look at the stuff I write before I commit it to the tree, and you are one of the most active developers in linux-input, so I tend to copy you on random bits and pieces and I really appreciate that you take time to check them out.

Signature · 1 line
Dmitry
Tested-by on v1 1/1
#3 lore raw
In reply to Dmitry Torokhov
Quoted 4 lines · Dmitry Torokhov

Some drivers need to be able to know the current polling interval for devices working in polling mode, let's allow them fetching it.

Just tested to use this function from a mpr121_touchkey driver. Works as expected. When I change the poll interval from sysfs, the new value is correctly reported.

Quoted 4 lines
---
  drivers/input/input-poller.c | 9 +++++++++
  include/linux/input.h        | 1 +
  2 files changed, 10 insertions(+)