public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jon Smirl <jonsmirl@gmail.com>
To: "viro@parcelfarce.linux.theplanet.co.uk" 
	<viro@parcelfarce.linux.theplanet.co.uk>
Cc: lkml <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.sourceforge.net>
Subject: Re: __initcall macros and C token pasting
Date: Sat, 25 Sep 2004 15:17:14 -0400	[thread overview]
Message-ID: <9e473391040925121774e7e1e1@mail.gmail.com> (raw)
In-Reply-To: <20040925183234.GU23987@parcelfarce.linux.theplanet.co.uk>

To start off with, I didn't write the DRM macros, I'm just trying to
work with the code that is already there. Here's my understanding of
the state of the macros...

The DRM macros are there because of the way DRM is built. There are
two pieces of DRM, the core and the chip drivers. Most drivers, like
fbdev, make the core into one module and the chip drivers into others.
This allows the chip drivers to share the core code.

DRM is built differently. The core is linked into each chip driver.
This lets you get drivers from different places (ATI) that might use a
core that doesn't match the one in your kernel. If you load two DRM
drivers you will get two copies of the core.

With modules this doesn't make a difference. But instead, if you link
these drivers into the kernel you get a bunch of symbol conflicts from
the duplicated cores. This is where the DRM() macro come into play.
The DRM() macros give the radeon driver core distinct symbol names
from the other drivers. This lets you link in drivers for all of the
chips if you want to without causing symbol conflicts.

I'm building a test version of DRM that uses a core model like fbdev
does. Doing this allows me to remove the DRM() macros.

However this has a side effect. DRM drivers are distributed outside of
the kernel. This leads to the possibility of wanting two drivers
simultaneously loaded that need different versions of the core.
Without the DRM macros we can only have one version of the core
loaded. What are you going to do?

One response is to build a stable API for the core. This may come over
time but right now this interface is very volatile. It's also obvious
that vendors shouldn't build DRM core into the kernel in case an
outside driver needs to replace it.

So it looks like the downside to getting rid of the macros is that
people who are running multiple video cards can't mix drivers with
drivers from outside the tree. This used to work but creating DRM core
will break it. The solution to this seems to be for vendors with
drivers outside of the tree to add the DRM macros to their derivative
code base in order to stop the symbol conflicts.

The new DRM core version for Linux 2.6 that I'm building also
incorporates GPL code. It's unclear how that is going to impact
outside drivers.

-- 
Jon Smirl
jonsmirl@gmail.com

  parent reply	other threads:[~2004-09-25 19:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-25 17:57 __initcall macros and C token pasting Jon Smirl
2004-09-25 18:32 ` viro
2004-09-25 18:40   ` Jon Smirl
2004-09-25 19:17   ` Jon Smirl [this message]
2004-09-26 17:21     ` Olivier Galibert
2004-09-26 17:24       ` Tonnerre
2004-09-26 17:42         ` Christoph Hellwig
2004-09-26 19:56         ` Geert Uytterhoeven

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=9e473391040925121774e7e1e1@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=dri-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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