Commit 7bef5594 authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman
Browse files

[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: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1ff4e306
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -94,7 +94,8 @@ Technical changes:
  limited to the strictly necessary steps.

* [Detach] Get rid of data, remove the call to
  i2c_deregister_entry.
  i2c_deregister_entry. Do not log an error message if
  i2c_detach_client fails, as i2c-core will now do it for you.

* [Update] Don't access client->data directly, use
  i2c_get_clientdata(client) instead.
+1 −3
Original line number Diff line number Diff line
@@ -489,10 +489,8 @@ much simpler than the attachment code, fortunately!
    /* SENSORS ONLY END */

    /* Try to detach the client from i2c space */
    if ((err = i2c_detach_client(client))) {
      printk("foo.o: Client deregistration failed, client not detached.\n");
    if ((err = i2c_detach_client(client)))
      return err;
    }

    /* HYBRID SENSORS CHIP ONLY START */
    if i2c_is_isa_client(client)
+1 −3
Original line number Diff line number Diff line
@@ -328,10 +328,8 @@ static int adm1021_detach_client(struct i2c_client *client)

	hwmon_device_unregister(data->class_dev);

	if ((err = i2c_detach_client(client))) {
		dev_err(&client->dev, "Client deregistration failed, client not detached.\n");
	if ((err = i2c_detach_client(client)))
		return err;
	}

	kfree(data);
	return 0;
+1 −4
Original line number Diff line number Diff line
@@ -517,11 +517,8 @@ static int adm1025_detach_client(struct i2c_client *client)

	hwmon_device_unregister(data->class_dev);

	if ((err = i2c_detach_client(client))) {
		dev_err(&client->dev, "Client deregistration failed, "
			"client not detached.\n");
	if ((err = i2c_detach_client(client)))
		return err;
	}

	kfree(data);
	return 0;
+1 −4
Original line number Diff line number Diff line
@@ -645,11 +645,8 @@ static int adm9240_detach_client(struct i2c_client *client)

	hwmon_device_unregister(data->class_dev);

	if ((err = i2c_detach_client(client))) {
		dev_err(&client->dev, "Client deregistration failed, "
				"client not detached.\n");
	if ((err = i2c_detach_client(client)))
		return err;
	}

	kfree(data);
	return 0;
Loading