linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: add input_get_poll_interval()
@ 2019-10-02 21:58 Dmitry Torokhov
  2019-10-03 18:34 ` Benjamin Tissoires
  2019-10-04  8:09 ` Michal Vokáč
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2019-10-02 21:58 UTC (permalink / raw)
  To: linux-input; +Cc: Benjamin Tissoires, linux-kernel

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

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/input-poller.c | 9 +++++++++
 include/linux/input.h        | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/input/input-poller.c b/drivers/input/input-poller.c
index 1b3d28964bb2..7d6b4e8879f1 100644
--- a/drivers/input/input-poller.c
+++ b/drivers/input/input-poller.c
@@ -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,
diff --git a/include/linux/input.h b/include/linux/input.h
index 31da4feaa1d8..a420324b7882 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: add input_get_poll_interval()
  2019-10-02 21:58 [PATCH] Input: add input_get_poll_interval() Dmitry Torokhov
@ 2019-10-03 18:34 ` Benjamin Tissoires
  2019-10-03 18:57   ` Dmitry Torokhov
  2019-10-04  8:09 ` Michal Vokáč
  1 sibling, 1 reply; 4+ messages in thread
From: Benjamin Tissoires @ 2019-10-03 18:34 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: open list:HID CORE LAYER, lkml

Hi Dmitry,

On Wed, Oct 2, 2019 at 5:58 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> Some drivers need to be able to know the current polling interval for
> devices working in polling mode, let's allow them fetching it.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Not sure if you really need my input on this one, but, sure, looks good to me:
Acked-By: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

> ---
>  drivers/input/input-poller.c | 9 +++++++++
>  include/linux/input.h        | 1 +
>  2 files changed, 10 insertions(+)
>
> diff --git a/drivers/input/input-poller.c b/drivers/input/input-poller.c
> index 1b3d28964bb2..7d6b4e8879f1 100644
> --- a/drivers/input/input-poller.c
> +++ b/drivers/input/input-poller.c
> @@ -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,
> diff --git a/include/linux/input.h b/include/linux/input.h
> index 31da4feaa1d8..a420324b7882 100644
> --- a/include/linux/input.h
> +++ b/include/linux/input.h
> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: add input_get_poll_interval()
  2019-10-03 18:34 ` Benjamin Tissoires
@ 2019-10-03 18:57   ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2019-10-03 18:57 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: open list:HID CORE LAYER, lkml

Hi Benjamin,

On Thu, Oct 03, 2019 at 02:34:59PM -0400, Benjamin Tissoires wrote:
> Hi Dmitry,
> 
> On Wed, Oct 2, 2019 at 5:58 PM Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> >
> > Some drivers need to be able to know the current polling interval for
> > devices working in polling mode, let's allow them fetching it.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> Not sure if you really need my input on this one, but, sure, looks good to me:
> Acked-By: Benjamin Tissoires <benjamin.tissoires@redhat.com>

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.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: add input_get_poll_interval()
  2019-10-02 21:58 [PATCH] Input: add input_get_poll_interval() Dmitry Torokhov
  2019-10-03 18:34 ` Benjamin Tissoires
@ 2019-10-04  8:09 ` Michal Vokáč
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Vokáč @ 2019-10-04  8:09 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input; +Cc: Benjamin Tissoires, linux-kernel

On 02. 10. 19 23:58, Dmitry Torokhov wrote:
> Some drivers need to be able to know the current polling interval for
> devices working in polling mode, let's allow them fetching it.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

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.

Tested-by: Michal Vokáč <michal.vokac@ysoft.com>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-04  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 21:58 [PATCH] Input: add input_get_poll_interval() Dmitry Torokhov
2019-10-03 18:34 ` Benjamin Tissoires
2019-10-03 18:57   ` Dmitry Torokhov
2019-10-04  8:09 ` Michal Vokáč

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).