[i2c] [patch 2.6.20-rc1 3/6] other i2c code stops using i2c_adapter.dev
Jean Delvare
khali at linux-fr.org
Tue Dec 19 11:27:14 CET 2006
David,
On Mon, 18 Dec 2006 13:20:00 -0800, David Brownell wrote:
> Update various I2C drivers and algorithms so they stop referencing
> the soon-to-be-gone i2c_adapter.dev; they were using it for messages.
> Also does the same for the i2c core.
> (...)
> @@ -678,12 +689,12 @@
> static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind,
> int (*found_proc) (struct i2c_adapter *, int, int))
> {
> + struct device *dev = adapter->class_dev.dev;
> int err;
>
> /* Make sure the address is valid */
> if (addr < 0x03 || addr > 0x77) {
> - dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
> - addr);
> + dev_warn(dev, "Invalid probe address 0x%02x\n", addr);
> return -EINVAL;
> }
>
> @@ -712,8 +723,8 @@ static int i2c_probe_address(struct i2c_
> err = 0;
>
> if (err)
> - dev_warn(&adapter->dev, "Client creation failed at 0x%x (%d)\n",
> - addr, err);
> + dev_warn(dev, "found_proc %p failed at 0x%x (%d)\n",
> + found_proc, addr, err);
> return err;
> }
>
You changed the message to something I wouldn't call user-friendly. The
regular user isn't going to do much with the address of the function
which failed, nor is he/she likely to understand what "found_proc" is.
I believe that the original message was more explicit of what happened,
even though I agree that it lacks the detail of which probe function
failed.
If you want to change this message, it would be more useful to add the
adapter number, as it is gone now (or will soon be.) If you want to
display the callback function's address, that would rather be in an
additional dev_dbg() message.
As a side note, I start wondering if what we need isn't a set of
class_{dbg,info,warn,err} macros for class devices, based on the
class_id, as we have for devices based on the bus_id. What do you
think?
--
Jean Delvare
More information about the i2c
mailing list