X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Ftda9840.c;h=ef494febb5e4f7996c9752861cde4134c6c74c80;hb=refs%2Fheads%2Fvserver;hp=c0438989d28bdd07d4463160a79c23926d8c345b;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index c0438989d..ef494febb 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c @@ -24,6 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + #include #include #include @@ -34,7 +35,7 @@ static int debug = 0; /* insmod parameter */ module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); #define dprintk(args...) \ - do { if (debug) { printk("%s: %s()[%d]: ",__stringify(KBUILD_MODNAME), __FUNCTION__, __LINE__); printk(args); } } while (0) + do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) #define SWITCH 0x00 #define LEVEL_ADJUST 0x02 @@ -42,8 +43,7 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); #define TEST 0x04 /* addresses to scan, found only at 0x42 (7-Bit) */ -static unsigned short normal_i2c[] = { I2C_TDA9840, I2C_CLIENT_END }; -static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; +static unsigned short normal_i2c[] = { I2C_ADDR_TDA9840, I2C_CLIENT_END }; /* magic definition of all other variables and things */ I2C_CLIENT_INSMOD; @@ -51,9 +51,6 @@ I2C_CLIENT_INSMOD; static struct i2c_driver driver; static struct i2c_client client_template; -/* unique ID allocation */ -static int tda9840_id = 0; - static int command(struct i2c_client *client, unsigned int cmd, void *arg) { int result; @@ -120,7 +117,8 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg) dprintk("i2c_smbus_write_byte() failed, ret:%d\n", result); break; - case TDA9840_DETECT: + case TDA9840_DETECT: { + int *ret = (int *)arg; byte = i2c_smbus_read_byte_data(client, STEREO_ADJUST); if (byte == -1) { @@ -134,8 +132,10 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg) } dprintk("TDA9840_DETECT: byte: 0x%02x\n", byte); - return ((byte & 0x60) >> 5); - + *ret = ((byte & 0x60) >> 5); + result = 0; + break; + } case TDA9840_TEST: dprintk("TDA9840_TEST: 0x%02x\n", byte); @@ -179,7 +179,6 @@ static int detect(struct i2c_adapter *adapter, int address, int kind) /* fill client structure */ memcpy(client, &client_template, sizeof(struct i2c_client)); - client->id = tda9840_id++; client->addr = address; client->adapter = adapter; @@ -207,7 +206,7 @@ static int detect(struct i2c_adapter *adapter, int address, int kind) static int attach(struct i2c_adapter *adapter) { /* let's see whether this is a know adapter we can attach to */ - if (adapter->id != I2C_ALGO_SAA7146) { + if (adapter->id != I2C_HW_SAA7146) { dprintk("refusing to probe on unknown adapter [name='%s',id=0x%x]\n", adapter->name, adapter->id); return -ENODEV; } @@ -223,17 +222,17 @@ static int detach(struct i2c_client *client) } static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "tda9840", + .driver = { + .name = "tda9840", + }, .id = I2C_DRIVERID_TDA9840, - .flags = I2C_DF_NOTIFY, .attach_adapter = attach, .detach_client = detach, .command = command, }; static struct i2c_client client_template = { - I2C_DEVNAME("tda9840"), + .name = "tda9840", .driver = &driver, };