From: Denys Vlasenko <vda.linux@googlemail.com>
To: Rene Herman <rene.herman@gmail.com>
Cc: Adrian Bunk <bunk@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
Kai Germaschewski <kai@germaschewski.name>,
Sam Ravnborg <sam@ravnborg.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
ALSA devel <alsa-devel@alsa-project.org>
Subject: Re: Per option CFLAGS?
Date: Sat, 15 Sep 2007 16:53:47 +0100 [thread overview]
Message-ID: <200709151653.48351.vda.linux@googlemail.com> (raw)
In-Reply-To: <46EBF774.2030306@gmail.com>
On Saturday 15 September 2007 16:17, Rene Herman wrote:
> On 09/15/2007 10:47 AM, Adrian Bunk wrote:
> >>> The stub source file is usually considered a good way to do this.
> >> Mmm. If I'll have to live with it, I can, but thought I'd ask if there was
> >> some nice build trickery available instead.
> >
> > The usual trick is to create _three_ modules:
> >
> > Two with the foo2000 and foo2001 specific parts, and a third one with
> > all code used by both.
> >
> > Or if foo2000 and foo2001 differ only in small details, create one
> > snd-foo200x module supporting both at the same time.
>
> Thanks for the comment. Yes, first would be massive overkill in this case
> and second somewhat annoying as one of the differences is support for
> different resources (IRQs) among the two versions, whereas I'm checking the
> validity of the passed in values at a time I do not know which version I'm
> looking at yet -- knowing that requires having talked to the hardware.
If I understood you right, this is PCI, USB or other kind of devices
where module is selected according to PCI/USB/whatever IDs.
You thinking is - if module foo2000 is loaded, this is definitely a
2000 device and you can "check the validity of the passed in values"
for the device 2000 now.
Correct me if I'm wrong.
But you can do absolutely the same at runtime in unified driver,
since PCI/USB/whatever IDs are accessible to the driver.
Two drivers will most likely have code duplication.
Unified driver will be harder to read and maintain because of all
ifs/switch's/function pointers you need.
The choice depends on *how much* maintainability pain you can
tolerate by taking "unified code" path.
> Can do, but for now it seems like the two seperate modules might be cleaner.
Can you give a bit more info what the dirrefences between devices are
in this particular cases?
--
vda
next prev parent reply other threads:[~2007-09-15 15:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 23:07 Per option CFLAGS? Rene Herman
2007-09-14 23:13 ` H. Peter Anvin
2007-09-14 23:30 ` Rene Herman
2007-09-15 8:47 ` Adrian Bunk
2007-09-15 15:17 ` Rene Herman
2007-09-15 15:52 ` Adrian Bunk
2007-09-15 15:53 ` Denys Vlasenko [this message]
2007-09-15 15:59 ` Rene Herman
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=200709151653.48351.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=alsa-devel@alsa-project.org \
--cc=bunk@kernel.org \
--cc=hpa@zytor.com \
--cc=kai@germaschewski.name \
--cc=linux-kernel@vger.kernel.org \
--cc=rene.herman@gmail.com \
--cc=sam@ravnborg.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;
as well as URLs for NNTP newsgroup(s).