From: Jamie Lokier <jamie@shareable.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Rusty Russell <rusty@rustcorp.com.au>,
zwane@linuxpower.ca,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
hch@infradead.org
Subject: Re: SET_MODULE_OWNER?
Date: Tue, 8 Apr 2003 17:45:01 +0100 [thread overview]
Message-ID: <20030408164501.GA30428@mail.jlokier.co.uk> (raw)
In-Reply-To: <20030408151226.GA30285@gtf.org>
Jeff Garzik wrote:
> No. Because Rusty wanted to replace a "func_call()" object with a
> direct reference to a structure. Direct struct member references is the
> big issue that we are trying to _avoid_, because they are the single
> most painful issue to deal with, WRT source back-compat. You can ifdef
> around a function quite easily, but not a direct struct member use.
>
> To give another concrete example, I was able to take a 2.4 PCI driver
> and make it work under 2.2 transparently, with a single exception: The
> "driver_data" member of the new struct pci_dev. Drivers were directly
> referencing that, which was a new addition in 2.4.x (really 2.3.x). So,
> I created the abstraction wrappers pci_[gs]et_drvdata(), which does
> nothing but a simple C assignment (or read, for _get_). The addition of
> this wrapper removed the need for nasty ifdefs in the drivers for 2.2
> versus 2.4, and make it possible for the kernel source to continue to be
> readable, "pretty", and ifdef-free.
I've done similar things myself. My drivers, including network and
char devices, work on all kernels from 2.0 to 2.4 using similar
kcompat-like macros. I've not extended any to work with 2.5, though.
If you want to write drivers that work on 2.4 and 2.2 kernels, that's
easy: #include <kcompat.h> or whatever you use, and call
SET_MODULE_OWNER in your drivers.
However, if you insist on using drivers from the 2.4 kernel tree on
2.2 kernels, that's a different matter, and you have a point.
For 3rd party drivers that I've written, I take the first approach and
write code that very nearly conforms to 2.4 style except when it is
not possible for that to be back compatible. This occurs in certain
file operations (2.0 has different function prototypes), in mapping
device memory to user space (change from vma->vm_offset to ->vm_pgoff,
PCI configuration (lots of changes in 2.1.93 :) and a few other
things.
It is all very well to insist that SET_MODULE_OWNER() remains so you
can take 2.4 drivers and easily compile them for 2.2... but why is
that the benchmark? I can't take 2.4 drivers and do that, because I
want to support 2.0 as well, so I bite the bullet and make the
necessary changes for broader compatibility.
So.. back to a point. Is 2.2 compilability (with the help of kcompat)
one of the goals to aim for in 2.5 drivers generally? Or is this
specifically meant for the network drivers which you support?
Cheers,
-- Jamie
next prev parent reply other threads:[~2003-04-08 16:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-07 6:47 SET_MODULE_OWNER? Rusty Russell
2003-04-07 8:17 ` SET_MODULE_OWNER? Christoph Hellwig
2003-04-07 18:29 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-08 2:01 ` SET_MODULE_OWNER? Rusty Russell
2003-04-08 2:16 ` SET_MODULE_OWNER? Zwane Mwaikambo
2003-04-08 3:41 ` SET_MODULE_OWNER? Rusty Russell
2003-04-08 4:39 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-09 0:46 ` SET_MODULE_OWNER? Rusty Russell
2003-04-09 2:32 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-08 2:27 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-08 3:46 ` SET_MODULE_OWNER? Rusty Russell
2003-04-08 6:00 ` SET_MODULE_OWNER? Christoph Hellwig
2003-04-08 11:51 ` SET_MODULE_OWNER? Alan Cox
2003-04-08 14:46 ` SET_MODULE_OWNER? Jamie Lokier
2003-04-08 15:12 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-08 16:45 ` Jamie Lokier [this message]
2003-04-08 17:19 ` SET_MODULE_OWNER? Jeff Garzik
[not found] <3E92515B.6030807@pobox.com>
2003-04-08 12:25 ` SET_MODULE_OWNER? Rusty Russell
2003-04-09 0:13 ` SET_MODULE_OWNER? David S. Miller
2003-04-09 1:03 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-09 3:23 ` SET_MODULE_OWNER? Rusty Russell
2003-04-09 3:48 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-09 15:00 ` SET_MODULE_OWNER? Kai Germaschewski
[not found] <3E93AA3D.4050104@pobox.com>
2003-04-09 5:27 ` SET_MODULE_OWNER? 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=20030408164501.GA30428@mail.jlokier.co.uk \
--to=jamie@shareable.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=hch@infradead.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=zwane@linuxpower.ca \
/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
all inboxes | Powered by JetHome®