aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/busses/i2c-mpc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index c8a8703dcbcb..d41ca31dbcb2 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -333,6 +333,9 @@ static int __devinit mpc_i2c_probe(struct ocp_device *ocp)
333 } else 333 } else
334 i2c->irq = 0; 334 i2c->irq = 0;
335 335
336 mpc_i2c_setclock(i2c);
337 ocp_set_drvdata(ocp, i2c);
338
336 i2c->adap = mpc_ops; 339 i2c->adap = mpc_ops;
337 i2c_set_adapdata(&i2c->adap, i2c); 340 i2c_set_adapdata(&i2c->adap, i2c);
338 341
@@ -341,8 +344,6 @@ static int __devinit mpc_i2c_probe(struct ocp_device *ocp)
341 goto fail_add; 344 goto fail_add;
342 } 345 }
343 346
344 mpc_i2c_setclock(i2c);
345 ocp_set_drvdata(ocp, i2c);
346 return result; 347 return result;
347 348
348 fail_add: 349 fail_add:
@@ -358,8 +359,8 @@ static int __devinit mpc_i2c_probe(struct ocp_device *ocp)
358static void __devexit mpc_i2c_remove(struct ocp_device *ocp) 359static void __devexit mpc_i2c_remove(struct ocp_device *ocp)
359{ 360{
360 struct mpc_i2c *i2c = ocp_get_drvdata(ocp); 361 struct mpc_i2c *i2c = ocp_get_drvdata(ocp);
361 ocp_set_drvdata(ocp, NULL);
362 i2c_del_adapter(&i2c->adap); 362 i2c_del_adapter(&i2c->adap);
363 ocp_set_drvdata(ocp, NULL);
363 364
364 if (ocp->def->irq != OCP_IRQ_NA) 365 if (ocp->def->irq != OCP_IRQ_NA)
365 free_irq(i2c->irq, i2c); 366 free_irq(i2c->irq, i2c);
@@ -430,6 +431,9 @@ static int fsl_i2c_probe(struct device *device)
430 goto fail_irq; 431 goto fail_irq;
431 } 432 }
432 433
434 mpc_i2c_setclock(i2c);
435 dev_set_drvdata(device, i2c);
436
433 i2c->adap = mpc_ops; 437 i2c->adap = mpc_ops;
434 i2c_set_adapdata(&i2c->adap, i2c); 438 i2c_set_adapdata(&i2c->adap, i2c);
435 i2c->adap.dev.parent = &pdev->dev; 439 i2c->adap.dev.parent = &pdev->dev;
@@ -438,8 +442,6 @@ static int fsl_i2c_probe(struct device *device)
438 goto fail_add; 442 goto fail_add;
439 } 443 }
440 444
441 mpc_i2c_setclock(i2c);
442 dev_set_drvdata(device, i2c);
443 return result; 445 return result;
444 446
445 fail_add: 447 fail_add:
@@ -456,8 +458,8 @@ static int fsl_i2c_remove(struct device *device)
456{ 458{
457 struct mpc_i2c *i2c = dev_get_drvdata(device); 459 struct mpc_i2c *i2c = dev_get_drvdata(device);
458 460
459 dev_set_drvdata(device, NULL);
460 i2c_del_adapter(&i2c->adap); 461 i2c_del_adapter(&i2c->adap);
462 dev_set_drvdata(device, NULL);
461 463
462 if (i2c->irq != 0) 464 if (i2c->irq != 0)
463 free_irq(i2c->irq, i2c); 465 free_irq(i2c->irq, i2c);