diff mbox

[7/9] Input: ab8500-ponkey: Create AB8500 domain IRQ mapping

Message ID 4FFB288D.4080606@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Lee Jones July 9, 2012, 6:53 p.m. UTC
From: Lee Jones <lee.jones@linaro.org>
Date: Tue, 26 Jun 2012 10:46:50 +0100
Subject: [PATCH 1/1] Input: ab8500-ponkey: Create AB8500 domain IRQ mapping

Before we can use any domain allocated IRQ, we need to first create a
map between the Hardware IRQ (hwirq) and the Linux Virtual IRQ (virq).
We do this with a helper function provided by the AB8500 IRQ domain
controller called ab8500_irq_get_virq(). We need to do this for both
IRQs which the Power-On-Key driver uses; one for button press, the other
for button depress.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/input/misc/ab8500-ponkey.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Dmitry Torokhov July 9, 2012, 8:14 p.m. UTC | #1
On Mon, Jul 09, 2012 at 08:53:01PM +0200, Lee Jones wrote:
> From: Lee Jones <lee.jones@linaro.org>
> Date: Tue, 26 Jun 2012 10:46:50 +0100
> Subject: [PATCH 1/1] Input: ab8500-ponkey: Create AB8500 domain IRQ mapping
> 
> Before we can use any domain allocated IRQ, we need to first create a
> map between the Hardware IRQ (hwirq) and the Linux Virtual IRQ (virq).
> We do this with a helper function provided by the AB8500 IRQ domain
> controller called ab8500_irq_get_virq(). We need to do this for both
> IRQs which the Power-On-Key driver uses; one for button press, the other
> for button depress.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/input/misc/ab8500-ponkey.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c
> index 5ceb23e..08d42d1 100644
> --- a/drivers/input/misc/ab8500-ponkey.c
> +++ b/drivers/input/misc/ab8500-ponkey.c
> @@ -82,6 +82,7 @@ static int __devinit ab8500_ponkey_probe(struct platform_device *pdev)
>  
>  	input_set_capability(input, EV_KEY, KEY_POWER);
>  
> +	ponkey->irq_dbf = ab8500_irq_get_virq(ab8500, ponkey->irq_dbf);

*sigh*

Can we please do the assignment earlier? Look, we have a few lines
above:

	ponkey->idev = input;
	ponkey->ab8500 = ab8500;
	ponkey->irq_dbf = irq_dbf;
	ponkey->irq_dbr = irq_dbr;

Why do you keep these assignments and then override them with
translations? Why don't you do

	ponkey->idev = input;
	ponkey->ab8500 = ab8500;
	ponkey->irq_dbf = ab8500_irq_get_virq(ab8500, irq_dbf);
	ponkey->irq_dbr = ab8500_irq_get_virq(ab8500, irq_dbr);

to begin with?

Thanks.
Lee Jones July 9, 2012, 8:34 p.m. UTC | #2
> Why do you keep these assignments and then override them with
> translations? Why don't you do
>
> 	ponkey->idev = input;
> 	ponkey->ab8500 = ab8500;
> 	ponkey->irq_dbf = ab8500_irq_get_virq(ab8500, irq_dbf);
> 	ponkey->irq_dbr = ab8500_irq_get_virq(ab8500, irq_dbr);
>
> to begin with?

Ah, I see what you mean now.

Sorry, just glossed over your first email.
diff mbox

Patch

diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c
index 5ceb23e..08d42d1 100644
--- a/drivers/input/misc/ab8500-ponkey.c
+++ b/drivers/input/misc/ab8500-ponkey.c
@@ -82,6 +82,7 @@  static int __devinit ab8500_ponkey_probe(struct platform_device *pdev)
 
 	input_set_capability(input, EV_KEY, KEY_POWER);
 
+	ponkey->irq_dbf = ab8500_irq_get_virq(ab8500, ponkey->irq_dbf);
 	error = request_any_context_irq(ponkey->irq_dbf, ab8500_ponkey_handler,
 					0, "ab8500-ponkey-dbf", ponkey);
 	if (error < 0) {
@@ -90,6 +91,7 @@  static int __devinit ab8500_ponkey_probe(struct platform_device *pdev)
 		goto err_free_mem;
 	}
 
+	ponkey->irq_dbr = ab8500_irq_get_virq(ab8500, ponkey->irq_dbr);
 	error = request_any_context_irq(ponkey->irq_dbr, ab8500_ponkey_handler,
 					0, "ab8500-ponkey-dbr", ponkey);
 	if (error < 0) {