From: Martyn Welch <martyn.welch@ge.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>,
linuxppc-dev@ozlabs.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org
Subject: Re: [PATCH v3] powerpc: Add i8042 keyboard and mouse irq parsing
Date: Tue, 01 Jun 2010 13:41:59 +0100 [thread overview]
Message-ID: <4C050017.10905@ge.com> (raw)
In-Reply-To: <1275104126.1931.521.camel@pasglop>
Benjamin Herrenschmidt wrote:
> O
>
>> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
>> index 48f0a00..3d169bb 100644
>> --- a/arch/powerpc/kernel/setup-common.c
>> +++ b/arch/powerpc/kernel/setup-common.c
>> @@ -94,6 +94,10 @@ struct screen_info screen_info = {
>> .orig_video_points = 16
>> };
>>
>> +/* Variables required to store legacy IO irq routing */
>> +int of_i8042_kbd_irq;
>> +int of_i8042_aux_irq;
>>
>
> Is there a reasonable ifdef to use for the above or we don't care ?
>
>
>> #ifdef __DO_IRQ_CANON
>> /* XXX should go elsewhere eventually */
>> int ppc_do_canonicalize_irqs;
>> @@ -567,6 +571,15 @@ int check_legacy_ioport(unsigned long base_port)
>> np = of_find_compatible_node(NULL, NULL, "pnpPNP,f03");
>> if (np) {
>> parent = of_get_parent(np);
>> +
>> + of_i8042_kbd_irq = irq_of_parse_and_map(parent, 0);
>> + if (!of_i8042_kbd_irq)
>> + of_i8042_kbd_irq = 1;
>> +
>> + of_i8042_aux_irq = irq_of_parse_and_map(parent, 1);
>> + if (!of_i8042_aux_irq)
>> + of_i8042_aux_irq = 12;
>> +
>> of_node_put(np);
>> np = parent;
>> break;
>> diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h
>> index 847f4aa..5d48bb6 100644
>> --- a/drivers/input/serio/i8042-io.h
>> +++ b/drivers/input/serio/i8042-io.h
>> @@ -27,6 +27,11 @@
>> #include <asm/irq.h>
>> #elif defined(CONFIG_SH_CAYMAN)
>> #include <asm/irq.h>
>> +#elif defined(CONFIG_PPC)
>> +extern int of_i8042_kbd_irq;
>> +extern int of_i8042_aux_irq;
>> +# define I8042_KBD_IRQ of_i8042_kbd_irq
>> +# define I8042_AUX_IRQ of_i8042_aux_irq
>> #else
>> # define I8042_KBD_IRQ 1
>> # define I8042_AUX_IRQ 12
>>
>
> Now while that works, I do tend to dislike global variables like that.
>
> _Maybe_ a better approach would be to have those #define resolve to
> functions:
>
> #define I8042_KBD_IRQ of_find_i8042_kbd_irq()
>
> Or something like that ?
>
> That means ending up having 2 functions which more/less reproduce the
> loop to find the driver in the device-tree but that's a minor
> inconvenience.
>
> Now, maybe the variables are less bloat here. What do you think ? Which
> way do you prefer ?
>
>
Personally, I'm happy either way. If you'd prefer I implement these as
functions, I can't quickly see why that wouldn't work. I thought using
variables would be the least disruptive.
I'm also happy to change it so that the irqs are specified in the kbd
and aux nodes (I agree it would make much more sense and was how the
first revision of this patch worked).
Either way, my preferred solution is that contained in this patch,
unless those with more experience agree otherwise... ;-)
Martyn
> Cheers,
> Ben.
>
>
>
--
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms | Wales (3828642) at 100
T +44(0)127322748 | Barbirolli Square, Manchester,
E martyn.welch@ge.com | M2 3AB VAT:GB 927559189
WARNING: multiple messages have this Message-ID (diff)
From: Martyn Welch <martyn.welch@ge.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org
Subject: Re: [PATCH v3] powerpc: Add i8042 keyboard and mouse irq parsing
Date: Tue, 01 Jun 2010 13:41:59 +0100 [thread overview]
Message-ID: <4C050017.10905@ge.com> (raw)
In-Reply-To: <1275104126.1931.521.camel@pasglop>
Benjamin Herrenschmidt wrote:
> O
>
>> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
>> index 48f0a00..3d169bb 100644
>> --- a/arch/powerpc/kernel/setup-common.c
>> +++ b/arch/powerpc/kernel/setup-common.c
>> @@ -94,6 +94,10 @@ struct screen_info screen_info = {
>> .orig_video_points = 16
>> };
>>
>> +/* Variables required to store legacy IO irq routing */
>> +int of_i8042_kbd_irq;
>> +int of_i8042_aux_irq;
>>
>
> Is there a reasonable ifdef to use for the above or we don't care ?
>
>
>> #ifdef __DO_IRQ_CANON
>> /* XXX should go elsewhere eventually */
>> int ppc_do_canonicalize_irqs;
>> @@ -567,6 +571,15 @@ int check_legacy_ioport(unsigned long base_port)
>> np = of_find_compatible_node(NULL, NULL, "pnpPNP,f03");
>> if (np) {
>> parent = of_get_parent(np);
>> +
>> + of_i8042_kbd_irq = irq_of_parse_and_map(parent, 0);
>> + if (!of_i8042_kbd_irq)
>> + of_i8042_kbd_irq = 1;
>> +
>> + of_i8042_aux_irq = irq_of_parse_and_map(parent, 1);
>> + if (!of_i8042_aux_irq)
>> + of_i8042_aux_irq = 12;
>> +
>> of_node_put(np);
>> np = parent;
>> break;
>> diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h
>> index 847f4aa..5d48bb6 100644
>> --- a/drivers/input/serio/i8042-io.h
>> +++ b/drivers/input/serio/i8042-io.h
>> @@ -27,6 +27,11 @@
>> #include <asm/irq.h>
>> #elif defined(CONFIG_SH_CAYMAN)
>> #include <asm/irq.h>
>> +#elif defined(CONFIG_PPC)
>> +extern int of_i8042_kbd_irq;
>> +extern int of_i8042_aux_irq;
>> +# define I8042_KBD_IRQ of_i8042_kbd_irq
>> +# define I8042_AUX_IRQ of_i8042_aux_irq
>> #else
>> # define I8042_KBD_IRQ 1
>> # define I8042_AUX_IRQ 12
>>
>
> Now while that works, I do tend to dislike global variables like that.
>
> _Maybe_ a better approach would be to have those #define resolve to
> functions:
>
> #define I8042_KBD_IRQ of_find_i8042_kbd_irq()
>
> Or something like that ?
>
> That means ending up having 2 functions which more/less reproduce the
> loop to find the driver in the device-tree but that's a minor
> inconvenience.
>
> Now, maybe the variables are less bloat here. What do you think ? Which
> way do you prefer ?
>
>
Personally, I'm happy either way. If you'd prefer I implement these as
functions, I can't quickly see why that wouldn't work. I thought using
variables would be the least disruptive.
I'm also happy to change it so that the irqs are specified in the kbd
and aux nodes (I agree it would make much more sense and was how the
first revision of this patch worked).
Either way, my preferred solution is that contained in this patch,
unless those with more experience agree otherwise... ;-)
Martyn
> Cheers,
> Ben.
>
>
>
--
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms | Wales (3828642) at 100
T +44(0)127322748 | Barbirolli Square, Manchester,
E martyn.welch@ge.com | M2 3AB VAT:GB 927559189
next prev parent reply other threads:[~2010-06-01 12:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-25 8:09 [PATCH v3] powerpc: Add i8042 keyboard and mouse irq parsing Martyn Welch
2010-05-25 20:21 ` Grant Likely
2010-05-25 20:21 ` Grant Likely
[not found] ` <AANLkTikve-ZghgpVl3cyjjgWAch-oCJ0EiYK2127f5gS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-05-25 23:19 ` Mitch Bradley
2010-05-25 23:19 ` Mitch Bradley
2010-05-29 3:35 ` Benjamin Herrenschmidt
2010-05-29 3:35 ` Benjamin Herrenschmidt
2010-05-29 3:35 ` Benjamin Herrenschmidt
2010-06-01 12:41 ` Martyn Welch [this message]
2010-06-01 12:41 ` Martyn Welch
2010-06-02 6:26 ` Dmitry Torokhov
2010-06-02 6:26 ` Dmitry Torokhov
2010-06-02 7:25 ` Benjamin Herrenschmidt
2010-06-02 7:25 ` Benjamin Herrenschmidt
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=4C050017.10905@ge.com \
--to=martyn.welch@ge.com \
--cc=benh@kernel.crashing.org \
--cc=dmitry.torokhov@gmail.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-input@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.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.