mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@kymetacorp.com>
To: barebox <barebox@lists.infradead.org>
Subject: [PATCH] i2c: core: Add client I2C address to devinfo
Date: Thu, 19 Nov 2015 19:57:30 +0000	[thread overview]
Message-ID: <1447963050.4553.183.camel@rtred1test09.kymeta.local> (raw)

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

             reply	other threads:[~2015-11-19 19:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 19:57 Trent Piepho [this message]
2015-11-20  7:51 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447963050.4553.183.camel@rtred1test09.kymeta.local \
    --to=tpiepho@kymetacorp.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox