aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
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/i2c
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/i2c')
-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
7 files changed, 11 insertions, 22 deletions
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);