* [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
@ 2005-08-15 17:57 Jean Delvare
2005-08-22 20:09 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 9+ messages in thread
From: Jean Delvare @ 2005-08-15 17:57 UTC (permalink / raw)
To: LKML, video4linux-list; +Cc: Greg KH
Hi all,
I2C_DEVNAME and i2c_clientname were introduced in 2.5.68 [1] to help
media/video driver authors who wanted their code to be compatible with
both Linux 2.4 and 2.6. The cause of the incompatibility has gone since
[2], so I think we can get rid of them, as they tend to make the code
harder to read and longer to preprocess/compile for no more benefit.
I'd hope nobody seriously attempts to keep media/video driver compatible
across Linux trees anymore, BTW.
[1] http://marc.theaimsgroup.com/?l=linux-kernel&m=104930186524598&w=2
[2] http://www.linuxhq.com/kernel/v2.6/0-test3/include/linux/i2c.h
This patch is meant to reach -mm through Greg's i2c tree.
Thanks.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/media/video/bt832.c | 2
drivers/media/video/bttv-i2c.c | 8 ++--
drivers/media/video/cx88/cx88-i2c.c | 8 ++--
drivers/media/video/ir-kbd-i2c.c | 2
drivers/media/video/msp3400.c | 4 +-
drivers/media/video/ovcamchip/ovcamchip_core.c | 6 ++--
drivers/media/video/saa7134/saa6752hs.c | 2
drivers/media/video/saa7134/saa7134-i2c.c | 6 ++--
drivers/media/video/tda7432.c | 2
drivers/media/video/tda9840.c | 2
drivers/media/video/tda9875.c | 2
drivers/media/video/tda9887.c | 2
drivers/media/video/tea6415c.c | 2
drivers/media/video/tea6420.c | 2
drivers/media/video/tuner-core.c | 2
drivers/media/video/tvaudio.c | 41 ++++++++++++-------------
drivers/media/video/tvmixer.c | 8 ++--
drivers/media/video/zoran_card.c | 2
drivers/usb/media/w9968cf.c | 8 ++---
include/linux/i2c.h | 7 ----
20 files changed, 53 insertions(+), 65 deletions(-)
--- linux-2.6.13-rc6.orig/drivers/media/video/bt832.c 2005-08-11 23:10:47.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/bt832.c 2005-08-12 21:22:45.000000000 +0200
@@ -241,7 +241,7 @@
};
static struct i2c_client client_template =
{
- I2C_DEVNAME("bt832"),
+ .name = "bt832",
.flags = I2C_CLIENT_ALLOW_USE,
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/bttv-i2c.c 2005-08-11 23:10:47.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/bttv-i2c.c 2005-08-12 21:22:45.000000000 +0200
@@ -109,7 +109,7 @@
#ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG,
#endif
- I2C_DEVNAME("bt848"),
+ .name = "bt848",
.id = I2C_HW_B_BT848,
.client_register = attach_inform,
};
@@ -280,7 +280,7 @@
#ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG,
#endif
- I2C_DEVNAME("bt878"),
+ .name = "bt878",
.id = I2C_HW_B_BT848 /* FIXME */,
.algo = &bttv_algo,
.client_register = attach_inform,
@@ -296,7 +296,7 @@
if (bttv_debug)
printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n",
btv->c.nr,client->driver->name,client->addr,
- i2c_clientname(client));
+ client->name);
if (!client->driver->command)
return 0;
@@ -324,7 +324,7 @@
}
static struct i2c_client bttv_i2c_client_template = {
- I2C_DEVNAME("bttv internal"),
+ .name = "bttv internal",
};
--- linux-2.6.13-rc6.orig/drivers/media/video/ir-kbd-i2c.c 2005-08-11 23:10:48.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/ir-kbd-i2c.c 2005-08-12 21:22:45.000000000 +0200
@@ -308,7 +308,7 @@
static struct i2c_client client_template =
{
- I2C_DEVNAME("unset"),
+ .name = "unset",
.driver = &driver
};
--- linux-2.6.13-rc6.orig/drivers/media/video/msp3400.c 2005-08-09 19:26:35.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/msp3400.c 2005-08-12 21:22:45.000000000 +0200
@@ -1437,7 +1437,7 @@
static struct i2c_client client_template =
{
- I2C_DEVNAME("(unset)"),
+ .name = "(unset)",
.flags = I2C_CLIENT_ALLOW_USE,
.driver = &driver,
};
@@ -1509,7 +1509,7 @@
}
/* hello world :-) */
- printk(KERN_INFO "msp34xx: init: chip=%s",i2c_clientname(c));
+ printk(KERN_INFO "msp34xx: init: chip=%s", c->name);
if (HAVE_NICAM(msp))
printk(" +nicam");
if (HAVE_SIMPLE(msp))
--- linux-2.6.13-rc6.orig/drivers/usb/media/w9968cf.c 2005-08-11 23:10:47.000000000 +0200
+++ linux-2.6.13-rc6/drivers/usb/media/w9968cf.c 2005-08-12 21:22:45.000000000 +0200
@@ -1523,7 +1523,6 @@
static int w9968cf_i2c_attach_inform(struct i2c_client* client)
{
struct w9968cf_device* cam = i2c_get_adapdata(client->adapter);
- const char* clientname = i2c_clientname(client);
int id = client->driver->id, err = 0;
if (id == I2C_DRIVERID_OVCAMCHIP) {
@@ -1535,12 +1534,12 @@
}
} else {
DBG(4, "Rejected client [%s] with driver [%s]",
- clientname, client->driver->name)
+ client->name, client->driver->name)
return -EINVAL;
}
DBG(5, "I2C attach client [%s] with driver [%s]",
- clientname, client->driver->name)
+ client->name, client->driver->name)
return 0;
}
@@ -1549,12 +1548,11 @@
static int w9968cf_i2c_detach_inform(struct i2c_client* client)
{
struct w9968cf_device* cam = i2c_get_adapdata(client->adapter);
- const char* clientname = i2c_clientname(client);
if (cam->sensor_client == client)
cam->sensor_client = NULL;
- DBG(5, "I2C detach client [%s]", clientname)
+ DBG(5, "I2C detach client [%s]", client->name)
return 0;
}
--- linux-2.6.13-rc6.orig/drivers/media/video/cx88/cx88-i2c.c 2005-08-09 19:26:35.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/cx88/cx88-i2c.c 2005-08-12 21:22:45.000000000 +0200
@@ -95,7 +95,7 @@
struct cx88_core *core = i2c_get_adapdata(client->adapter);
dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
- client->driver->name,client->addr,i2c_clientname(client));
+ client->driver->name, client->addr, client->name);
if (!client->driver->command)
return 0;
@@ -128,7 +128,7 @@
{
struct cx88_core *core = i2c_get_adapdata(client->adapter);
- dprintk(1, "i2c detach [client=%s]\n", i2c_clientname(client));
+ dprintk(1, "i2c detach [client=%s]\n", client->name);
return 0;
}
@@ -152,7 +152,7 @@
/* ----------------------------------------------------------------------- */
static struct i2c_adapter cx8800_i2c_adap_template = {
- I2C_DEVNAME("cx2388x"),
+ .name = "cx2388x",
.owner = THIS_MODULE,
.id = I2C_HW_B_CX2388x,
.client_register = attach_inform,
@@ -160,7 +160,7 @@
};
static struct i2c_client cx8800_i2c_client_template = {
- I2C_DEVNAME("cx88xx internal"),
+ .name = "cx88xx internal",
};
static char *i2c_devs[128] = {
--- linux-2.6.13-rc6.orig/drivers/media/video/ovcamchip/ovcamchip_core.c 2005-08-11 23:10:47.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/ovcamchip/ovcamchip_core.c 2005-08-12 21:22:45.000000000 +0200
@@ -314,7 +314,7 @@
}
memcpy(c, &client_template, sizeof *c);
c->adapter = adap;
- strcpy(i2c_clientname(c), "OV????");
+ strcpy(c->name, "OV????");
ov = kmalloc(sizeof *ov, GFP_KERNEL);
if (!ov) {
@@ -328,7 +328,7 @@
if (rc < 0)
goto error;
- strcpy(i2c_clientname(c), chip_names[ov->subtype]);
+ strcpy(c->name, chip_names[ov->subtype]);
PDEBUG(1, "Camera chip detection complete");
@@ -421,7 +421,7 @@
};
static struct i2c_client client_template = {
- I2C_DEVNAME("(unset)"),
+ .name = "(unset)",
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/saa7134/saa6752hs.c 2005-08-09 19:26:35.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/saa7134/saa6752hs.c 2005-08-12 21:22:45.000000000 +0200
@@ -598,7 +598,7 @@
static struct i2c_client client_template =
{
- I2C_DEVNAME("saa6752hs"),
+ .name = "saa6752hs",
.flags = I2C_CLIENT_ALLOW_USE,
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/saa7134/saa7134-i2c.c 2005-08-11 23:10:48.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/saa7134/saa7134-i2c.c 2005-08-12 21:22:45.000000000 +0200
@@ -334,7 +334,7 @@
struct tuner_setup tun_setup;
d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
- client->driver->name,client->addr,i2c_clientname(client));
+ client->driver->name, client->addr, client->name);
if (!client->driver->command)
return 0;
@@ -380,14 +380,14 @@
#ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG,
#endif
- I2C_DEVNAME("saa7134"),
+ .name = "saa7134",
.id = I2C_HW_SAA7134,
.algo = &saa7134_algo,
.client_register = attach_inform,
};
static struct i2c_client saa7134_client_template = {
- I2C_DEVNAME("saa7134 internal"),
+ .name = "saa7134 internal",
};
/* ----------------------------------------------------------- */
--- linux-2.6.13-rc6.orig/drivers/media/video/tda7432.c 2005-08-11 23:10:47.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tda7432.c 2005-08-12 21:22:45.000000000 +0200
@@ -513,7 +513,7 @@
static struct i2c_client client_template =
{
- I2C_DEVNAME("tda7432"),
+ .name = "tda7432",
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/tda9840.c 2005-08-11 23:10:48.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tda9840.c 2005-08-12 21:22:45.000000000 +0200
@@ -231,7 +231,7 @@
};
static struct i2c_client client_template = {
- I2C_DEVNAME("tda9840"),
+ .name = "tda9840",
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/tda9875.c 2005-08-11 23:10:47.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tda9875.c 2005-08-12 21:22:45.000000000 +0200
@@ -384,7 +384,7 @@
static struct i2c_client client_template =
{
- I2C_DEVNAME("tda9875"),
+ .name = "tda9875",
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/tda9887.c 2005-08-11 23:10:48.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tda9887.c 2005-08-12 21:22:45.000000000 +0200
@@ -793,7 +793,7 @@
};
static struct i2c_client client_template =
{
- I2C_DEVNAME("tda9887"),
+ .name = "tda9887",
.flags = I2C_CLIENT_ALLOW_USE,
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/tea6415c.c 2005-08-11 23:10:48.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tea6415c.c 2005-08-12 21:22:45.000000000 +0200
@@ -200,7 +200,7 @@
};
static struct i2c_client client_template = {
- I2C_DEVNAME("tea6415c"),
+ .name = "tea6415c",
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/tea6420.c 2005-08-11 23:10:48.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tea6420.c 2005-08-12 21:22:45.000000000 +0200
@@ -177,7 +177,7 @@
};
static struct i2c_client client_template = {
- I2C_DEVNAME("tea6420"),
+ .name = "tea6420",
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/tuner-core.c 2005-08-09 19:26:35.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tuner-core.c 2005-08-12 21:22:45.000000000 +0200
@@ -709,7 +709,7 @@
},
};
static struct i2c_client client_template = {
- I2C_DEVNAME("(tuner unset)"),
+ .name = "(tuner unset)",
.flags = I2C_CLIENT_ALLOW_USE,
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/tvaudio.c 2005-08-11 23:10:48.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tvaudio.c 2005-08-12 21:22:45.000000000 +0200
@@ -162,24 +162,23 @@
unsigned char buffer[2];
if (-1 == subaddr) {
- dprintk("%s: chip_write: 0x%x\n",
- i2c_clientname(&chip->c), val);
+ dprintk("%s: chip_write: 0x%x\n", chip->c.name, val);
chip->shadow.bytes[1] = val;
buffer[0] = val;
if (1 != i2c_master_send(&chip->c,buffer,1)) {
printk(KERN_WARNING "%s: I/O error (write 0x%x)\n",
- i2c_clientname(&chip->c), val);
+ chip->c.name, val);
return -1;
}
} else {
dprintk("%s: chip_write: reg%d=0x%x\n",
- i2c_clientname(&chip->c), subaddr, val);
+ chip->c.name, subaddr, val);
chip->shadow.bytes[subaddr+1] = val;
buffer[0] = subaddr;
buffer[1] = val;
if (2 != i2c_master_send(&chip->c,buffer,2)) {
printk(KERN_WARNING "%s: I/O error (write reg%d=0x%x)\n",
- i2c_clientname(&chip->c), subaddr, val);
+ chip->c.name, subaddr, val);
return -1;
}
}
@@ -203,11 +202,10 @@
unsigned char buffer;
if (1 != i2c_master_recv(&chip->c,&buffer,1)) {
- printk(KERN_WARNING "%s: I/O error (read)\n",
- i2c_clientname(&chip->c));
+ printk(KERN_WARNING "%s: I/O error (read)\n", chip->c.name);
return -1;
}
- dprintk("%s: chip_read: 0x%x\n",i2c_clientname(&chip->c),buffer);
+ dprintk("%s: chip_read: 0x%x\n", chip->c.name, buffer);
return buffer;
}
@@ -222,12 +220,11 @@
write[0] = subaddr;
if (2 != i2c_transfer(chip->c.adapter,msgs,2)) {
- printk(KERN_WARNING "%s: I/O error (read2)\n",
- i2c_clientname(&chip->c));
+ printk(KERN_WARNING "%s: I/O error (read2)\n", chip->c.name);
return -1;
}
dprintk("%s: chip_read2: reg%d=0x%x\n",
- i2c_clientname(&chip->c),subaddr,read[0]);
+ chip->c.name, subaddr, read[0]);
return read[0];
}
@@ -240,7 +237,7 @@
/* update our shadow register set; print bytes if (debug > 0) */
dprintk("%s: chip_cmd(%s): reg=%d, data:",
- i2c_clientname(&chip->c),name,cmd->bytes[0]);
+ chip->c.name, name, cmd->bytes[0]);
for (i = 1; i < cmd->count; i++) {
dprintk(" 0x%x",cmd->bytes[i]);
chip->shadow.bytes[i+cmd->bytes[0]] = cmd->bytes[i];
@@ -249,7 +246,7 @@
/* send data to the chip */
if (cmd->count != i2c_master_send(&chip->c,cmd->bytes,cmd->count)) {
- printk(KERN_WARNING "%s: I/O error (%s)\n", i2c_clientname(&chip->c), name);
+ printk(KERN_WARNING "%s: I/O error (%s)\n", chip->c.name, name);
return -1;
}
return 0;
@@ -274,9 +271,9 @@
struct CHIPSTATE *chip = data;
struct CHIPDESC *desc = chiplist + chip->type;
- daemonize("%s",i2c_clientname(&chip->c));
+ daemonize("%s", chip->c.name);
allow_signal(SIGTERM);
- dprintk("%s: thread started\n", i2c_clientname(&chip->c));
+ dprintk("%s: thread started\n", chip->c.name);
for (;;) {
add_wait_queue(&chip->wq, &wait);
@@ -288,7 +285,7 @@
try_to_freeze();
if (chip->done || signal_pending(current))
break;
- dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c));
+ dprintk("%s: thread wakeup\n", chip->c.name);
/* don't do anything for radio or if mode != auto */
if (chip->norm == VIDEO_MODE_RADIO || chip->mode != 0)
@@ -301,7 +298,7 @@
mod_timer(&chip->wt, jiffies+2*HZ);
}
- dprintk("%s: thread exiting\n", i2c_clientname(&chip->c));
+ dprintk("%s: thread exiting\n", chip->c.name);
complete_and_exit(&chip->texit, 0);
return 0;
}
@@ -314,7 +311,7 @@
if (mode == chip->prevmode)
return;
- dprintk("%s: thread checkmode\n", i2c_clientname(&chip->c));
+ dprintk("%s: thread checkmode\n", chip->c.name);
chip->prevmode = mode;
if (mode & VIDEO_SOUND_STEREO)
@@ -1501,7 +1498,7 @@
(desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : "");
/* fill required data structures */
- strcpy(i2c_clientname(&chip->c),desc->name);
+ strcpy(chip->c.name, desc->name);
chip->type = desc-chiplist;
chip->shadow.count = desc->registers+1;
chip->prevmode = -1;
@@ -1538,7 +1535,7 @@
chip->tpid = kernel_thread(chip_thread,(void *)chip,0);
if (chip->tpid < 0)
printk(KERN_WARNING "%s: kernel_thread() failed\n",
- i2c_clientname(&chip->c));
+ chip->c.name);
wake_up_interruptible(&chip->wq);
}
return 0;
@@ -1591,7 +1588,7 @@
struct CHIPSTATE *chip = i2c_get_clientdata(client);
struct CHIPDESC *desc = chiplist + chip->type;
- dprintk("%s: chip_command 0x%x\n",i2c_clientname(&chip->c),cmd);
+ dprintk("%s: chip_command 0x%x\n", chip->c.name, cmd);
switch (cmd) {
case AUDC_SET_INPUT:
@@ -1702,7 +1699,7 @@
static struct i2c_client client_template =
{
- I2C_DEVNAME("(unset)"),
+ .name = "(unset)",
.flags = I2C_CLIENT_ALLOW_USE,
.driver = &driver,
};
--- linux-2.6.13-rc6.orig/drivers/media/video/tvmixer.c 2005-08-11 23:10:47.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/tvmixer.c 2005-08-12 21:22:45.000000000 +0200
@@ -91,7 +91,7 @@
if (cmd == SOUND_MIXER_INFO) {
mixer_info info;
strlcpy(info.id, "tv card", sizeof(info.id));
- strlcpy(info.name, i2c_clientname(client), sizeof(info.name));
+ strlcpy(info.name, client->name, sizeof(info.name));
info.modify_counter = 42 /* FIXME */;
if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
@@ -100,7 +100,7 @@
if (cmd == SOUND_OLD_MIXER_INFO) {
_old_mixer_info info;
strlcpy(info.id, "tv card", sizeof(info.id));
- strlcpy(info.name, i2c_clientname(client), sizeof(info.name));
+ strlcpy(info.name, client->name, sizeof(info.name));
if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
@@ -295,7 +295,7 @@
devices[i].dev = NULL;
devices[i].minor = -1;
printk("tvmixer: %s unregistered (#1)\n",
- i2c_clientname(client));
+ client->name);
return 0;
}
}
@@ -354,7 +354,7 @@
if (devices[i].minor != -1) {
unregister_sound_mixer(devices[i].minor);
printk("tvmixer: %s unregistered (#2)\n",
- i2c_clientname(devices[i].dev));
+ devices[i].dev->name);
}
}
}
--- linux-2.6.13-rc6.orig/drivers/media/video/zoran_card.c 2005-08-09 19:26:35.000000000 +0200
+++ linux-2.6.13-rc6/drivers/media/video/zoran_card.c 2005-08-12 21:22:45.000000000 +0200
@@ -737,7 +737,7 @@
};
static struct i2c_adapter zoran_i2c_adapter_template = {
- I2C_DEVNAME("zr36057"),
+ .name = "zr36057",
.id = I2C_HW_B_ZR36067,
.algo = NULL,
.client_register = zoran_i2c_client_register,
--- linux-2.6.13-rc6.orig/include/linux/i2c.h 2005-08-11 23:10:47.000000000 +0200
+++ linux-2.6.13-rc6/include/linux/i2c.h 2005-08-12 21:22:45.000000000 +0200
@@ -178,13 +178,6 @@
dev_set_drvdata (&dev->dev, data);
}
-#define I2C_DEVNAME(str) .name = str
-
-static inline char *i2c_clientname(struct i2c_client *c)
-{
- return &c->name[0];
-}
-
/*
* The following structs are for those who like to implement new bus drivers:
* i2c_algorithm is the interface to a class of hardware solutions which can
--
Jean Delvare
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
2005-08-15 17:57 [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname Jean Delvare
@ 2005-08-22 20:09 ` Mauro Carvalho Chehab
2005-08-24 22:19 ` Jean Delvare
0 siblings, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2005-08-22 20:09 UTC (permalink / raw)
To: Jean Delvare; +Cc: LKML, video4linux-list, Greg KH
Em Seg, 2005-08-15 às 19:57 +0200, Jean Delvare escreveu:
> Hi all,
>
> I2C_DEVNAME and i2c_clientname were introduced in 2.5.68 [1] to help
> media/video driver authors who wanted their code to be compatible with
> both Linux 2.4 and 2.6. The cause of the incompatibility has gone since
> [2], so I think we can get rid of them, as they tend to make the code
> harder to read and longer to preprocess/compile for no more benefit.
>
> I'd hope nobody seriously attempts to keep media/video driver compatible
> across Linux trees anymore, BTW.
That's not true. We keep V4L tree compatible with older kernel
releases. Each change like this does generate a lot of work at V4L side
to provide #ifdefs to check for linux version and provide a compatible
way to compile with older versions. I don't see any sense on applying
this patch, since it will not reduce code size or increase execution
time.
Mauro.
>
> [1] http://marc.theaimsgroup.com/?l=linux-kernel&m=104930186524598&w=2
> [2] http://www.linuxhq.com/kernel/v2.6/0-test3/include/linux/i2c.h
>
> This patch is meant to reach -mm through Greg's i2c tree.
>
> Thanks.
>
> Signed-off-by: Jean Delvare <khali@linux-fr.org>
>
> drivers/media/video/bt832.c | 2
> drivers/media/video/bttv-i2c.c | 8 ++--
> drivers/media/video/cx88/cx88-i2c.c | 8 ++--
> drivers/media/video/ir-kbd-i2c.c | 2
> drivers/media/video/msp3400.c | 4 +-
> drivers/media/video/ovcamchip/ovcamchip_core.c | 6 ++--
> drivers/media/video/saa7134/saa6752hs.c | 2
> drivers/media/video/saa7134/saa7134-i2c.c | 6 ++--
> drivers/media/video/tda7432.c | 2
> drivers/media/video/tda9840.c | 2
> drivers/media/video/tda9875.c | 2
> drivers/media/video/tda9887.c | 2
> drivers/media/video/tea6415c.c | 2
> drivers/media/video/tea6420.c | 2
> drivers/media/video/tuner-core.c | 2
> drivers/media/video/tvaudio.c | 41 ++++++++++++-------------
> drivers/media/video/tvmixer.c | 8 ++--
> drivers/media/video/zoran_card.c | 2
> drivers/usb/media/w9968cf.c | 8 ++---
> include/linux/i2c.h | 7 ----
> 20 files changed, 53 insertions(+), 65 deletions(-)
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/bt832.c 2005-08-11 23:10:47.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/bt832.c 2005-08-12 21:22:45.000000000 +0200
> @@ -241,7 +241,7 @@
> };
> static struct i2c_client client_template =
> {
> - I2C_DEVNAME("bt832"),
> + .name = "bt832",
> .flags = I2C_CLIENT_ALLOW_USE,
> .driver = &driver,
> };
> --- linux-2.6.13-rc6.orig/drivers/media/video/bttv-i2c.c 2005-08-11 23:10:47.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/bttv-i2c.c 2005-08-12 21:22:45.000000000 +0200
> @@ -109,7 +109,7 @@
> #ifdef I2C_CLASS_TV_ANALOG
> .class = I2C_CLASS_TV_ANALOG,
> #endif
> - I2C_DEVNAME("bt848"),
> + .name = "bt848",
> .id = I2C_HW_B_BT848,
> .client_register = attach_inform,
> };
> @@ -280,7 +280,7 @@
> #ifdef I2C_CLASS_TV_ANALOG
> .class = I2C_CLASS_TV_ANALOG,
> #endif
> - I2C_DEVNAME("bt878"),
> + .name = "bt878",
> .id = I2C_HW_B_BT848 /* FIXME */,
> .algo = &bttv_algo,
> .client_register = attach_inform,
> @@ -296,7 +296,7 @@
> if (bttv_debug)
> printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n",
> btv->c.nr,client->driver->name,client->addr,
> - i2c_clientname(client));
> + client->name);
> if (!client->driver->command)
> return 0;
>
> @@ -324,7 +324,7 @@
> }
>
> static struct i2c_client bttv_i2c_client_template = {
> - I2C_DEVNAME("bttv internal"),
> + .name = "bttv internal",
> };
>
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/ir-kbd-i2c.c 2005-08-11 23:10:48.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/ir-kbd-i2c.c 2005-08-12 21:22:45.000000000 +0200
> @@ -308,7 +308,7 @@
>
> static struct i2c_client client_template =
> {
> - I2C_DEVNAME("unset"),
> + .name = "unset",
> .driver = &driver
> };
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/msp3400.c 2005-08-09 19:26:35.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/msp3400.c 2005-08-12 21:22:45.000000000 +0200
> @@ -1437,7 +1437,7 @@
>
> static struct i2c_client client_template =
> {
> - I2C_DEVNAME("(unset)"),
> + .name = "(unset)",
> .flags = I2C_CLIENT_ALLOW_USE,
> .driver = &driver,
> };
> @@ -1509,7 +1509,7 @@
> }
>
> /* hello world :-) */
> - printk(KERN_INFO "msp34xx: init: chip=%s",i2c_clientname(c));
> + printk(KERN_INFO "msp34xx: init: chip=%s", c->name);
> if (HAVE_NICAM(msp))
> printk(" +nicam");
> if (HAVE_SIMPLE(msp))
> --- linux-2.6.13-rc6.orig/drivers/usb/media/w9968cf.c 2005-08-11 23:10:47.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/usb/media/w9968cf.c 2005-08-12 21:22:45.000000000 +0200
> @@ -1523,7 +1523,6 @@
> static int w9968cf_i2c_attach_inform(struct i2c_client* client)
> {
> struct w9968cf_device* cam = i2c_get_adapdata(client->adapter);
> - const char* clientname = i2c_clientname(client);
> int id = client->driver->id, err = 0;
>
> if (id == I2C_DRIVERID_OVCAMCHIP) {
> @@ -1535,12 +1534,12 @@
> }
> } else {
> DBG(4, "Rejected client [%s] with driver [%s]",
> - clientname, client->driver->name)
> + client->name, client->driver->name)
> return -EINVAL;
> }
>
> DBG(5, "I2C attach client [%s] with driver [%s]",
> - clientname, client->driver->name)
> + client->name, client->driver->name)
>
> return 0;
> }
> @@ -1549,12 +1548,11 @@
> static int w9968cf_i2c_detach_inform(struct i2c_client* client)
> {
> struct w9968cf_device* cam = i2c_get_adapdata(client->adapter);
> - const char* clientname = i2c_clientname(client);
>
> if (cam->sensor_client == client)
> cam->sensor_client = NULL;
>
> - DBG(5, "I2C detach client [%s]", clientname)
> + DBG(5, "I2C detach client [%s]", client->name)
>
> return 0;
> }
> --- linux-2.6.13-rc6.orig/drivers/media/video/cx88/cx88-i2c.c 2005-08-09 19:26:35.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/cx88/cx88-i2c.c 2005-08-12 21:22:45.000000000 +0200
> @@ -95,7 +95,7 @@
> struct cx88_core *core = i2c_get_adapdata(client->adapter);
>
> dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
> - client->driver->name,client->addr,i2c_clientname(client));
> + client->driver->name, client->addr, client->name);
> if (!client->driver->command)
> return 0;
>
> @@ -128,7 +128,7 @@
> {
> struct cx88_core *core = i2c_get_adapdata(client->adapter);
>
> - dprintk(1, "i2c detach [client=%s]\n", i2c_clientname(client));
> + dprintk(1, "i2c detach [client=%s]\n", client->name);
> return 0;
> }
>
> @@ -152,7 +152,7 @@
> /* ----------------------------------------------------------------------- */
>
> static struct i2c_adapter cx8800_i2c_adap_template = {
> - I2C_DEVNAME("cx2388x"),
> + .name = "cx2388x",
> .owner = THIS_MODULE,
> .id = I2C_HW_B_CX2388x,
> .client_register = attach_inform,
> @@ -160,7 +160,7 @@
> };
>
> static struct i2c_client cx8800_i2c_client_template = {
> - I2C_DEVNAME("cx88xx internal"),
> + .name = "cx88xx internal",
> };
>
> static char *i2c_devs[128] = {
> --- linux-2.6.13-rc6.orig/drivers/media/video/ovcamchip/ovcamchip_core.c 2005-08-11 23:10:47.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/ovcamchip/ovcamchip_core.c 2005-08-12 21:22:45.000000000 +0200
> @@ -314,7 +314,7 @@
> }
> memcpy(c, &client_template, sizeof *c);
> c->adapter = adap;
> - strcpy(i2c_clientname(c), "OV????");
> + strcpy(c->name, "OV????");
>
> ov = kmalloc(sizeof *ov, GFP_KERNEL);
> if (!ov) {
> @@ -328,7 +328,7 @@
> if (rc < 0)
> goto error;
>
> - strcpy(i2c_clientname(c), chip_names[ov->subtype]);
> + strcpy(c->name, chip_names[ov->subtype]);
>
> PDEBUG(1, "Camera chip detection complete");
>
> @@ -421,7 +421,7 @@
> };
>
> static struct i2c_client client_template = {
> - I2C_DEVNAME("(unset)"),
> + .name = "(unset)",
> .driver = &driver,
> };
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/saa7134/saa6752hs.c 2005-08-09 19:26:35.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/saa7134/saa6752hs.c 2005-08-12 21:22:45.000000000 +0200
> @@ -598,7 +598,7 @@
>
> static struct i2c_client client_template =
> {
> - I2C_DEVNAME("saa6752hs"),
> + .name = "saa6752hs",
> .flags = I2C_CLIENT_ALLOW_USE,
> .driver = &driver,
> };
> --- linux-2.6.13-rc6.orig/drivers/media/video/saa7134/saa7134-i2c.c 2005-08-11 23:10:48.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/saa7134/saa7134-i2c.c 2005-08-12 21:22:45.000000000 +0200
> @@ -334,7 +334,7 @@
> struct tuner_setup tun_setup;
>
> d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
> - client->driver->name,client->addr,i2c_clientname(client));
> + client->driver->name, client->addr, client->name);
>
> if (!client->driver->command)
> return 0;
> @@ -380,14 +380,14 @@
> #ifdef I2C_CLASS_TV_ANALOG
> .class = I2C_CLASS_TV_ANALOG,
> #endif
> - I2C_DEVNAME("saa7134"),
> + .name = "saa7134",
> .id = I2C_HW_SAA7134,
> .algo = &saa7134_algo,
> .client_register = attach_inform,
> };
>
> static struct i2c_client saa7134_client_template = {
> - I2C_DEVNAME("saa7134 internal"),
> + .name = "saa7134 internal",
> };
>
> /* ----------------------------------------------------------- */
> --- linux-2.6.13-rc6.orig/drivers/media/video/tda7432.c 2005-08-11 23:10:47.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tda7432.c 2005-08-12 21:22:45.000000000 +0200
> @@ -513,7 +513,7 @@
>
> static struct i2c_client client_template =
> {
> - I2C_DEVNAME("tda7432"),
> + .name = "tda7432",
> .driver = &driver,
> };
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/tda9840.c 2005-08-11 23:10:48.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tda9840.c 2005-08-12 21:22:45.000000000 +0200
> @@ -231,7 +231,7 @@
> };
>
> static struct i2c_client client_template = {
> - I2C_DEVNAME("tda9840"),
> + .name = "tda9840",
> .driver = &driver,
> };
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/tda9875.c 2005-08-11 23:10:47.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tda9875.c 2005-08-12 21:22:45.000000000 +0200
> @@ -384,7 +384,7 @@
>
> static struct i2c_client client_template =
> {
> - I2C_DEVNAME("tda9875"),
> + .name = "tda9875",
> .driver = &driver,
> };
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/tda9887.c 2005-08-11 23:10:48.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tda9887.c 2005-08-12 21:22:45.000000000 +0200
> @@ -793,7 +793,7 @@
> };
> static struct i2c_client client_template =
> {
> - I2C_DEVNAME("tda9887"),
> + .name = "tda9887",
> .flags = I2C_CLIENT_ALLOW_USE,
> .driver = &driver,
> };
> --- linux-2.6.13-rc6.orig/drivers/media/video/tea6415c.c 2005-08-11 23:10:48.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tea6415c.c 2005-08-12 21:22:45.000000000 +0200
> @@ -200,7 +200,7 @@
> };
>
> static struct i2c_client client_template = {
> - I2C_DEVNAME("tea6415c"),
> + .name = "tea6415c",
> .driver = &driver,
> };
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/tea6420.c 2005-08-11 23:10:48.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tea6420.c 2005-08-12 21:22:45.000000000 +0200
> @@ -177,7 +177,7 @@
> };
>
> static struct i2c_client client_template = {
> - I2C_DEVNAME("tea6420"),
> + .name = "tea6420",
> .driver = &driver,
> };
>
> --- linux-2.6.13-rc6.orig/drivers/media/video/tuner-core.c 2005-08-09 19:26:35.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tuner-core.c 2005-08-12 21:22:45.000000000 +0200
> @@ -709,7 +709,7 @@
> },
> };
> static struct i2c_client client_template = {
> - I2C_DEVNAME("(tuner unset)"),
> + .name = "(tuner unset)",
> .flags = I2C_CLIENT_ALLOW_USE,
> .driver = &driver,
> };
> --- linux-2.6.13-rc6.orig/drivers/media/video/tvaudio.c 2005-08-11 23:10:48.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tvaudio.c 2005-08-12 21:22:45.000000000 +0200
> @@ -162,24 +162,23 @@
> unsigned char buffer[2];
>
> if (-1 == subaddr) {
> - dprintk("%s: chip_write: 0x%x\n",
> - i2c_clientname(&chip->c), val);
> + dprintk("%s: chip_write: 0x%x\n", chip->c.name, val);
> chip->shadow.bytes[1] = val;
> buffer[0] = val;
> if (1 != i2c_master_send(&chip->c,buffer,1)) {
> printk(KERN_WARNING "%s: I/O error (write 0x%x)\n",
> - i2c_clientname(&chip->c), val);
> + chip->c.name, val);
> return -1;
> }
> } else {
> dprintk("%s: chip_write: reg%d=0x%x\n",
> - i2c_clientname(&chip->c), subaddr, val);
> + chip->c.name, subaddr, val);
> chip->shadow.bytes[subaddr+1] = val;
> buffer[0] = subaddr;
> buffer[1] = val;
> if (2 != i2c_master_send(&chip->c,buffer,2)) {
> printk(KERN_WARNING "%s: I/O error (write reg%d=0x%x)\n",
> - i2c_clientname(&chip->c), subaddr, val);
> + chip->c.name, subaddr, val);
> return -1;
> }
> }
> @@ -203,11 +202,10 @@
> unsigned char buffer;
>
> if (1 != i2c_master_recv(&chip->c,&buffer,1)) {
> - printk(KERN_WARNING "%s: I/O error (read)\n",
> - i2c_clientname(&chip->c));
> + printk(KERN_WARNING "%s: I/O error (read)\n", chip->c.name);
> return -1;
> }
> - dprintk("%s: chip_read: 0x%x\n",i2c_clientname(&chip->c),buffer);
> + dprintk("%s: chip_read: 0x%x\n", chip->c.name, buffer);
> return buffer;
> }
>
> @@ -222,12 +220,11 @@
> write[0] = subaddr;
>
> if (2 != i2c_transfer(chip->c.adapter,msgs,2)) {
> - printk(KERN_WARNING "%s: I/O error (read2)\n",
> - i2c_clientname(&chip->c));
> + printk(KERN_WARNING "%s: I/O error (read2)\n", chip->c.name);
> return -1;
> }
> dprintk("%s: chip_read2: reg%d=0x%x\n",
> - i2c_clientname(&chip->c),subaddr,read[0]);
> + chip->c.name, subaddr, read[0]);
> return read[0];
> }
>
> @@ -240,7 +237,7 @@
>
> /* update our shadow register set; print bytes if (debug > 0) */
> dprintk("%s: chip_cmd(%s): reg=%d, data:",
> - i2c_clientname(&chip->c),name,cmd->bytes[0]);
> + chip->c.name, name, cmd->bytes[0]);
> for (i = 1; i < cmd->count; i++) {
> dprintk(" 0x%x",cmd->bytes[i]);
> chip->shadow.bytes[i+cmd->bytes[0]] = cmd->bytes[i];
> @@ -249,7 +246,7 @@
>
> /* send data to the chip */
> if (cmd->count != i2c_master_send(&chip->c,cmd->bytes,cmd->count)) {
> - printk(KERN_WARNING "%s: I/O error (%s)\n", i2c_clientname(&chip->c), name);
> + printk(KERN_WARNING "%s: I/O error (%s)\n", chip->c.name, name);
> return -1;
> }
> return 0;
> @@ -274,9 +271,9 @@
> struct CHIPSTATE *chip = data;
> struct CHIPDESC *desc = chiplist + chip->type;
>
> - daemonize("%s",i2c_clientname(&chip->c));
> + daemonize("%s", chip->c.name);
> allow_signal(SIGTERM);
> - dprintk("%s: thread started\n", i2c_clientname(&chip->c));
> + dprintk("%s: thread started\n", chip->c.name);
>
> for (;;) {
> add_wait_queue(&chip->wq, &wait);
> @@ -288,7 +285,7 @@
> try_to_freeze();
> if (chip->done || signal_pending(current))
> break;
> - dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c));
> + dprintk("%s: thread wakeup\n", chip->c.name);
>
> /* don't do anything for radio or if mode != auto */
> if (chip->norm == VIDEO_MODE_RADIO || chip->mode != 0)
> @@ -301,7 +298,7 @@
> mod_timer(&chip->wt, jiffies+2*HZ);
> }
>
> - dprintk("%s: thread exiting\n", i2c_clientname(&chip->c));
> + dprintk("%s: thread exiting\n", chip->c.name);
> complete_and_exit(&chip->texit, 0);
> return 0;
> }
> @@ -314,7 +311,7 @@
> if (mode == chip->prevmode)
> return;
>
> - dprintk("%s: thread checkmode\n", i2c_clientname(&chip->c));
> + dprintk("%s: thread checkmode\n", chip->c.name);
> chip->prevmode = mode;
>
> if (mode & VIDEO_SOUND_STEREO)
> @@ -1501,7 +1498,7 @@
> (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : "");
>
> /* fill required data structures */
> - strcpy(i2c_clientname(&chip->c),desc->name);
> + strcpy(chip->c.name, desc->name);
> chip->type = desc-chiplist;
> chip->shadow.count = desc->registers+1;
> chip->prevmode = -1;
> @@ -1538,7 +1535,7 @@
> chip->tpid = kernel_thread(chip_thread,(void *)chip,0);
> if (chip->tpid < 0)
> printk(KERN_WARNING "%s: kernel_thread() failed\n",
> - i2c_clientname(&chip->c));
> + chip->c.name);
> wake_up_interruptible(&chip->wq);
> }
> return 0;
> @@ -1591,7 +1588,7 @@
> struct CHIPSTATE *chip = i2c_get_clientdata(client);
> struct CHIPDESC *desc = chiplist + chip->type;
>
> - dprintk("%s: chip_command 0x%x\n",i2c_clientname(&chip->c),cmd);
> + dprintk("%s: chip_command 0x%x\n", chip->c.name, cmd);
>
> switch (cmd) {
> case AUDC_SET_INPUT:
> @@ -1702,7 +1699,7 @@
>
> static struct i2c_client client_template =
> {
> - I2C_DEVNAME("(unset)"),
> + .name = "(unset)",
> .flags = I2C_CLIENT_ALLOW_USE,
> .driver = &driver,
> };
> --- linux-2.6.13-rc6.orig/drivers/media/video/tvmixer.c 2005-08-11 23:10:47.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/tvmixer.c 2005-08-12 21:22:45.000000000 +0200
> @@ -91,7 +91,7 @@
> if (cmd == SOUND_MIXER_INFO) {
> mixer_info info;
> strlcpy(info.id, "tv card", sizeof(info.id));
> - strlcpy(info.name, i2c_clientname(client), sizeof(info.name));
> + strlcpy(info.name, client->name, sizeof(info.name));
> info.modify_counter = 42 /* FIXME */;
> if (copy_to_user(argp, &info, sizeof(info)))
> return -EFAULT;
> @@ -100,7 +100,7 @@
> if (cmd == SOUND_OLD_MIXER_INFO) {
> _old_mixer_info info;
> strlcpy(info.id, "tv card", sizeof(info.id));
> - strlcpy(info.name, i2c_clientname(client), sizeof(info.name));
> + strlcpy(info.name, client->name, sizeof(info.name));
> if (copy_to_user(argp, &info, sizeof(info)))
> return -EFAULT;
> return 0;
> @@ -295,7 +295,7 @@
> devices[i].dev = NULL;
> devices[i].minor = -1;
> printk("tvmixer: %s unregistered (#1)\n",
> - i2c_clientname(client));
> + client->name);
> return 0;
> }
> }
> @@ -354,7 +354,7 @@
> if (devices[i].minor != -1) {
> unregister_sound_mixer(devices[i].minor);
> printk("tvmixer: %s unregistered (#2)\n",
> - i2c_clientname(devices[i].dev));
> + devices[i].dev->name);
> }
> }
> }
> --- linux-2.6.13-rc6.orig/drivers/media/video/zoran_card.c 2005-08-09 19:26:35.000000000 +0200
> +++ linux-2.6.13-rc6/drivers/media/video/zoran_card.c 2005-08-12 21:22:45.000000000 +0200
> @@ -737,7 +737,7 @@
> };
>
> static struct i2c_adapter zoran_i2c_adapter_template = {
> - I2C_DEVNAME("zr36057"),
> + .name = "zr36057",
> .id = I2C_HW_B_ZR36067,
> .algo = NULL,
> .client_register = zoran_i2c_client_register,
> --- linux-2.6.13-rc6.orig/include/linux/i2c.h 2005-08-11 23:10:47.000000000 +0200
> +++ linux-2.6.13-rc6/include/linux/i2c.h 2005-08-12 21:22:45.000000000 +0200
> @@ -178,13 +178,6 @@
> dev_set_drvdata (&dev->dev, data);
> }
>
> -#define I2C_DEVNAME(str) .name = str
> -
> -static inline char *i2c_clientname(struct i2c_client *c)
> -{
> - return &c->name[0];
> -}
> -
> /*
> * The following structs are for those who like to implement new bus drivers:
> * i2c_algorithm is the interface to a class of hardware solutions which can
>
>
Cheers,
Mauro.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
2005-08-22 20:09 ` Mauro Carvalho Chehab
@ 2005-08-24 22:19 ` Jean Delvare
2005-08-30 0:12 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 9+ messages in thread
From: Jean Delvare @ 2005-08-24 22:19 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: LKML, video4linux-list, Greg KH
Hi Mauro,
> > I2C_DEVNAME and i2c_clientname were introduced in 2.5.68 [1] to help
> > media/video driver authors who wanted their code to be compatible
> > with both Linux 2.4 and 2.6. The cause of the incompatibility has
> > gone since [2], so I think we can get rid of them, as they tend to
> > make the code harder to read and longer to preprocess/compile for no
> > more benefit.
> >
> > I'd hope nobody seriously attempts to keep media/video driver
> > compatible across Linux trees anymore, BTW.
>
> That's not true. We keep V4L tree compatible with older kernel
> releases. Each change like this does generate a lot of work at V4L
> side to provide #ifdefs to check for linux version and provide a
> compatible way to compile with older versions.
I'm sorry but we will not stop updating the various Linux 2.6 subsystems
to keep them compatible with 2.4 - else one would wonder why there is a
2.6 kernel tree at all. As time goes, the differences bwteen 2.4 and 2.6
will only increase. You seem to be trying to keep common driver code
across incompatible trees. I'm not surprised that it is a lot of work.
That's your choice, live with it.
> I don't see any sense on applying this patch, since it will not reduce
> code size or increase execution time.
Code size and execution time are not the only factors to take into
account. Code readability and compilation time are two other ones that I
mentioned already.
Anyway, it doesn't look like you actually read what I wrote in the first
place. My comment about common driver code was really only by the way.
The reason why I have been proposing this patch is that I2C_DEVNAME and
i2c_clientname were only needed between Linux 2.5.68 and 2.6.0-test3,
which are unsupported by now, as they were development releases. As far
as i2c_client.name is concerned, 2.4 and 2.6.0+ trees are compatible.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
2005-08-24 22:19 ` Jean Delvare
@ 2005-08-30 0:12 ` Mauro Carvalho Chehab
2005-08-30 19:44 ` Greg KH
2005-08-30 21:20 ` Jean Delvare
0 siblings, 2 replies; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2005-08-30 0:12 UTC (permalink / raw)
To: Jean Delvare; +Cc: LKML, video4linux-list, Greg KH
Hi, Jean,
Em Qui, 2005-08-25 às 00:19 +0200, Jean Delvare escreveu:
> Hi Mauro,
>
> > That's not true. We keep V4L tree compatible with older kernel
> > releases. Each change like this does generate a lot of work at V4L
> > side to provide #ifdefs to check for linux version and provide a
> > compatible way to compile with older versions.
>
> I'm sorry but we will not stop updating the various Linux 2.6 subsystems
> to keep them compatible with 2.4 - else one would wonder why there is a
> 2.6 kernel tree at all.
I don't expect so, but it would be nice not to have a different I2C API
for every single 2.6 version :-) It would be nice to change I2C API once
and keep it stable for a while.
> As time goes, the differences bwteen 2.4 and 2.6
> will only increase. You seem to be trying to keep common driver code
> across incompatible trees. I'm not surprised that it is a lot of work.
> That's your choice, live with it.
It is not just a matter of choice. V4L stuff is mostly used by end
users. There are a few professional users, like those working on CATV
and video broadcasting. They don't have much knowledge and generally
uses distro-provided kernels. It is not like I2C or PCI that most boards
has something inside.
Also: boards are country-specific. There are dozens of different analog
standards. So, the same brand name (even the same model on some cases)
have different tuners for different video standards.
For us to have people to test all variations, we need to provide
backward support. Otherwise, we'll suffer a lot to test our patches,
since nobody on V4L devel is currently payed for doing his job and don't
have a lab with a bunch of cards and models.
>
> > I don't see any sense on applying this patch, since it will not reduce
> > code size or increase execution time.
>
> Code size and execution time are not the only factors to take into
> account. Code readability and compilation time are two other ones that I
> mentioned already.
Agreed.
>
> Anyway, it doesn't look like you actually read what I wrote in the first
> place. My comment about common driver code was really only by the way.
> The reason why I have been proposing this patch is that I2C_DEVNAME and
> i2c_clientname were only needed between Linux 2.5.68 and 2.6.0-test3,
> which are unsupported by now, as they were development releases. As far
> as i2c_client.name is concerned, 2.4 and 2.6.0+ trees are compatible.
>
Ok. I didn't understood this from your previous email. So, for me, it
is perfect to apply it. We do want to keep V4L tree compatibility with
2.6.x and with the latest 2.4 version. Currently, we lost compat with
2.4, but I plan to provide a backport soon to the latest 2.4 release.
I have a question for you about I2C: why i2c_driver doesn't have a
generic pointer to keep priv data (like i2c_adapter) ?
It would be nice to have such pointer (like have on other I2C
structures), in order to support multiple tuners for each function. This
is required for modern boards that have a TV analog tuner, a digital one
and a radio chip, it would be nice to have such structure to keep a
tuner table on it, and make easier to detect this.
> Thanks,
Thanks,
Mauro.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
2005-08-30 0:12 ` Mauro Carvalho Chehab
@ 2005-08-30 19:44 ` Greg KH
2005-08-30 21:20 ` Jean Delvare
1 sibling, 0 replies; 9+ messages in thread
From: Greg KH @ 2005-08-30 19:44 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Jean Delvare, LKML, video4linux-list
On Mon, Aug 29, 2005 at 09:12:42PM -0300, Mauro Carvalho Chehab wrote:
>
> I have a question for you about I2C: why i2c_driver doesn't have a
> generic pointer to keep priv data (like i2c_adapter) ?
Because no one has sent in a patch to add it :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
2005-08-30 0:12 ` Mauro Carvalho Chehab
2005-08-30 19:44 ` Greg KH
@ 2005-08-30 21:20 ` Jean Delvare
2005-08-31 15:34 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 9+ messages in thread
From: Jean Delvare @ 2005-08-30 21:20 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: LKML, video4linux-list, Greg KH
Hi Mauro,
> (...) it would be nice not to have a different I2C
> API for every single 2.6 version :-) It would be nice to change I2C
> API once and keep it stable for a while.
As nice as you seem to think it would be, I don't think it's not
realistic. For one thing, we don't necessarily know in advance what
changes will be needed. One month ago, I didn't even know that
I2C_DEVNAME and i2c_clientname were existing. For another, changes take
time to be dicussed, implemented and tested. Some changes depend on
others. We just can't buffer everything for a year and push everything
to Linus at once. Some of the changes, such as the i2c-isa killing or
the asynchronous i2c interface, are things some people really need, and
we can't ask them to wait for months or years.
The Linux 2.6 development model is designed around a relatively fast
move from -mm to Linus' tree, which implies incremental changes all the
time. I'm only doing that.
> > As time goes, the differences bwteen 2.4 and 2.6
> > will only increase. You seem to be trying to keep common driver code
> > across incompatible trees. I'm not surprised that it is a lot of
> > work. That's your choice, live with it.
>
> It is not just a matter of choice.
To me, it seems to be. No other part of the kernel does it as far as I
know. Or can you point me to other drivers that are part of the Linux
2.6 tree and include compatibility code for Linux 2.4? I am even
surprised that you are allowed to do it.
> (...) V4L stuff is mostly used by end
> users. There are a few professional users, like those working on CATV
> and video broadcasting. They don't have much knowledge and generally
> uses distro-provided kernels. It is not like I2C or PCI that most
> boards has something inside.
> Also: boards are country-specific. There are dozens of different analog
> standards. So, the same brand name (even the same model on some cases)
> have different tuners for different video standards.
I don't know what you are trying to demonstrate here, but all this is
completely unrelated with the decision of maintaining common driver code
rather than separate driver code. V4L is not different from other areas.
See how hard the framebuffer folks are struggling with the high number
of different graphics adapter setups for example. Same goes for SMBus
and hardware monitoring chips as far as I am concerned. Every mainboard
is different to some extent. And the list certainly doesn't stop there.
The difficulty to test the code on every existing piece of hardware
affects all driver authors and maintainers.
> For us to have people to test all variations, we need to provide
> backward support. Otherwise, we'll suffer a lot to test our patches,
> since nobody on V4L devel is currently payed for doing his job and
> don't have a lab with a bunch of cards and models.
Again, this ain't related with your decision to maintain a single set of
drivers for Linux 2.4 and Linux 2.6 rather than having different
drivers.
An example I know well is the lm_sensors project. As you may now, no
SMBus nor hardware monitoring driver is part of Linux 2.4. We are
maintaining drivers in a separate CVS repository. They are different
code from what we have in Linux 2.6. Still, we port the relevant changes
from one set of drivers to the other. Frankly, this ain't that
difficult, and works fine for over two years now. Maybe you should try.
I don't want to frighten you or anything, but there are changes to the
i2c subsystem which will affect compatibility in -mm, and these will hit
Linus' tree quite soon now. And I heard there are much much more in the
works, not even by me, that might go in 2.6.15.
> I have a question for you about I2C: why i2c_driver doesn't have a
> generic pointer to keep priv data (like i2c_adapter) ?
It wouldn't make sense in the current i2c driver model (which is
probably broken, no need to argue.) i2c_driver holds the code (or
pointers to code) that is common to all chips using this driver. That
is, mostly administrative stuff. The instance-specific structure is
i2c_client. The common practice is to encapsulate the i2c_client
structure into a dedicated structure, and put all your private data in
this structure. See how this is done in drivers/hwmon/*.c.
Maybe it sounds strange to you because (I heard) the i2c subsystem
doesn't follow the usual driver model. But rest assured, I also heard
that some people wanted to fix that soon. I guess you (or others) can't
complain that the i2c subsystem is broken, and at the same time ask that
it be kept compatible with its current or even previous state.
> It would be nice to have such pointer (like have on other I2C
> structures), in order to support multiple tuners for each function.
> This is required for modern boards that have a TV analog tuner, a
> digital one and a radio chip, it would be nice to have such structure
> to keep a tuner table on it, and make easier to detect this.
I am most certainly wrong, but it looks to me like you are wanting to
store this data in the wrong place. I can't see how i2c_driver would be
relevant for that. Multiple tuners is a property of the board itself,
not a property of an individual chip, be it an I2C chip or not.
--
Jean Delvare
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
2005-08-30 21:20 ` Jean Delvare
@ 2005-08-31 15:34 ` Mauro Carvalho Chehab
2005-08-31 20:56 ` Greg KH
0 siblings, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2005-08-31 15:34 UTC (permalink / raw)
To: Jean Delvare; +Cc: LKML, video4linux-list, Greg KH
Em Ter, 2005-08-30 às 23:20 +0200, Jean Delvare escreveu:
> Hi Mauro,
>
> > (...) it would be nice not to have a different I2C
> > API for every single 2.6 version :-) It would be nice to change I2C
> > API once and keep it stable for a while.
> The Linux 2.6 development model is designed around a relatively fast
> move from -mm to Linus' tree, which implies incremental changes all the
> time. I'm only doing that.
It is ok to change code, but, IMHO, API should be more stable.
> An example I know well is the lm_sensors project. As you may now, no
> SMBus nor hardware monitoring driver is part of Linux 2.4. We are
> maintaining drivers in a separate CVS repository. They are different
> code from what we have in Linux 2.6. Still, we port the relevant changes
> from one set of drivers to the other. Frankly, this ain't that
> difficult, and works fine for over two years now. Maybe you should try.
This is a good idea. We may try it for 2.4. But it is not feasible to
have one separate CVS tree for every 2.6.x. So, for 2.6.x we have to
handle with several ifdefs for each change on I2C API (other kernel
stuff are more stable).
>
> I don't want to frighten you or anything, but there are changes to the
> i2c subsystem which will affect compatibility in -mm, and these will hit
> Linus' tree quite soon now. And I heard there are much much more in the
> works, not even by me, that might go in 2.6.15.
It would be nice if this won't break compatibility with previous
versions of 2.6.
>
> > I have a question for you about I2C: why i2c_driver doesn't have a
> > generic pointer to keep priv data (like i2c_adapter) ?
>
> It wouldn't make sense in the current i2c driver model (which is
> probably broken, no need to argue.) i2c_driver holds the code (or
> pointers to code) that is common to all chips using this driver. That
> is, mostly administrative stuff. The instance-specific structure is
> i2c_client. The common practice is to encapsulate the i2c_client
> structure into a dedicated structure, and put all your private data in
> this structure. See how this is done in drivers/hwmon/*.c.
>
> Maybe it sounds strange to you because (I heard) the i2c subsystem
> doesn't follow the usual driver model. But rest assured, I also heard
> that some people wanted to fix that soon. I guess you (or others) can't
> complain that the i2c subsystem is broken, and at the same time ask that
> it be kept compatible with its current or even previous state.
>
> > It would be nice to have such pointer (like have on other I2C
> > structures), in order to support multiple tuners for each function.
> > This is required for modern boards that have a TV analog tuner, a
> > digital one and a radio chip, it would be nice to have such structure
> > to keep a tuner table on it, and make easier to detect this.
>
> I am most certainly wrong, but it looks to me like you are wanting to
> store this data in the wrong place. I can't see how i2c_driver would be
> relevant for that. Multiple tuners is a property of the board itself,
> not a property of an individual chip, be it an I2C chip or not.
I2C at V4L was modelled this way by Gerd Knorr (and, btw, it looks ok to
me):
chipset_specific-i2c.c (for example, saa7134-i2c.c):
Handles chipset-specific details (for bt8xx, cx88, saa7134, ...)
It contains:
i2c_adapter - with card specific implementation
i2c_algorithm - with I2C-specific I/O modes (if needed)
It handles one adapter by PCI device.
tuner-core.c:
Handles tuner generic code. The same tuner can be present on different
boards, with different chipsets.
i2c_driver - with tuner probing part (attach_adapter). This does a I2C
scanning to check what tuners are present at hardware.
i2c_client - with tuner specific code.
It handles one i2c_driver by PCI device and one or more i2c_client by
i2c_adapter.
Since 2.6.12, we do support more than one tuner at tuner-core. It was
needed because the same board may have a radio, analog_tv and/or
digital_tv that can be just one tuner for all or separate tuners. If
separate, it is common that they have also separated addresses. On this
case, one I2C command is provided to switch to the second one).
It should be noticed that there are some newer I2C radio chips, yet not
supported, that uses two separated I2C addresses (one for normal
programming and another mostly for RDS).
The current I2C approach replicates an Object Oriented structure. So,
i2_driver handles a callback to a probe structure, but doesn't provide
any mechanisms to pass parameters the the I2C objects, or to receive
values. So, the attach routine provided by tuner-core (tuner_attach)
cannot know for sure if the detected device was a Radio only tuner, a TV
only tuner or a generic one. The same PCI device cannot have more than
tuner of the same type active. So, autodetection code have a static var
to help to identify what types were already detected. It would be nice
to have a way to eliminate the static var and have some data *at* driver
structure to handle what is the active tuner for that function.
It would be nice also to have a command call to the driver structure,
so that the driver can send the commands to the specific client.
As an example, we currently do (at chipset_specific level):
i2c_clients_command(&dev->i2c_adap, command, arg);
Generating a "spam" to every I2C tuner.
At the tuner-core, we need to filter the command to the specific tuner
(radio, for example). If the tuner is not radio, return.
This generates extra cycles and some mess to understand what's
happening.
It would be better to do:
i2c_driver_command(&dev->i2c_adap, command, arg);
and, at i2c_driver:
i2c_client_command(i2c_client, command, arg);
But this would require some data structure at driver level to store an
driver list.
>
Cheers,
Mauro.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
2005-08-31 15:34 ` Mauro Carvalho Chehab
@ 2005-08-31 20:56 ` Greg KH
2005-09-01 3:14 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2005-08-31 20:56 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Jean Delvare, LKML, video4linux-list
On Wed, Aug 31, 2005 at 12:34:58PM -0300, Mauro Carvalho Chehab wrote:
> Em Ter, 2005-08-30 ?s 23:20 +0200, Jean Delvare escreveu:
> > Hi Mauro,
> >
> > > (...) it would be nice not to have a different I2C
> > > API for every single 2.6 version :-) It would be nice to change I2C
> > > API once and keep it stable for a while.
>
> > The Linux 2.6 development model is designed around a relatively fast
> > move from -mm to Linus' tree, which implies incremental changes all the
> > time. I'm only doing that.
> It is ok to change code, but, IMHO, API should be more stable.
I take it you have not read Documentation/stable_api_nonsense.txt yet?
If not, please do, it shows that what you are asking for will not
happen.
good luck,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname
2005-08-31 20:56 ` Greg KH
@ 2005-09-01 3:14 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2005-09-01 3:14 UTC (permalink / raw)
To: Greg KH; +Cc: Jean Delvare, LKML, video4linux-list
Em Qua, 2005-08-31 às 13:56 -0700, Greg KH escreveu:
> On Wed, Aug 31, 2005 at 12:34:58PM -0300, Mauro Carvalho Chehab wrote:
> > Em Ter, 2005-08-30 ?s 23:20 +0200, Jean Delvare escreveu:
> > > Hi Mauro,
> > >
> > > > (...) it would be nice not to have a different I2C
> > > > API for every single 2.6 version :-) It would be nice to change I2C
> > > > API once and keep it stable for a while.
> >
> > > The Linux 2.6 development model is designed around a relatively fast
> > > move from -mm to Linus' tree, which implies incremental changes all the
> > > time. I'm only doing that.
> > It is ok to change code, but, IMHO, API should be more stable.
>
> I take it you have not read Documentation/stable_api_nonsense.txt yet?
No I din't :-)
> If not, please do, it shows that what you are asking for will not
> happen.
I was not asking for a 'stable' one.. but a less variant... anyway, I
can survive with this policy ;-)
>
> good luck,
>
> greg k-h
>
Cheers,
Mauro.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-09-01 3:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-15 17:57 [PATCH 2.6] I2C: Drop I2C_DEVNAME and i2c_clientname Jean Delvare
2005-08-22 20:09 ` Mauro Carvalho Chehab
2005-08-24 22:19 ` Jean Delvare
2005-08-30 0:12 ` Mauro Carvalho Chehab
2005-08-30 19:44 ` Greg KH
2005-08-30 21:20 ` Jean Delvare
2005-08-31 15:34 ` Mauro Carvalho Chehab
2005-08-31 20:56 ` Greg KH
2005-09-01 3:14 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox