diff -aurpN -X /home/fletch/.diff.exclude 740-bt832/drivers/media/video/msp3400.c 750-i2c/drivers/media/video/msp3400.c --- 740-bt832/drivers/media/video/msp3400.c Mon Nov 17 18:28:49 2003 +++ 750-i2c/drivers/media/video/msp3400.c Fri Jan 9 23:11:10 2004 @@ -50,10 +50,6 @@ #include #include -/* kernel_thread */ -#define __KERNEL_SYSCALLS__ -#include - #include #include "msp3400.h" @@ -194,7 +190,7 @@ msp3400c_read(struct i2c_client *client, err++; printk(KERN_WARNING "msp34xx: I/O error #%d (read 0x%02x/0x%02x)\n", err, dev, addr); - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ/10); } if (3 == err) { @@ -223,7 +219,7 @@ msp3400c_write(struct i2c_client *client err++; printk(KERN_WARNING "msp34xx: I/O error #%d (write 0x%02x/0x%02x)\n", err, dev, addr); - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ/10); } if (3 == err) { @@ -804,7 +800,7 @@ static int msp3400c_thread(void *data) } /* some time for the tuner to sync */ - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ/5); if (signal_pending(current)) goto done; @@ -839,7 +835,7 @@ static int msp3400c_thread(void *data) for (this = 0; this < count; this++) { msp3400c_setcarrier(client, cd[this].cdo,cd[this].cdo); - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ/10); if (signal_pending(current)) goto done; @@ -876,7 +872,7 @@ static int msp3400c_thread(void *data) for (this = 0; this < count; this++) { msp3400c_setcarrier(client, cd[this].cdo,cd[this].cdo); - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ/10); if (signal_pending(current)) goto done; @@ -1052,7 +1048,7 @@ static int msp3410d_thread(void *data) } /* some time for the tuner to sync */ - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ/5); if (signal_pending(current)) goto done; @@ -1113,7 +1109,7 @@ static int msp3410d_thread(void *data) } else { /* triggered autodetect */ for (;;) { - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ/10); if (signal_pending(current)) goto done; @@ -1204,6 +1200,8 @@ static int msp3410d_thread(void *data) #endif break; case 0x0003: + case 0x0004: + case 0x0005: msp->mode = MSP_MODE_FM_TERRA; msp->stereo = VIDEO_SOUND_MONO; msp->nicam_on = 0; @@ -1262,7 +1260,7 @@ static int msp_attach(struct i2c_adapter DECLARE_MUTEX_LOCKED(sem); struct msp3400c *msp; struct i2c_client *c; - int i; + int i, rc; client_template.adapter = adap; client_template.addr = addr; @@ -1316,7 +1314,7 @@ static int msp_attach(struct i2c_adapter #endif msp3400c_setvolume(c,msp->muted,msp->left,msp->right); - snprintf(c->name, I2C_NAME_SIZE, "MSP34%02d%c-%c%d", + snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d", (msp->rev2>>8)&0xff, (msp->rev1&0xff)+'@', ((msp->rev1>>8)&0xff)+'@', msp->rev2&0x1f); @@ -1345,9 +1343,12 @@ static int msp_attach(struct i2c_adapter /* startup control thread */ msp->notify = &sem; - kernel_thread(msp->simple ? msp3410d_thread : msp3400c_thread, - (void *)c, 0); - down(&sem); + rc = kernel_thread(msp->simple ? msp3410d_thread : msp3400c_thread, + (void *)c, 0); + if (rc < 0) + printk(KERN_WARNING "msp34xx: kernel_thread() failed\n"); + else + down(&sem); msp->notify = NULL; wake_up_interruptible(&msp->wq); @@ -1398,8 +1399,13 @@ static int msp_detach(struct i2c_client static int msp_probe(struct i2c_adapter *adap) { +#ifdef I2C_ADAP_CLASS_TV_ANALOG if (adap->class & I2C_ADAP_CLASS_TV_ANALOG) return i2c_probe(adap, &addr_data, msp_attach); +#else + if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) + return i2c_probe(adap, &addr_data, msp_attach); +#endif return 0; } diff -aurpN -X /home/fletch/.diff.exclude 740-bt832/drivers/media/video/tda7432.c 750-i2c/drivers/media/video/tda7432.c --- 740-bt832/drivers/media/video/tda7432.c Fri May 30 19:02:10 2003 +++ 750-i2c/drivers/media/video/tda7432.c Fri Jan 9 23:11:10 2004 @@ -338,8 +338,13 @@ static int tda7432_attach(struct i2c_ada static int tda7432_probe(struct i2c_adapter *adap) { +#ifdef I2C_ADAP_CLASS_TV_ANALOG if (adap->class & I2C_ADAP_CLASS_TV_ANALOG) return i2c_probe(adap, &addr_data, tda7432_attach); +#else + if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) + return i2c_probe(adap, &addr_data, tda7432_attach); +#endif return 0; } diff -aurpN -X /home/fletch/.diff.exclude 740-bt832/drivers/media/video/tda9875.c 750-i2c/drivers/media/video/tda9875.c --- 740-bt832/drivers/media/video/tda9875.c Fri May 30 19:02:10 2003 +++ 750-i2c/drivers/media/video/tda9875.c Fri Jan 9 23:11:10 2004 @@ -272,8 +272,13 @@ static int tda9875_attach(struct i2c_ada static int tda9875_probe(struct i2c_adapter *adap) { +#ifdef I2C_ADAP_CLASS_TV_ANALOG if (adap->class & I2C_ADAP_CLASS_TV_ANALOG) return i2c_probe(adap, &addr_data, tda9875_attach); +#else + if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) + return i2c_probe(adap, &addr_data, tda9875_attach); +#endif return 0; } diff -aurpN -X /home/fletch/.diff.exclude 740-bt832/drivers/media/video/tda9887.c 750-i2c/drivers/media/video/tda9887.c --- 740-bt832/drivers/media/video/tda9887.c Wed Aug 13 20:24:24 2003 +++ 750-i2c/drivers/media/video/tda9887.c Fri Jan 9 23:11:10 2004 @@ -366,8 +366,18 @@ static int tda9887_attach(struct i2c_ada static int tda9887_probe(struct i2c_adapter *adap) { +#ifdef I2C_ADAP_CLASS_TV_ANALOG if (adap->class & I2C_ADAP_CLASS_TV_ANALOG) return i2c_probe(adap, &addr_data, tda9887_attach); +#else + switch (adap->id) { + case I2C_ALGO_BIT | I2C_HW_B_BT848: + case I2C_ALGO_BIT | I2C_HW_B_RIVA: + case I2C_ALGO_SAA7134: + return i2c_probe(adap, &addr_data, tda9887_attach); + break; + } +#endif return 0; } @@ -439,9 +449,9 @@ static struct i2c_driver driver = { }; static struct i2c_client client_template = { - .flags = I2C_CLIENT_ALLOW_USE, - .driver = &driver, - .name = "tda9887", + I2C_DEVNAME("tda9887"), + .flags = I2C_CLIENT_ALLOW_USE, + .driver = &driver, }; static int tda9887_init_module(void) diff -aurpN -X /home/fletch/.diff.exclude 740-bt832/drivers/media/video/tvaudio.c 750-i2c/drivers/media/video/tvaudio.c --- 740-bt832/drivers/media/video/tvaudio.c Fri May 30 19:02:10 2003 +++ 750-i2c/drivers/media/video/tvaudio.c Fri Jan 9 23:11:10 2004 @@ -1420,6 +1420,7 @@ static int chip_attach(struct i2c_adapte { struct CHIPSTATE *chip; struct CHIPDESC *desc; + int rc; chip = kmalloc(sizeof(*chip),GFP_KERNEL); if (!chip) @@ -1487,8 +1488,12 @@ static int chip_attach(struct i2c_adapte chip->wt.function = chip_thread_wake; chip->wt.data = (unsigned long)chip; init_waitqueue_head(&chip->wq); - kernel_thread(chip_thread,(void *)chip,0); - down(&sem); + rc = kernel_thread(chip_thread,(void *)chip,0); + if (rc < 0) + printk(KERN_WARNING "%s: kernel_thread() failed\n", + i2c_clientname(&chip->c)); + else + down(&sem); chip->notify = NULL; wake_up_interruptible(&chip->wq); } @@ -1497,8 +1502,17 @@ static int chip_attach(struct i2c_adapte static int chip_probe(struct i2c_adapter *adap) { +#ifdef I2C_ADAP_CLASS_TV_ANALOG if (adap->class & I2C_ADAP_CLASS_TV_ANALOG) return i2c_probe(adap, &addr_data, chip_attach); +#else + switch (adap->id) { + case I2C_ALGO_BIT | I2C_HW_B_BT848: + case I2C_ALGO_BIT | I2C_HW_B_RIVA: + case I2C_ALGO_SAA7134: + return i2c_probe(adap, &addr_data, chip_attach); + } +#endif return 0; } diff -aurpN -X /home/fletch/.diff.exclude 740-bt832/drivers/media/video/tvmixer.c 750-i2c/drivers/media/video/tvmixer.c --- 740-bt832/drivers/media/video/tvmixer.c Mon Nov 17 18:28:14 2003 +++ 750-i2c/drivers/media/video/tvmixer.c Fri Jan 9 23:11:10 2004 @@ -190,6 +190,10 @@ static int tvmixer_open(struct inode *in /* 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 if (client->adapter->owner) try_module_get(client->adapter->owner); return 0; @@ -205,17 +209,27 @@ static int tvmixer_release(struct inode return -ENODEV; } +#ifndef I2C_PEC + if (client->adapter->dec_use) + client->adapter->dec_use(client->adapter); +#endif if (client->adapter->owner) module_put(client->adapter->owner); 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 + .flags = I2C_DF_DUMMY, +#else .flags = I2C_DF_NOTIFY, .detach_adapter = tvmixer_adapters, +#endif .attach_adapter = tvmixer_adapters, .detach_client = tvmixer_clients, }; @@ -247,8 +261,21 @@ static int tvmixer_clients(struct i2c_cl struct video_audio va; int i,minor; +#ifdef I2C_ADAP_CLASS_TV_ANALOG if (!(client->adapter->class & I2C_ADAP_CLASS_TV_ANALOG)) return -1; +#else + /* TV card ??? */ + switch (client->adapter->id) { + case I2C_ALGO_BIT | I2C_HW_B_BT848: + case I2C_ALGO_BIT | I2C_HW_B_RIVA: + /* ok, have a look ... */ + break; + default: + /* ignore that one */ + return -1; + } +#endif /* unregister ?? */ for (i = 0; i < DEV_MAX; i++) { diff -aurpN -X /home/fletch/.diff.exclude 740-bt832/include/media/id.h 750-i2c/include/media/id.h --- 740-bt832/include/media/id.h Mon Mar 17 21:43:50 2003 +++ 750-i2c/include/media/id.h Fri Jan 9 23:11:10 2004 @@ -27,6 +27,9 @@ #ifndef I2C_DRIVERID_TDA9874 # define I2C_DRIVERID_TDA9874 I2C_DRIVERID_EXP0+7 #endif +#ifndef I2C_DRIVERID_SAA6752HS +# define I2C_DRIVERID_SAA6752HS I2C_DRIVERID_EXP0+8 +#endif /* algorithms */ #ifndef I2C_ALGO_SAA7134