From: Tejun Heo <htejun@gmail.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Jeff Garzik <jgarzik@pobox.com>,
Ash Willis <ashwillis@programmer.net>,
linux-pcmcia@lists.infradead.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 3/3] Makes lguest's irq handler typesafe
Date: Sat, 19 Jan 2008 08:12:33 +0900 [thread overview]
Message-ID: <47913261.5000708@gmail.com> (raw)
In-Reply-To: <200801190727.36567.rusty@rustcorp.com.au>
Rusty Russell wrote:
> Just a trivial example.
> ---
> drivers/lguest/lguest_device.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff -r 00ab7672f658 drivers/lguest/lguest_device.c
> --- a/drivers/lguest/lguest_device.c Thu Jan 17 16:54:00 2008 +1100
> +++ b/drivers/lguest/lguest_device.c Thu Jan 17 16:59:46 2008 +1100
> @@ -179,9 +179,8 @@ static void lg_notify(struct virtqueue *
> hcall(LHCALL_NOTIFY, lvq->config.pfn << PAGE_SHIFT, 0, 0);
> }
>
> -static irqreturn_t lguest_interrupt(int irq, void *_vq)
> +static irqreturn_t lguest_interrupt(int irq, struct virtqueue *vq)
> {
> - struct virtqueue *vq = _vq;
> struct lguest_device_desc *desc = to_lgdev(vq->vdev)->desc;
>
> if (unlikely(desc->config_change)) {
Type safety is good but I doubt this would be worth the complexity. It
has some benefits but there's much larger benefit in keeping things in
straight C. People know that functions take fixed types and are also
familiar with the convention of passing void * for callback arguments.
IMHO, staying in line with those common knowledges easily trumps having
type checking on interrupt handler.
Also, how often do we see a bug where things go wrong because interrupt
handler is given the wrong type of argument? Even when such bug
happens, I doubt it can escape the developer's workstation if he/she is
paying any attention to testing.
Thanks.
--
tejun
next prev parent reply other threads:[~2008-01-18 23:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-18 20:22 [PATCH 1/3] Improve type handling in interrupt handlers Rusty Russell
2008-01-18 20:25 ` [PATCH 2/3] Make IRQ handlers typesafe Rusty Russell
2008-01-18 20:25 ` Rusty Russell
2008-01-18 20:27 ` [PATCH 3/3] Makes lguest's irq handler typesafe Rusty Russell
2008-01-18 20:45 ` Jeff Garzik
2008-01-18 22:17 ` Rusty Russell
2008-01-18 22:17 ` Rusty Russell
2008-01-18 20:45 ` Jeff Garzik
2008-01-18 23:12 ` Tejun Heo
2008-01-18 23:12 ` Tejun Heo [this message]
2008-01-19 1:28 ` Rusty Russell
2008-01-19 1:40 ` Tejun Heo
2008-01-19 1:44 ` Tejun Heo
2008-01-19 3:59 ` Rusty Russell
2008-01-19 3:59 ` Rusty Russell
2008-01-19 4:08 ` Tejun Heo
2008-01-19 23:27 ` Rusty Russell
2008-01-19 23:27 ` Rusty Russell
2008-01-19 4:08 ` Tejun Heo
2008-01-19 1:44 ` Tejun Heo
2008-01-19 1:40 ` Tejun Heo
2008-01-19 1:28 ` Rusty Russell
2008-01-18 20:27 ` Rusty Russell
2008-01-18 20:43 ` [PATCH 2/3] Make IRQ handlers typesafe Jeff Garzik
2008-01-18 20:43 ` Jeff Garzik
2008-01-18 20:41 ` [PATCH 1/3] Improve type handling in interrupt handlers Jeff Garzik
2008-01-18 22:11 ` Rusty Russell
2008-01-18 22:54 ` Jeff Garzik
2008-01-19 1:29 ` Rusty Russell
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=47913261.5000708@gmail.com \
--to=htejun@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ashwillis@programmer.net \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pcmcia@lists.infradead.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.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.