linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] Open / close for polled input device
@ 2009-10-13  6:24 Samu Onkalo
  2009-10-13  6:24 ` [PATCH 1/1] Polled input device: add device open and close methods Samu Onkalo
  0 siblings, 1 reply; 4+ messages in thread
From: Samu Onkalo @ 2009-10-13  6:24 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, Samu Onkalo

Small sensors could utilise polled input device. Sometimes there is
a need to prepare or close the HW. This patch adds optional 
open / close functionality to the polled input device driver.

Samu Onkalo (1):
  Polled input device: add device open and close methods

 drivers/input/input-polldev.c |    6 ++++++
 include/linux/input-polldev.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)


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

* [PATCH 1/1] Polled input device: add device open and close methods
  2009-10-13  6:24 [PATCH 0/1] Open / close for polled input device Samu Onkalo
@ 2009-10-13  6:24 ` Samu Onkalo
  2009-10-14  8:00   ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Samu Onkalo @ 2009-10-13  6:24 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, Samu Onkalo

Optional open and close methods for preparing and closing
the device.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
---
 drivers/input/input-polldev.c |    6 ++++++
 include/linux/input-polldev.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index 0d3ce7a..0ad788b 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -80,6 +80,9 @@ static int input_open_polled_device(struct input_dev *input)
 	if (error)
 		return error;
 
+	if (dev->open)
+		dev->open(dev);
+
 	if (dev->flush)
 		dev->flush(dev);
 
@@ -95,6 +98,9 @@ static void input_close_polled_device(struct input_dev *input)
 
 	cancel_delayed_work_sync(&dev->work);
 	input_polldev_stop_workqueue();
+
+	if (dev->close)
+		dev->close(dev);
 }
 
 /**
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
index 597a007..ba266c1 100644
--- a/include/linux/input-polldev.h
+++ b/include/linux/input-polldev.h
@@ -30,6 +30,8 @@
 struct input_polled_dev {
 	void *private;
 
+	void (*open)(struct input_polled_dev *dev);
+	void (*close)(struct input_polled_dev *dev);
 	void (*flush)(struct input_polled_dev *dev);
 	void (*poll)(struct input_polled_dev *dev);
 	unsigned int poll_interval; /* msec */
-- 
1.5.6.3


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

* Re: [PATCH 1/1] Polled input device: add device open and close methods
  2009-10-13  6:24 ` [PATCH 1/1] Polled input device: add device open and close methods Samu Onkalo
@ 2009-10-14  8:00   ` Dmitry Torokhov
  2009-10-15  5:49     ` samu.p.onkalo
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2009-10-14  8:00 UTC (permalink / raw)
  To: Samu Onkalo; +Cc: linux-input

On Tue, Oct 13, 2009 at 09:24:48AM +0300, Samu Onkalo wrote:
> Optional open and close methods for preparing and closing
> the device.
> 
> Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
> ---
>  drivers/input/input-polldev.c |    6 ++++++
>  include/linux/input-polldev.h |    2 ++
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
> index 0d3ce7a..0ad788b 100644
> --- a/drivers/input/input-polldev.c
> +++ b/drivers/input/input-polldev.c
> @@ -80,6 +80,9 @@ static int input_open_polled_device(struct input_dev *input)
>  	if (error)
>  		return error;
>  
> +	if (dev->open)
> +		dev->open(dev);
> +
>  	if (dev->flush)
>  		dev->flush(dev);

Hmm... I think having both open and flush is overkill. My fault for not
looking closer, I will kill the flush and convert existing users to
open.

-- 
Dmitry

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

* RE: [PATCH 1/1] Polled input device: add device open and close methods
  2009-10-14  8:00   ` Dmitry Torokhov
@ 2009-10-15  5:49     ` samu.p.onkalo
  0 siblings, 0 replies; 4+ messages in thread
From: samu.p.onkalo @ 2009-10-15  5:49 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input


 >input_dev *input)
>>  	if (error)
>>  		return error;
>>  
>> +	if (dev->open)
>> +		dev->open(dev);
>> +
>>  	if (dev->flush)
>>  		dev->flush(dev);
>
>Hmm... I think having both open and flush is overkill. My 
>fault for not looking closer, I will kill the flush and 
>convert existing users to open.
>

Good. So I can continue work with my drivers with an assumption that
there are open and close methods available at some point.

Samu


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

end of thread, other threads:[~2009-10-15  5:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-13  6:24 [PATCH 0/1] Open / close for polled input device Samu Onkalo
2009-10-13  6:24 ` [PATCH 1/1] Polled input device: add device open and close methods Samu Onkalo
2009-10-14  8:00   ` Dmitry Torokhov
2009-10-15  5:49     ` samu.p.onkalo

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).