All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Illia Smyrnov <illia.smyrnov@ti.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	balbi@ti.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH v2 2/3] Input: omap-keypad: Convert to threaded IRQ
Date: Tue, 23 Jul 2013 20:25:01 +0300	[thread overview]
Message-ID: <20130723172501.GC9166@radagast> (raw)
In-Reply-To: <1374595798-15492-3-git-send-email-illia.smyrnov@ti.com>

[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]

Hi,

On Tue, Jul 23, 2013 at 07:09:57PM +0300, Illia Smyrnov wrote:
> Convert to use threaded IRQ.
> 
> Cc: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Illia Smyrnov <illia.smyrnov@ti.com>
> ---
>  drivers/input/keyboard/omap4-keypad.c |   29 ++++++++++++++++++++---------
>  1 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index c727548..b876a0d 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -112,8 +112,22 @@ static void kbd_write_irqreg(struct omap4_keypad *keypad_data,
>  }
>  
>  
> -/* Interrupt handler */
> -static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
> +/* Interrupt handlers */
> +static irqreturn_t omap4_keypad_irq_handler(int irq, void *dev_id)
> +{
> +	struct omap4_keypad *keypad_data = dev_id;
> +
> +	if (kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)) {
> +		/* Disable interrupts */
> +		kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
> +				 OMAP4_VAL_IRQDISABLE);
> +		return IRQ_WAKE_THREAD;
> +	}
> +
> +	return IRQ_NONE;
> +}
> +
> +static irqreturn_t omap4_keypad_irq_thread_fn(int irq, void *dev_id)
>  {
>  	struct omap4_keypad *keypad_data = dev_id;
>  	struct input_dev *input_dev = keypad_data->input;
> @@ -121,10 +135,6 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  	unsigned int col, row, code, changed;
>  	u32 *new_state = (u32 *) key_state;
>  
> -	/* Disable interrupts */
> -	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
> -			 OMAP4_VAL_IRQDISABLE);

looking a lot better, but I wonder if you should add a mutex to this
threaded handler, but I guess there's no way this will never race since
IRQs are masked anyway and registers are only accessed from within IRQ
handlers.

Reviewed-by: Felipe Balbi <balbi@ti.com>

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@ti.com>
To: Illia Smyrnov <illia.smyrnov@ti.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>, <balbi@ti.com>,
	<linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-omap@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] Input: omap-keypad: Convert to threaded IRQ
Date: Tue, 23 Jul 2013 20:25:01 +0300	[thread overview]
Message-ID: <20130723172501.GC9166@radagast> (raw)
In-Reply-To: <1374595798-15492-3-git-send-email-illia.smyrnov@ti.com>

[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]

Hi,

On Tue, Jul 23, 2013 at 07:09:57PM +0300, Illia Smyrnov wrote:
> Convert to use threaded IRQ.
> 
> Cc: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Illia Smyrnov <illia.smyrnov@ti.com>
> ---
>  drivers/input/keyboard/omap4-keypad.c |   29 ++++++++++++++++++++---------
>  1 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index c727548..b876a0d 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -112,8 +112,22 @@ static void kbd_write_irqreg(struct omap4_keypad *keypad_data,
>  }
>  
>  
> -/* Interrupt handler */
> -static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
> +/* Interrupt handlers */
> +static irqreturn_t omap4_keypad_irq_handler(int irq, void *dev_id)
> +{
> +	struct omap4_keypad *keypad_data = dev_id;
> +
> +	if (kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)) {
> +		/* Disable interrupts */
> +		kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
> +				 OMAP4_VAL_IRQDISABLE);
> +		return IRQ_WAKE_THREAD;
> +	}
> +
> +	return IRQ_NONE;
> +}
> +
> +static irqreturn_t omap4_keypad_irq_thread_fn(int irq, void *dev_id)
>  {
>  	struct omap4_keypad *keypad_data = dev_id;
>  	struct input_dev *input_dev = keypad_data->input;
> @@ -121,10 +135,6 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  	unsigned int col, row, code, changed;
>  	u32 *new_state = (u32 *) key_state;
>  
> -	/* Disable interrupts */
> -	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
> -			 OMAP4_VAL_IRQDISABLE);

looking a lot better, but I wonder if you should add a mutex to this
threaded handler, but I guess there's no way this will never race since
IRQs are masked anyway and registers are only accessed from within IRQ
handlers.

Reviewed-by: Felipe Balbi <balbi@ti.com>

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-07-23 17:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 16:09 [PATCH v2 0/3] Input: omap-keypad: Convert to threaded IRQ and cleanup Illia Smyrnov
2013-07-23 16:09 ` Illia Smyrnov
2013-07-23 16:09 ` [PATCH v2 1/3] Input: omap-keypad: Cleanup - use bitfiled instead of hardcoded values Illia Smyrnov
2013-07-23 16:09   ` Illia Smyrnov
2013-07-23 17:20   ` Felipe Balbi
2013-07-23 17:20     ` Felipe Balbi
2013-07-23 16:09 ` [PATCH v2 2/3] Input: omap-keypad: Convert to threaded IRQ Illia Smyrnov
2013-07-23 16:09   ` Illia Smyrnov
2013-07-23 17:25   ` Felipe Balbi [this message]
2013-07-23 17:25     ` Felipe Balbi
2013-07-23 17:32     ` Felipe Balbi
2013-07-23 17:32       ` Felipe Balbi
2013-07-23 16:09 ` [PATCH v2 3/3] Input: omap-keypad: Clear pending interrupts on open Illia Smyrnov
2013-07-23 16:09   ` Illia Smyrnov
2013-07-23 17:18   ` Felipe Balbi
2013-07-23 17:18     ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130723172501.GC9166@radagast \
    --to=balbi@ti.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=illia.smyrnov@ti.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.