From: Jan Kiszka <jan.kiszka@domain.hid>
To: adeos-main@gna.org
Cc: Philippe Gerum <rpm@xenomai.org>
Subject: [Adeos-main] [PATCH] let ipipe_catch_event return old handler
Date: Fri, 21 Apr 2006 16:38:53 +0200 [thread overview]
Message-ID: <4448EE7D.1020003@domain.hid> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 574 bytes --]
Hi,
this patch extends ipipe_catch_event() so that the previously registered
event handler is returned. The usage scenario are event listeners that
hook onto an existing listener for a specific domain, maybe filtering
events or simply overruling the original handler.
Note that this patch effectively removes the error detection from
ipipe_catch_event(), i.e. requests for event >= IPIPE_NR_EVENTS will be
silently ignored now. Regarding Xenomai as Ipipe user, this is a
non-issue as return codes are not checked there and only valid events
are passed.
Jan
[-- Attachment #1.2: catch_event.patch --]
[-- Type: text/plain, Size: 2451 bytes --]
Index: linux-2.6.16.1/include/linux/ipipe.h
===================================================================
--- linux-2.6.16.1.orig/include/linux/ipipe.h
+++ linux-2.6.16.1/include/linux/ipipe.h
@@ -125,9 +125,13 @@
typedef void (*ipipe_irq_handler_t)(unsigned irq,
void *cookie);
+#define IPIPE_SAME_HANDLER ((ipipe_irq_handler_t)(-1))
+
typedef int (*ipipe_irq_ackfn_t)(unsigned irq);
-#define IPIPE_SAME_HANDLER ((ipipe_irq_handler_t)(-1))
+typedef int (*ipipe_event_handler_t)(unsigned event,
+ struct ipipe_domain *from,
+ void *data);
struct ipipe_domain {
@@ -150,9 +154,7 @@
void *cookie;
} ____cacheline_aligned irqs[IPIPE_NR_IRQS];
- int (*evhand[IPIPE_NR_EVENTS])(unsigned event,
- struct ipipe_domain *from,
- void *data); /* Event handlers. */
+ ipipe_event_handler_t evhand[IPIPE_NR_EVENTS]; /* Event handlers. */
unsigned long long evself; /* Self-monitored event bits. */
#ifdef CONFIG_IPIPE_STATS
@@ -711,11 +713,9 @@
clear_bit(IPIPE_SPRINTK_FLAG, &ipd->flags);
}
-int ipipe_catch_event(struct ipipe_domain *ipd,
- unsigned event,
- int (*handler)(unsigned event,
- struct ipipe_domain *ipd,
- void *data));
+ipipe_event_handler_t ipipe_catch_event(struct ipipe_domain *ipd,
+ unsigned event,
+ ipipe_event_handler_t handler);
cpumask_t ipipe_set_irq_affinity(unsigned irq,
cpumask_t cpumask);
Index: linux-2.6.16.1/kernel/ipipe/generic.c
===================================================================
--- linux-2.6.16.1.orig/kernel/ipipe/generic.c
+++ linux-2.6.16.1/kernel/ipipe/generic.c
@@ -266,9 +266,9 @@
* ipipe_catch_event() -- Interpose or remove an event handler for a
* given domain.
*/
-int ipipe_catch_event(struct ipipe_domain *ipd,
- unsigned event,
- int (*handler)(unsigned event, struct ipipe_domain *ipd, void *data))
+ipipe_event_handler_t ipipe_catch_event(struct ipipe_domain *ipd,
+ unsigned event,
+ ipipe_event_handler_t handler)
{
int self = 0;
@@ -278,7 +278,7 @@
}
if (event >= IPIPE_NR_EVENTS)
- return -EINVAL;
+ return NULL;
if (!xchg(&ipd->evhand[event],handler)) {
if (handler) {
@@ -301,7 +301,7 @@
ipd->evself |= (1LL << event);
}
- return 0;
+ return handler;
}
cpumask_t ipipe_set_irq_affinity (unsigned irq, cpumask_t cpumask)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next reply other threads:[~2006-04-21 14:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-21 14:38 Jan Kiszka [this message]
2006-04-21 15:12 ` [Xenomai-core] Re: [Adeos-main] [PATCH] let ipipe_catch_event return old handler Philippe Gerum
2006-04-21 15:38 ` Jan Kiszka
2006-04-21 15:47 ` Philippe Gerum
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=4448EE7D.1020003@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=adeos-main@gna.org \
--cc=rpm@xenomai.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.