From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v3] xen/keyhandler: Rework keyhandler infrastructure
Date: Thu, 24 Sep 2015 13:09:50 +0100 [thread overview]
Message-ID: <5603E80E.8090606@citrix.com> (raw)
In-Reply-To: <5604016A02000078000A5476@prv-mh.provo.novell.com>
On 24/09/15 12:58, Jan Beulich wrote:
>>>> On 24.09.15 at 13:47, <andrew.cooper3@citrix.com> wrote:
>> On 24/09/15 12:46, Jan Beulich wrote:
>>>>>> On 24.09.15 at 13:05, <andrew.cooper3@citrix.com> wrote:
>>>> +static struct keyhandler {
>>>> + union {
>>>> + keyhandler_fn_t *fn;
>>>> + irq_keyhandler_fn_t *irq_fn;
>>>> + };
>>>> +
>>>> + const char *desc; /* Description for help message.
>> */
>>>> + bool_t irq_callback, /* Call in irq context? if not, tasklet context.
>> */
>>>> + diagnostic; /* Include in 'dump all' handler.
>> */
>>>> +} key_table[128] __read_mostly =
>>>> +{
>>>> +#define KEYHANDLER(k, f, desc, diag) \
>>>> + [k] = { .fn = (f), desc, 0, diag }
>>>> +
>>>> +#define IRQ_KEYHANDLER(k, f, desc, diag) \
>>>> + [k] = { .irq_fn = (f), desc, 1, diag }
>>> I'm sorry for noticing only now, but I'm afraid these (looking as
>>> odd - but correct - as the other ones did) won't build with older
>>> gcc either.
>> Urgh yes. I think we might have to just explicitly typecast the
>> pointer, because .irq_fn is uninitialised in older GCC. Would that be ok?
> Yes, certainly better than re-adding the u name. Another
> alternative would be a void * as the first union alternative,
> but I suppose future gcc might become more strict about
> conversions between function and data pointers...
This appears to work for me.
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 7d168e9..8c43d85 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -43,10 +43,10 @@
} key_table[128] __read_mostly =
{
#define KEYHANDLER(k, f, desc, diag) \
- [k] = { .fn = (f), desc, 0, diag }
+ [k] = { { f }, desc, 0, diag }
#define IRQ_KEYHANDLER(k, f, desc, diag) \
- [k] = { .irq_fn = (f), desc, 1, diag }
+ [k] = { { (keyhandler_fn_t*)f }, desc, 1, diag }
IRQ_KEYHANDLER('A', do_toggle_alt_key, "toggle alternative key
handling", 0),
IRQ_KEYHANDLER('d', dump_registers, "dump registers", 1),
next prev parent reply other threads:[~2015-09-24 12:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 11:05 [PATCH v3] xen/keyhandler: Rework keyhandler infrastructure Andrew Cooper
2015-09-24 11:46 ` Jan Beulich
2015-09-24 11:47 ` Andrew Cooper
2015-09-24 11:58 ` Jan Beulich
2015-09-24 12:09 ` Andrew Cooper [this message]
2015-09-24 12:15 ` Jan Beulich
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=5603E80E.8090606@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xen.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.