diff options
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/tm6000/tm6000-i2c.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 93f625fc852b..798087e9efb9 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c | |||
@@ -313,21 +313,11 @@ static u32 functionality(struct i2c_adapter *adap) | |||
313 | msleep(10); \ | 313 | msleep(10); \ |
314 | } | 314 | } |
315 | 315 | ||
316 | static struct i2c_algorithm tm6000_algo = { | 316 | static const struct i2c_algorithm tm6000_algo = { |
317 | .master_xfer = tm6000_i2c_xfer, | 317 | .master_xfer = tm6000_i2c_xfer, |
318 | .functionality = functionality, | 318 | .functionality = functionality, |
319 | }; | 319 | }; |
320 | 320 | ||
321 | static struct i2c_adapter tm6000_adap_template = { | ||
322 | .owner = THIS_MODULE, | ||
323 | .name = "tm6000", | ||
324 | .algo = &tm6000_algo, | ||
325 | }; | ||
326 | |||
327 | static struct i2c_client tm6000_client_template = { | ||
328 | .name = "tm6000 internal", | ||
329 | }; | ||
330 | |||
331 | /* ----------------------------------------------------------- */ | 321 | /* ----------------------------------------------------------- */ |
332 | 322 | ||
333 | /* | 323 | /* |
@@ -337,17 +327,20 @@ static struct i2c_client tm6000_client_template = { | |||
337 | int tm6000_i2c_register(struct tm6000_core *dev) | 327 | int tm6000_i2c_register(struct tm6000_core *dev) |
338 | { | 328 | { |
339 | unsigned char eedata[256]; | 329 | unsigned char eedata[256]; |
330 | int rc; | ||
340 | 331 | ||
341 | dev->i2c_adap = tm6000_adap_template; | 332 | dev->i2c_adap.owner = THIS_MODULE; |
333 | dev->i2c_adap.algo = &tm6000_algo; | ||
342 | dev->i2c_adap.dev.parent = &dev->udev->dev; | 334 | dev->i2c_adap.dev.parent = &dev->udev->dev; |
343 | strcpy(dev->i2c_adap.name, dev->name); | 335 | strlcpy(dev->i2c_adap.name, dev->name, sizeof(dev->i2c_adap.name)); |
344 | dev->i2c_adap.algo_data = dev; | 336 | dev->i2c_adap.algo_data = dev; |
345 | i2c_add_adapter(&dev->i2c_adap); | 337 | i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev); |
338 | rc = i2c_add_adapter(&dev->i2c_adap); | ||
339 | if (rc) | ||
340 | return rc; | ||
346 | 341 | ||
347 | dev->i2c_client = tm6000_client_template; | ||
348 | dev->i2c_client.adapter = &dev->i2c_adap; | 342 | dev->i2c_client.adapter = &dev->i2c_adap; |
349 | 343 | strlcpy(dev->i2c_client.name, "tm6000 internal", I2C_NAME_SIZE); | |
350 | i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev); | ||
351 | 344 | ||
352 | tm6000_i2c_eeprom(dev, eedata, sizeof(eedata)); | 345 | tm6000_i2c_eeprom(dev, eedata, sizeof(eedata)); |
353 | 346 | ||