mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] i2c: core: Add client I2C address to devinfo
@ 2015-11-19 19:57 Trent Piepho
  2015-11-20  7:51 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Trent Piepho @ 2015-11-19 19:57 UTC (permalink / raw)
  To: barebox

Useful bit of information.  Example:
barebox:/ devinfo dummy0
Bus: i2c
  Address: 0x52

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
---
 drivers/i2c/i2c.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 52aaea8..9e9513d 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -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;
 }
-- 
1.8.3.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: core: Add client I2C address to devinfo
  2015-11-19 19:57 [PATCH] i2c: core: Add client I2C address to devinfo Trent Piepho
@ 2015-11-20  7:51 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2015-11-20  7:51 UTC (permalink / raw)
  To: Trent Piepho; +Cc: barebox

On Thu, Nov 19, 2015 at 07:57:30PM +0000, Trent Piepho wrote:
> Useful bit of information.  Example:
> barebox:/ devinfo dummy0
> Bus: i2c
>   Address: 0x52

Indeed useful. Applied, thanks

Sascha

> 
> Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
> ---
>  drivers/i2c/i2c.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
> index 52aaea8..9e9513d 100644
> --- a/drivers/i2c/i2c.c
> +++ b/drivers/i2c/i2c.c
> @@ -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;
>  }
> -- 
> 1.8.3.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-20  7:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-19 19:57 [PATCH] i2c: core: Add client I2C address to devinfo Trent Piepho
2015-11-20  7:51 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox