From: Ian Romanick <idr@us.ibm.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Dave Jones <davej@redhat.com>, Dave Airlie <airlied@linux.ie>,
linux-kernel@vger.kernel.org
Subject: Re: [rfc][patch] DRM initial function table support.
Date: Tue, 31 Aug 2004 10:52:12 -0700 [thread overview]
Message-ID: <4134BACC.60203@us.ibm.com> (raw)
In-Reply-To: <20040831180129.A23112@infradead.org>
Christoph Hellwig wrote:
> On Tue, Aug 31, 2004 at 09:07:11AM -0700, Ian Romanick wrote:
>
>>I think the intention is to have default functions set in the
>>device-independent code and have the device-dependent code over-ride
>>them. Since the defaults may not always be NULL, doing a struct like
>>that wouldn't really work. I suppose we could have a struct and a
>>device-independent function that copies the non-NULL pointers from the
>>per-device struct. Would that be better?
>
> Don't copy them. Just put
>
> if (foo->ops->method1)
> foo->ops->method1(args);
> else
> generic_method1(args);
>
> in your code. It's an additional branch, but you avoid the indirect
> functioncalloverhead in exchange.
<MrHorse>No sir, I didn't like it.</MrHorse> That would not only be
ugly to read, but it would add maintenance burden. If the default
changes from NULL to non-NULL, code has to be changed from doing nothing
in the NULL case to calling generic_method1. The one place that we miss
is the one place that will crash Linus' box. :)
next prev parent reply other threads:[~2004-08-31 17:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-31 13:11 [rfc][patch] DRM initial function table support Dave Airlie
2004-08-31 15:20 ` Dave Jones
2004-08-31 16:07 ` Ian Romanick
2004-08-31 17:01 ` Christoph Hellwig
2004-08-31 17:52 ` Ian Romanick [this message]
2004-08-31 23:39 ` Dave Airlie
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=4134BACC.60203@us.ibm.com \
--to=idr@us.ibm.com \
--cc=airlied@linux.ie \
--cc=davej@redhat.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox