i2c: core: Add client I2C address to devinfo
PATCH 1/1 i2c: core: Add client I2C address to devinfo
Useful bit of information. Example:
barebox:/ devinfo dummy0
Bus: i2c
Address: 0x52
Signed-off-by Trent Piepho <[email protected]>
--- drivers/i2c/i2c.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/i2c/i2c.c +9 -0
@@ -358,6 +358,14 @@ int i2c_recover_bus(struct i2c_adapter *adap)return adap->bus_recovery_info->recover_bus (adap); } +static void i2c_info (struct device_d *dev) +{ +const struct i2c_client *client =to_i2c_client (dev); + +printf (" Address: 0x%02x\n" , client->addr); +return ; +} +/** * i2c_new_device - instantiate one new I2C device *
@@ -396,6 +404,7 @@ static struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,free (client);return NULL ; } + client->dev.info = i2c_info;return client; }
Signature · 7 lines
1.8.3.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 4 lines · Trent Piepho
Useful bit of information. Example:
barebox:/ devinfo dummy0
Bus: i2c
Address:0x52
Indeed useful. Applied, thanks
Sascha
Quoted 42 lines
Signed-off-by Trent Piepho <[email protected]>--- drivers/i2c/i2c.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/i2c/i2c.c +9
-0@@ -358,6 +358,14 @@ int i2c_recover_bus(struct i2c_adapter *adap)return adap->bus_recovery_info->recover_bus (adap); } +static void i2c_info (struct device_d *dev) +{ +const struct i2c_client *client =to_i2c_client (dev); + +printf (" Address: 0x%02x\n" , client->addr); +return ; +} +/** * i2c_new_device - instantiate one new I2C device * @@ -396,6 +404,7 @@ static struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,free (client);return NULL ; } + client->dev.info = i2c_info;return client; }Signature · 7 lines
1.8.3.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox