aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-07-27 16:14:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 12:14:14 -0400
commit7bef559455fc71f66f8573cc1aafe1dd33966c1c (patch)
tree6c342574710f730d39bf5383f81eaa9f9bb10a25 /drivers
parent1ff4e3065b41847b6fe5908b1214cb508dd49e61 (diff)
[PATCH] I2C: refactor message in i2c_detach_client
We could refactor the error message 34 different i2c drivers print if i2c_detach_client() fails in this function itself. Saves quite a few lines of code. Documentation is updated to reflect that change. Note that this patch should be applied after Rudolf Marek's w83792d patches. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/adm1021.c4
-rw-r--r--drivers/hwmon/adm1025.c5
-rw-r--r--drivers/hwmon/adm9240.c5
-rw-r--r--drivers/hwmon/asb100.c5
-rw-r--r--drivers/hwmon/ds1621.c5
-rw-r--r--drivers/hwmon/fscher.c5
-rw-r--r--drivers/hwmon/fscpos.c5
-rw-r--r--drivers/hwmon/gl518sm.c5
-rw-r--r--drivers/hwmon/gl520sm.c5
-rw-r--r--drivers/hwmon/it87.c5
-rw-r--r--drivers/hwmon/lm63.c5
-rw-r--r--drivers/hwmon/lm78.c5
-rw-r--r--drivers/hwmon/lm80.c5
-rw-r--r--drivers/hwmon/lm83.c5
-rw-r--r--drivers/hwmon/lm87.c5
-rw-r--r--drivers/hwmon/lm90.c5
-rw-r--r--drivers/hwmon/lm92.c5
-rw-r--r--drivers/hwmon/max1619.c5
-rw-r--r--drivers/hwmon/pc87360.c5
-rw-r--r--drivers/hwmon/sis5595.c5
-rw-r--r--drivers/hwmon/smsc47b397.c5
-rw-r--r--drivers/hwmon/smsc47m1.c5
-rw-r--r--drivers/hwmon/via686a.c5
-rw-r--r--drivers/hwmon/w83627ehf.c5
-rw-r--r--drivers/hwmon/w83627hf.c5
-rw-r--r--drivers/hwmon/w83781d.c5
-rw-r--r--drivers/hwmon/w83792d.c5
-rw-r--r--drivers/hwmon/w83l785ts.c5
-rw-r--r--drivers/i2c/chips/ds1337.c5
-rw-r--r--drivers/i2c/chips/eeprom.c4
-rw-r--r--drivers/i2c/chips/max6875.c4
-rw-r--r--drivers/i2c/chips/pca9539.c4
-rw-r--r--drivers/i2c/chips/pcf8574.c5
-rw-r--r--drivers/i2c/chips/pcf8591.c5
-rw-r--r--drivers/i2c/i2c-core.c6
35 files changed, 39 insertions, 133 deletions
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index 2a341390d92e..da3e2c9f705f 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -328,10 +328,8 @@ static int adm1021_detach_client(struct i2c_client *client)
328 328
329 hwmon_device_unregister(data->class_dev); 329 hwmon_device_unregister(data->class_dev);
330 330
331 if ((err = i2c_detach_client(client))) { 331 if ((err = i2c_detach_client(client)))
332 dev_err(&client->dev, "Client deregistration failed, client not detached.\n");
333 return err; 332 return err;
334 }
335 333
336 kfree(data); 334 kfree(data);
337 return 0; 335 return 0;
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
index bdba01e2f3ed..181dadf42002 100644
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -517,11 +517,8 @@ static int adm1025_detach_client(struct i2c_client *client)
517 517
518 hwmon_device_unregister(data->class_dev); 518 hwmon_device_unregister(data->class_dev);
519 519
520 if ((err = i2c_detach_client(client))) { 520 if ((err = i2c_detach_client(client)))
521 dev_err(&client->dev, "Client deregistration failed, "
522 "client not detached.\n");
523 return err; 521 return err;
524 }
525 522
526 kfree(data); 523 kfree(data);
527 return 0; 524 return 0;
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index d52100027665..82edf286ebdc 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -645,11 +645,8 @@ static int adm9240_detach_client(struct i2c_client *client)
645 645
646 hwmon_device_unregister(data->class_dev); 646 hwmon_device_unregister(data->class_dev);
647 647
648 if ((err = i2c_detach_client(client))) { 648 if ((err = i2c_detach_client(client)))
649 dev_err(&client->dev, "Client deregistration failed, "
650 "client not detached.\n");
651 return err; 649 return err;
652 }
653 650
654 kfree(data); 651 kfree(data);
655 return 0; 652 return 0;
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index 290f7d2ac0a8..c6a2c94fad36 100644
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -867,11 +867,8 @@ static int asb100_detach_client(struct i2c_client *client)
867 if (data) 867 if (data)
868 hwmon_device_unregister(data->class_dev); 868 hwmon_device_unregister(data->class_dev);
869 869
870 if ((err = i2c_detach_client(client))) { 870 if ((err = i2c_detach_client(client)))
871 dev_err(&client->dev, "client deregistration failed; "
872 "client not detached.\n");
873 return err; 871 return err;
874 }
875 872
876 /* main client */ 873 /* main client */
877 if (data) 874 if (data)
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index 4a316a7f7980..3ac37e95d2ef 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -282,11 +282,8 @@ static int ds1621_detach_client(struct i2c_client *client)
282 282
283 hwmon_device_unregister(data->class_dev); 283 hwmon_device_unregister(data->class_dev);
284 284
285 if ((err = i2c_detach_client(client))) { 285 if ((err = i2c_detach_client(client)))
286 dev_err(&client->dev, "Client deregistration failed, "
287 "client not detached.\n");
288 return err; 286 return err;
289 }
290 287
291 kfree(data); 288 kfree(data);
292 289
diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c
index c7caa95c643b..ddf22fbf4ed1 100644
--- a/drivers/hwmon/fscher.c
+++ b/drivers/hwmon/fscher.c
@@ -383,11 +383,8 @@ static int fscher_detach_client(struct i2c_client *client)
383 383
384 hwmon_device_unregister(data->class_dev); 384 hwmon_device_unregister(data->class_dev);
385 385
386 if ((err = i2c_detach_client(client))) { 386 if ((err = i2c_detach_client(client)))
387 dev_err(&client->dev, "Client deregistration failed, "
388 "client not detached.\n");
389 return err; 387 return err;
390 }
391 388
392 kfree(data); 389 kfree(data);
393 return 0; 390 return 0;
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c
index fd75e444e758..489870ad6056 100644
--- a/drivers/hwmon/fscpos.c
+++ b/drivers/hwmon/fscpos.c
@@ -549,11 +549,8 @@ static int fscpos_detach_client(struct i2c_client *client)
549 549
550 hwmon_device_unregister(data->class_dev); 550 hwmon_device_unregister(data->class_dev);
551 551
552 if ((err = i2c_detach_client(client))) { 552 if ((err = i2c_detach_client(client)))
553 dev_err(&client->dev, "Client deregistration failed, client"
554 " not detached.\n");
555 return err; 553 return err;
556 }
557 kfree(data); 554 kfree(data);
558 return 0; 555 return 0;
559} 556}
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c
index 34d85b1e5539..63a2756c283a 100644
--- a/drivers/hwmon/gl518sm.c
+++ b/drivers/hwmon/gl518sm.c
@@ -492,11 +492,8 @@ static int gl518_detach_client(struct i2c_client *client)
492 492
493 hwmon_device_unregister(data->class_dev); 493 hwmon_device_unregister(data->class_dev);
494 494
495 if ((err = i2c_detach_client(client))) { 495 if ((err = i2c_detach_client(client)))
496 dev_err(&client->dev, "Client deregistration failed, "
497 "client not detached.\n");
498 return err; 496 return err;
499 }
500 497
501 kfree(data); 498 kfree(data);
502 return 0; 499 return 0;
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index b129d153deab..ff71eb7ac681 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -654,11 +654,8 @@ static int gl520_detach_client(struct i2c_client *client)
654 654
655 hwmon_device_unregister(data->class_dev); 655 hwmon_device_unregister(data->class_dev);
656 656
657 if ((err = i2c_detach_client(client))) { 657 if ((err = i2c_detach_client(client)))
658 dev_err(&client->dev, "Client deregistration failed, "
659 "client not detached.\n");
660 return err; 658 return err;
661 }
662 659
663 kfree(data); 660 kfree(data);
664 return 0; 661 return 0;
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 0a8d795f15c2..b1719f4097ef 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -945,11 +945,8 @@ static int it87_detach_client(struct i2c_client *client)
945 945
946 hwmon_device_unregister(data->class_dev); 946 hwmon_device_unregister(data->class_dev);
947 947
948 if ((err = i2c_detach_client(client))) { 948 if ((err = i2c_detach_client(client)))
949 dev_err(&client->dev,
950 "Client deregistration failed, client not detached.\n");
951 return err; 949 return err;
952 }
953 950
954 if(i2c_is_isa_client(client)) 951 if(i2c_is_isa_client(client))
955 release_region(client->addr, IT87_EXTENT); 952 release_region(client->addr, IT87_EXTENT);
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
index e19b11fd4816..736126d73aa2 100644
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -520,11 +520,8 @@ static int lm63_detach_client(struct i2c_client *client)
520 520
521 hwmon_device_unregister(data->class_dev); 521 hwmon_device_unregister(data->class_dev);
522 522
523 if ((err = i2c_detach_client(client))) { 523 if ((err = i2c_detach_client(client)))
524 dev_err(&client->dev, "Client deregistration failed, "
525 "client not detached\n");
526 return err; 524 return err;
527 }
528 525
529 kfree(data); 526 kfree(data);
530 return 0; 527 return 0;
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index 784935f77016..21b767a66bbd 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -683,11 +683,8 @@ static int lm78_detach_client(struct i2c_client *client)
683 683
684 hwmon_device_unregister(data->class_dev); 684 hwmon_device_unregister(data->class_dev);
685 685
686 if ((err = i2c_detach_client(client))) { 686 if ((err = i2c_detach_client(client)))
687 dev_err(&client->dev,
688 "Client deregistration failed, client not detached.\n");
689 return err; 687 return err;
690 }
691 688
692 if(i2c_is_isa_client(client)) 689 if(i2c_is_isa_client(client))
693 release_region(client->addr, LM78_EXTENT); 690 release_region(client->addr, LM78_EXTENT);
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
index fa2cb17018cc..36a0cda36a7d 100644
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -510,11 +510,8 @@ static int lm80_detach_client(struct i2c_client *client)
510 510
511 hwmon_device_unregister(data->class_dev); 511 hwmon_device_unregister(data->class_dev);
512 512
513 if ((err = i2c_detach_client(client))) { 513 if ((err = i2c_detach_client(client)))
514 dev_err(&client->dev, "Client deregistration failed, "
515 "client not detached.\n");
516 return err; 514 return err;
517 }
518 515
519 kfree(data); 516 kfree(data);
520 return 0; 517 return 0;
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c
index 0223b4d2ce1d..f3557f8826a9 100644
--- a/drivers/hwmon/lm83.c
+++ b/drivers/hwmon/lm83.c
@@ -363,11 +363,8 @@ static int lm83_detach_client(struct i2c_client *client)
363 363
364 hwmon_device_unregister(data->class_dev); 364 hwmon_device_unregister(data->class_dev);
365 365
366 if ((err = i2c_detach_client(client))) { 366 if ((err = i2c_detach_client(client)))
367 dev_err(&client->dev,
368 "Client deregistration failed, client not detached.\n");
369 return err; 367 return err;
370 }
371 368
372 kfree(data); 369 kfree(data);
373 return 0; 370 return 0;
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index 1dc3bf52b40d..f0ffe58e3670 100644
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -734,11 +734,8 @@ static int lm87_detach_client(struct i2c_client *client)
734 734
735 hwmon_device_unregister(data->class_dev); 735 hwmon_device_unregister(data->class_dev);
736 736
737 if ((err = i2c_detach_client(client))) { 737 if ((err = i2c_detach_client(client)))
738 dev_err(&client->dev, "Client deregistration failed, "
739 "client not detached.\n");
740 return err; 738 return err;
741 }
742 739
743 kfree(data); 740 kfree(data);
744 return 0; 741 return 0;
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 4b914ec205fa..fbf9dac41ee5 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -562,11 +562,8 @@ static int lm90_detach_client(struct i2c_client *client)
562 562
563 hwmon_device_unregister(data->class_dev); 563 hwmon_device_unregister(data->class_dev);
564 564
565 if ((err = i2c_detach_client(client))) { 565 if ((err = i2c_detach_client(client)))
566 dev_err(&client->dev, "Client deregistration failed, "
567 "client not detached.\n");
568 return err; 566 return err;
569 }
570 567
571 kfree(data); 568 kfree(data);
572 return 0; 569 return 0;
diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c
index 9c43120d6bd7..9740ee264051 100644
--- a/drivers/hwmon/lm92.c
+++ b/drivers/hwmon/lm92.c
@@ -399,11 +399,8 @@ static int lm92_detach_client(struct i2c_client *client)
399 399
400 hwmon_device_unregister(data->class_dev); 400 hwmon_device_unregister(data->class_dev);
401 401
402 if ((err = i2c_detach_client(client))) { 402 if ((err = i2c_detach_client(client)))
403 dev_err(&client->dev, "Client deregistration failed, "
404 "client not detached.\n");
405 return err; 403 return err;
406 }
407 404
408 kfree(data); 405 kfree(data);
409 return 0; 406 return 0;
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
index 5f0376575c62..a53d7df92ba2 100644
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -322,11 +322,8 @@ static int max1619_detach_client(struct i2c_client *client)
322 322
323 hwmon_device_unregister(data->class_dev); 323 hwmon_device_unregister(data->class_dev);
324 324
325 if ((err = i2c_detach_client(client))) { 325 if ((err = i2c_detach_client(client)))
326 dev_err(&client->dev, "Client deregistration failed, "
327 "client not detached.\n");
328 return err; 326 return err;
329 }
330 327
331 kfree(data); 328 kfree(data);
332 return 0; 329 return 0;
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 4041488de6f1..1f1b3ca23f6f 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -984,11 +984,8 @@ static int pc87360_detach_client(struct i2c_client *client)
984 984
985 hwmon_device_unregister(data->class_dev); 985 hwmon_device_unregister(data->class_dev);
986 986
987 if ((i = i2c_detach_client(client))) { 987 if ((i = i2c_detach_client(client)))
988 dev_err(&client->dev, "Client deregistration failed, "
989 "client not detached.\n");
990 return i; 988 return i;
991 }
992 989
993 for (i = 0; i < 3; i++) { 990 for (i = 0; i < 3; i++) {
994 if (data->address[i]) { 991 if (data->address[i]) {
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 67246299a308..55716cb579aa 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -618,11 +618,8 @@ static int sis5595_detach_client(struct i2c_client *client)
618 618
619 hwmon_device_unregister(data->class_dev); 619 hwmon_device_unregister(data->class_dev);
620 620
621 if ((err = i2c_detach_client(client))) { 621 if ((err = i2c_detach_client(client)))
622 dev_err(&client->dev,
623 "Client deregistration failed, client not detached.\n");
624 return err; 622 return err;
625 }
626 623
627 release_region(client->addr, SIS5595_EXTENT); 624 release_region(client->addr, SIS5595_EXTENT);
628 625
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c
index dddc94a7649b..7fe71576dea4 100644
--- a/drivers/hwmon/smsc47b397.c
+++ b/drivers/hwmon/smsc47b397.c
@@ -214,11 +214,8 @@ static int smsc47b397_detach_client(struct i2c_client *client)
214 214
215 hwmon_device_unregister(data->class_dev); 215 hwmon_device_unregister(data->class_dev);
216 216
217 if ((err = i2c_detach_client(client))) { 217 if ((err = i2c_detach_client(client)))
218 dev_err(&client->dev, "Client deregistration failed, "
219 "client not detached.\n");
220 return err; 218 return err;
221 }
222 219
223 release_region(client->addr, SMSC_EXTENT); 220 release_region(client->addr, SMSC_EXTENT);
224 kfree(data); 221 kfree(data);
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 8126fdd7cbee..9da5d546e861 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -497,11 +497,8 @@ static int smsc47m1_detach_client(struct i2c_client *client)
497 497
498 hwmon_device_unregister(data->class_dev); 498 hwmon_device_unregister(data->class_dev);
499 499
500 if ((err = i2c_detach_client(client))) { 500 if ((err = i2c_detach_client(client)))
501 dev_err(&client->dev, "Client deregistration failed, "
502 "client not detached.\n");
503 return err; 501 return err;
504 }
505 502
506 release_region(client->addr, SMSC_EXTENT); 503 release_region(client->addr, SMSC_EXTENT);
507 kfree(data); 504 kfree(data);
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index cd3732c36671..d9251fb0b625 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -700,11 +700,8 @@ static int via686a_detach_client(struct i2c_client *client)
700 700
701 hwmon_device_unregister(data->class_dev); 701 hwmon_device_unregister(data->class_dev);
702 702
703 if ((err = i2c_detach_client(client))) { 703 if ((err = i2c_detach_client(client)))
704 dev_err(&client->dev,
705 "Client deregistration failed, client not detached.\n");
706 return err; 704 return err;
707 }
708 705
709 release_region(client->addr, VIA686A_EXTENT); 706 release_region(client->addr, VIA686A_EXTENT);
710 kfree(data); 707 kfree(data);
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index b14801cd615d..b60efe8f8b26 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -774,11 +774,8 @@ static int w83627ehf_detach_client(struct i2c_client *client)
774 774
775 hwmon_device_unregister(data->class_dev); 775 hwmon_device_unregister(data->class_dev);
776 776
777 if ((err = i2c_detach_client(client))) { 777 if ((err = i2c_detach_client(client)))
778 dev_err(&client->dev, "Client deregistration failed, "
779 "client not detached.\n");
780 return err; 778 return err;
781 }
782 release_region(client->addr, REGION_LENGTH); 779 release_region(client->addr, REGION_LENGTH);
783 kfree(data); 780 kfree(data);
784 781
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index 9e31f5559ccc..f1ae0e00691b 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -1157,11 +1157,8 @@ static int w83627hf_detach_client(struct i2c_client *client)
1157 1157
1158 hwmon_device_unregister(data->class_dev); 1158 hwmon_device_unregister(data->class_dev);
1159 1159
1160 if ((err = i2c_detach_client(client))) { 1160 if ((err = i2c_detach_client(client)))
1161 dev_err(&client->dev,
1162 "Client deregistration failed, client not detached.\n");
1163 return err; 1161 return err;
1164 }
1165 1162
1166 release_region(client->addr, WINB_EXTENT); 1163 release_region(client->addr, WINB_EXTENT);
1167 kfree(data); 1164 kfree(data);
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index 70718559de75..66835c1e3f68 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1299,11 +1299,8 @@ w83781d_detach_client(struct i2c_client *client)
1299 if (i2c_is_isa_client(client)) 1299 if (i2c_is_isa_client(client))
1300 release_region(client->addr, W83781D_EXTENT); 1300 release_region(client->addr, W83781D_EXTENT);
1301 1301
1302 if ((err = i2c_detach_client(client))) { 1302 if ((err = i2c_detach_client(client)))
1303 dev_err(&client->dev,
1304 "Client deregistration failed, client not detached.\n");
1305 return err; 1303 return err;
1306 }
1307 1304
1308 /* main client */ 1305 /* main client */
1309 if (data) 1306 if (data)
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index 05f9b92ad3e7..ea0c3519e03a 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -1396,11 +1396,8 @@ w83792d_detach_client(struct i2c_client *client)
1396 if (data) 1396 if (data)
1397 hwmon_device_unregister(data->class_dev); 1397 hwmon_device_unregister(data->class_dev);
1398 1398
1399 if ((err = i2c_detach_client(client))) { 1399 if ((err = i2c_detach_client(client)))
1400 dev_err(&client->dev,
1401 "Client deregistration failed, client not detached.\n");
1402 return err; 1400 return err;
1403 }
1404 1401
1405 /* main client */ 1402 /* main client */
1406 if (data) 1403 if (data)
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c
index 9cd1939cd040..213fb170d397 100644
--- a/drivers/hwmon/w83l785ts.c
+++ b/drivers/hwmon/w83l785ts.c
@@ -267,11 +267,8 @@ static int w83l785ts_detach_client(struct i2c_client *client)
267 267
268 hwmon_device_unregister(data->class_dev); 268 hwmon_device_unregister(data->class_dev);
269 269
270 if ((err = i2c_detach_client(client))) { 270 if ((err = i2c_detach_client(client)))
271 dev_err(&client->dev, "Client deregistration failed, "
272 "client not detached.\n");
273 return err; 271 return err;
274 }
275 272
276 kfree(data); 273 kfree(data);
277 return 0; 274 return 0;
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
index 6ac0a6e00769..8ab4e2348cda 100644
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -353,11 +353,8 @@ static int ds1337_detach_client(struct i2c_client *client)
353 int err; 353 int err;
354 struct ds1337_data *data = i2c_get_clientdata(client); 354 struct ds1337_data *data = i2c_get_clientdata(client);
355 355
356 if ((err = i2c_detach_client(client))) { 356 if ((err = i2c_detach_client(client)))
357 dev_err(&client->dev, "Client deregistration failed, "
358 "client not detached.\n");
359 return err; 357 return err;
360 }
361 358
362 list_del(&data->list); 359 list_del(&data->list);
363 kfree(data); 360 kfree(data);
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
index 88f83bac3845..9466ada68932 100644
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -230,10 +230,8 @@ static int eeprom_detach_client(struct i2c_client *client)
230 int err; 230 int err;
231 231
232 err = i2c_detach_client(client); 232 err = i2c_detach_client(client);
233 if (err) { 233 if (err)
234 dev_err(&client->dev, "Client deregistration failed, client not detached.\n");
235 return err; 234 return err;
236 }
237 235
238 kfree(i2c_get_clientdata(client)); 236 kfree(i2c_get_clientdata(client));
239 237
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
index d1d48586b90e..52fd6bf29133 100644
--- a/drivers/i2c/chips/max6875.c
+++ b/drivers/i2c/chips/max6875.c
@@ -242,10 +242,8 @@ static int max6875_detach_client(struct i2c_client *client)
242 int err; 242 int err;
243 243
244 err = i2c_detach_client(client); 244 err = i2c_detach_client(client);
245 if (err) { 245 if (err)
246 dev_err(&client->dev, "i2c_detach_client() failed\n");
247 return err; 246 return err;
248 }
249 kfree(i2c_get_clientdata(client)); 247 kfree(i2c_get_clientdata(client));
250 return 0; 248 return 0;
251} 249}
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c
index c5b052363d9a..1500b1842ce5 100644
--- a/drivers/i2c/chips/pca9539.c
+++ b/drivers/i2c/chips/pca9539.c
@@ -163,10 +163,8 @@ static int pca9539_detach_client(struct i2c_client *client)
163{ 163{
164 int err; 164 int err;
165 165
166 if ((err = i2c_detach_client(client))) { 166 if ((err = i2c_detach_client(client)))
167 dev_err(&client->dev, "Client deregistration failed.\n");
168 return err; 167 return err;
169 }
170 168
171 kfree(i2c_get_clientdata(client)); 169 kfree(i2c_get_clientdata(client));
172 return 0; 170 return 0;
diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c
index 7a1fa7914630..a109dfd3dbe7 100644
--- a/drivers/i2c/chips/pcf8574.c
+++ b/drivers/i2c/chips/pcf8574.c
@@ -185,11 +185,8 @@ static int pcf8574_detach_client(struct i2c_client *client)
185{ 185{
186 int err; 186 int err;
187 187
188 if ((err = i2c_detach_client(client))) { 188 if ((err = i2c_detach_client(client)))
189 dev_err(&client->dev,
190 "Client deregistration failed, client not detached.\n");
191 return err; 189 return err;
192 }
193 190
194 kfree(i2c_get_clientdata(client)); 191 kfree(i2c_get_clientdata(client));
195 return 0; 192 return 0;
diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c
index 225b512dd4ad..7fce0fc048d9 100644
--- a/drivers/i2c/chips/pcf8591.c
+++ b/drivers/i2c/chips/pcf8591.c
@@ -240,11 +240,8 @@ static int pcf8591_detach_client(struct i2c_client *client)
240{ 240{
241 int err; 241 int err;
242 242
243 if ((err = i2c_detach_client(client))) { 243 if ((err = i2c_detach_client(client)))
244 dev_err(&client->dev,
245 "Client deregistration failed, client not detached.\n");
246 return err; 244 return err;
247 }
248 245
249 kfree(i2c_get_clientdata(client)); 246 kfree(i2c_get_clientdata(client));
250 return 0; 247 return 0;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 7a7837ae3114..b0bceb2fb8b1 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -449,8 +449,12 @@ int i2c_detach_client(struct i2c_client *client)
449 struct i2c_adapter *adapter = client->adapter; 449 struct i2c_adapter *adapter = client->adapter;
450 int res = 0; 450 int res = 0;
451 451
452 if ((client->flags & I2C_CLIENT_ALLOW_USE) && (client->usage_count > 0)) 452 if ((client->flags & I2C_CLIENT_ALLOW_USE)
453 && (client->usage_count > 0)) {
454 dev_warn(&client->dev, "Client [%s] still busy, "
455 "can't detach\n", client->name);
453 return -EBUSY; 456 return -EBUSY;
457 }
454 458
455 if (adapter->client_unregister) { 459 if (adapter->client_unregister) {
456 res = adapter->client_unregister(client); 460 res = adapter->client_unregister(client);