From: Jean Delvare <khali@linux-fr.org>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Gerd Knorr <kraxel@bytesex.org>
Subject: [PATCH 2.4] I2C: Cleanup a couple media/video drivers
Date: Tue, 4 Jan 2005 14:44:36 +0100 [thread overview]
Message-ID: <20050104144436.5e7bc84c.khali@linux-fr.org> (raw)
Hi Marcelo, hi all,
Two media/video drivers in 2.4 have a compatibility trick to make them
work when the kernel tree is patched with i2c 2.8.x. The trick also
allowed to share the same code between Linux 2.4 and 2.5/2.6.
Unfortunately, the trick relies on one define (I2C_PEC) to define (or
not) structure members that are not related with that define at all.
That define was picked just because it happened to be present in i2c
2.8.x and the 2.5/2.6 kernel trees, but not in the (unpatched) 2.4
kernel tree. Basically, the trick was to switch to the new structure
members (found in i2c 2.8.x and the 2.5/2.6 kernels) if I2C_PEC was
defined.
The problem now is that i2c 2.9.0, which was just released, has stepped
back on the changes that had made i2c 2.8.x uncompatible with the 2.4
kernels, to the great joy of i2c/lm_sensors distro packagers and i2c
patch maintainer (i.e. me). Because i2c 2.9.0 still defines I2C_PEC but
uses the old structure members, the trick doesn't work anymore. (No
surprise, that's what happens when you rely on something to take an
unrelated decision just because it seems to work at some point.) Since
the 2.8.x series of i2c is now considered deprecated and unsupported,
the easiest way to get things back in order is to get rid of the trick
altogether. This will make i2c 2.9.0 work while breaking i2c 2.8.x,
which is OK.
The affected drivers are bttv-if and tvmixer. I asked Gerd and he told
me he had no objection to the cleanups I propose.
Note that both the trick and its removal only have an effect when
patching the kernel tree with i2c 2.8.0 or later. This means that the
proposed change is necessarily safe for vanilla kernel users.
Patch follows, please apply. The patch is also available online at:
http://khali.linux-fr.org/devel/i2c/linux-2.4.28/linux-2.4.28-i2c-2.9.0-drivers-media-video.diff
Thanks.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
--- linux-2.4.29-pre3/drivers/media/video/bttv-if.c.orig 2003-11-28 19:26:20.000000000 +0100
+++ linux-2.4.29-pre3/drivers/media/video/bttv-if.c 2004-12-04 15:13:46.000000000 +0100
@@ -190,7 +190,6 @@
return state;
}
-#ifndef I2C_PEC
static void bttv_inc_use(struct i2c_adapter *adap)
{
MOD_INC_USE_COUNT;
@@ -200,7 +199,6 @@
{
MOD_DEC_USE_COUNT;
}
-#endif
static int attach_inform(struct i2c_client *client)
{
@@ -243,12 +241,8 @@
};
static struct i2c_adapter bttv_i2c_adap_template = {
-#ifdef I2C_PEC
- .owner = THIS_MODULE,
-#else
.inc_use = bttv_inc_use,
.dec_use = bttv_dec_use,
-#endif
#ifdef I2C_ADAP_CLASS_TV_ANALOG
.class = I2C_ADAP_CLASS_TV_ANALOG,
#endif
--- linux-2.4.29-pre3/drivers/media/video/tvmixer.c.orig 2004-12-04 15:20:20.000000000 +0100
+++ linux-2.4.29-pre3/drivers/media/video/tvmixer.c 2004-12-04 15:20:07.000000000 +0100
@@ -193,10 +193,8 @@
/* lock bttv in memory while the mixer is in use */
file->private_data = mix;
-#ifndef I2C_PEC
if (client->adapter->inc_use)
client->adapter->inc_use(client->adapter);
-#endif
return 0;
}
@@ -210,17 +208,12 @@
return -ENODEV;
}
-#ifndef I2C_PEC
if (client->adapter->dec_use)
client->adapter->dec_use(client->adapter);
-#endif
return 0;
}
static struct i2c_driver driver = {
-#ifdef I2C_PEC
- .owner = THIS_MODULE,
-#endif
.name = "tv card mixer driver",
.id = I2C_DRIVERID_TVMIXER,
#ifdef I2C_DF_DUMMY
--
Jean Delvare
http://khali.linux-fr.org/
reply other threads:[~2005-01-04 13:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050104144436.5e7bc84c.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=kraxel@bytesex.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
/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
Powered by JetHome