public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Zwane Mwaikambo <zwane@linuxpower.ca>,
	linux-kernel@vger.kernel.org, hch@infradead.org
Subject: Re: SET_MODULE_OWNER?
Date: Tue, 08 Apr 2003 00:39:46 -0400	[thread overview]
Message-ID: <3E925292.8060104@pobox.com> (raw)
In-Reply-To: <20030408035211.12EA02C225@lists.samba.org>

Rusty Russell wrote:
> In message <Pine.LNX.4.50.0304072212310.21025-100000@montezuma.mastecende.com> 
> you write:
> 
>>(e.g. pci-dma api changes). Regardless, here is a typical use in a 
>>netdriver.
>>
>>	/* dev and dev->priv zeroed in alloc_etherdev */
>>	dev = alloc_etherdev (sizeof (*tp));
>>	if (dev == NULL) {
>>		printk (KERN_ERR PFX "%s: Unable to alloc new net device\n", pd
> 
> ev->slot_name);
> 
>>		return -ENOMEM;
>>	}
>>	SET_MODULE_OWNER(dev);
>>	tp = dev->priv;
>>	
>>	/* followed by ... */
>>	dev->foo = __foo;
>>	dev->bar = __bar;
> 
> 
> I don't understand how that helps compatibility over:
> 
> 	dev->owner = THIS_MODULE;
> 
> Both will:
> 1) Work on 2.4 and 2.5
> 2) Break on 2.2.


Wrong.

SET_MODULE_OWNER works in 2.2 _and earlier_... given some compat glue in 
a "#include <kcompat>" macros.

You may take a look at "kcompat" for further examples. 
http://sf.net/projects/gkernel/   I provide an example of how to get a 
net driver from 2.4 running under 2.2, such that the 2.4 driver 
-appears- to be completely free of compatibility glue.

The only sticking points in such glue are when structure members are 
directly exposed in the source code.  That cannot be worked around with 
cpp magic.  This is why SET_MODULE_OWNER exists, this is why 
pci_{get,set}_drvdata() exist, and so on.

	Jeff




  reply	other threads:[~2003-04-08  4:27 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         ` Jeff Garzik [this message]
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               ` SET_MODULE_OWNER? Jamie Lokier
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=3E925292.8060104@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=hch@infradead.org \
    --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