From: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
Kumar Gala
<galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>,
Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
Subject: [PATCH v3 2/5] i2c: i2c-mpc: use dev based printout function
Date: Tue, 07 Apr 2009 10:20:54 +0200 [thread overview]
Message-ID: <20090407082231.335327816@denx.de> (raw)
In-Reply-To: 20090407082052.477328750@denx.de
[-- Attachment #1: i2c-mpc-dev-print.patch --]
[-- Type: text/plain, Size: 3696 bytes --]
This patch used the dev_dbg, dev_err, etc. functions for debug
and error output instead of printk and pr_debug.
Signed-off-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
---
drivers/i2c/busses/i2c-mpc.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
Index: linux-2.6-galak/drivers/i2c/busses/i2c-mpc.c
===================================================================
--- linux-2.6-galak.orig/drivers/i2c/busses/i2c-mpc.c 2009-04-07 10:09:13.271719088 +0200
+++ linux-2.6-galak/drivers/i2c/busses/i2c-mpc.c 2009-04-07 10:09:14.012720756 +0200
@@ -50,6 +50,7 @@
#define CSR_RXAK 0x01
struct mpc_i2c {
+ struct device *dev;
void __iomem *base;
u32 interrupt;
wait_queue_head_t queue;
@@ -104,7 +105,7 @@
while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
schedule();
if (time_after(jiffies, orig_jiffies + timeout)) {
- pr_debug("I2C: timeout\n");
+ dev_dbg(i2c->dev, "timeout\n");
writeccr(i2c, 0);
result = -EIO;
break;
@@ -118,7 +119,7 @@
(i2c->interrupt & CSR_MIF), timeout);
if (unlikely(!(i2c->interrupt & CSR_MIF))) {
- pr_debug("I2C: wait timeout\n");
+ dev_dbg(i2c->dev, "wait timeout\n");
writeccr(i2c, 0);
result = -ETIMEDOUT;
}
@@ -131,17 +132,17 @@
return result;
if (!(x & CSR_MCF)) {
- pr_debug("I2C: unfinished\n");
+ dev_dbg(i2c->dev, "unfinished\n");
return -EIO;
}
if (x & CSR_MAL) {
- pr_debug("I2C: MAL\n");
+ dev_dbg(i2c->dev, "MAL\n");
return -EIO;
}
if (writing && (x & CSR_RXAK)) {
- pr_debug("I2C: No RXAK\n");
+ dev_dbg(i2c->dev, "No RXAK\n");
/* generate stop */
writeccr(i2c, CCR_MEN);
return -EIO;
@@ -263,12 +264,12 @@
/* Allow bus up to 1s to become not busy */
while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) {
if (signal_pending(current)) {
- pr_debug("I2C: Interrupted\n");
+ dev_dbg(i2c->dev, "Interrupted\n");
writeccr(i2c, 0);
return -EINTR;
}
if (time_after(jiffies, orig_jiffies + HZ)) {
- pr_debug("I2C: timeout\n");
+ dev_dbg(i2c->dev, "timeout\n");
if (readb(i2c->base + MPC_I2C_SR) ==
(CSR_MCF | CSR_MBB | CSR_RXAK))
mpc_i2c_fixup(i2c);
@@ -279,9 +280,10 @@
for (i = 0; ret >= 0 && i < num; i++) {
pmsg = &msgs[i];
- pr_debug("Doing %s %d bytes to 0x%02x - %d of %d messages\n",
- pmsg->flags & I2C_M_RD ? "read" : "write",
- pmsg->len, pmsg->addr, i + 1, num);
+ dev_dbg(i2c->dev,
+ "Doing %s %d bytes to 0x%02x - %d of %d messages\n",
+ pmsg->flags & I2C_M_RD ? "read" : "write",
+ pmsg->len, pmsg->addr, i + 1, num);
if (pmsg->flags & I2C_M_RD)
ret =
mpc_read(i2c, pmsg->addr, pmsg->buf, pmsg->len, i);
@@ -320,6 +322,8 @@
if (!i2c)
return -ENOMEM;
+ i2c->dev = &op->dev; /* for debug and error output */
+
if (of_get_property(op->node, "dfsrr", NULL))
i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
@@ -331,7 +335,7 @@
i2c->base = of_iomap(op->node, 0);
if (!i2c->base) {
- printk(KERN_ERR "i2c-mpc - failed to map controller\n");
+ dev_err(i2c->dev, "failed to map controller\n");
result = -ENOMEM;
goto fail_map;
}
@@ -341,8 +345,7 @@
result = request_irq(i2c->irq, mpc_i2c_isr,
IRQF_SHARED, "i2c-mpc", i2c);
if (result < 0) {
- printk(KERN_ERR
- "i2c-mpc - failed to attach interrupt\n");
+ dev_err(i2c->dev, "failed to attach interrupt\n");
goto fail_request;
}
}
@@ -357,7 +360,7 @@
result = i2c_add_adapter(&i2c->adap);
if (result < 0) {
- printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
+ dev_err(i2c->dev, "failed to add adapter\n");
goto fail_add;
}
of_register_i2c_devices(&i2c->adap, op->node);
WARNING: multiple messages have this Message-ID (diff)
From: Wolfgang Grandegger <wg@grandegger.com>
To: linux-i2c@vger.kernel.org
Cc: devicetree-discuss@ozlabs.org, linuxppc-dev@ozlabs.org,
Ben Dooks <ben-linux@fluff.org>
Subject: [PATCH v3 2/5] i2c: i2c-mpc: use dev based printout function
Date: Tue, 07 Apr 2009 10:20:54 +0200 [thread overview]
Message-ID: <20090407082231.335327816@denx.de> (raw)
In-Reply-To: 20090407082052.477328750@denx.de
This patch used the dev_dbg, dev_err, etc. functions for debug
and error output instead of printk and pr_debug.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/i2c/busses/i2c-mpc.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
Index: linux-2.6-galak/drivers/i2c/busses/i2c-mpc.c
===================================================================
--- linux-2.6-galak.orig/drivers/i2c/busses/i2c-mpc.c 2009-04-07 10:09:13.271719088 +0200
+++ linux-2.6-galak/drivers/i2c/busses/i2c-mpc.c 2009-04-07 10:09:14.012720756 +0200
@@ -50,6 +50,7 @@
#define CSR_RXAK 0x01
struct mpc_i2c {
+ struct device *dev;
void __iomem *base;
u32 interrupt;
wait_queue_head_t queue;
@@ -104,7 +105,7 @@
while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
schedule();
if (time_after(jiffies, orig_jiffies + timeout)) {
- pr_debug("I2C: timeout\n");
+ dev_dbg(i2c->dev, "timeout\n");
writeccr(i2c, 0);
result = -EIO;
break;
@@ -118,7 +119,7 @@
(i2c->interrupt & CSR_MIF), timeout);
if (unlikely(!(i2c->interrupt & CSR_MIF))) {
- pr_debug("I2C: wait timeout\n");
+ dev_dbg(i2c->dev, "wait timeout\n");
writeccr(i2c, 0);
result = -ETIMEDOUT;
}
@@ -131,17 +132,17 @@
return result;
if (!(x & CSR_MCF)) {
- pr_debug("I2C: unfinished\n");
+ dev_dbg(i2c->dev, "unfinished\n");
return -EIO;
}
if (x & CSR_MAL) {
- pr_debug("I2C: MAL\n");
+ dev_dbg(i2c->dev, "MAL\n");
return -EIO;
}
if (writing && (x & CSR_RXAK)) {
- pr_debug("I2C: No RXAK\n");
+ dev_dbg(i2c->dev, "No RXAK\n");
/* generate stop */
writeccr(i2c, CCR_MEN);
return -EIO;
@@ -263,12 +264,12 @@
/* Allow bus up to 1s to become not busy */
while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) {
if (signal_pending(current)) {
- pr_debug("I2C: Interrupted\n");
+ dev_dbg(i2c->dev, "Interrupted\n");
writeccr(i2c, 0);
return -EINTR;
}
if (time_after(jiffies, orig_jiffies + HZ)) {
- pr_debug("I2C: timeout\n");
+ dev_dbg(i2c->dev, "timeout\n");
if (readb(i2c->base + MPC_I2C_SR) ==
(CSR_MCF | CSR_MBB | CSR_RXAK))
mpc_i2c_fixup(i2c);
@@ -279,9 +280,10 @@
for (i = 0; ret >= 0 && i < num; i++) {
pmsg = &msgs[i];
- pr_debug("Doing %s %d bytes to 0x%02x - %d of %d messages\n",
- pmsg->flags & I2C_M_RD ? "read" : "write",
- pmsg->len, pmsg->addr, i + 1, num);
+ dev_dbg(i2c->dev,
+ "Doing %s %d bytes to 0x%02x - %d of %d messages\n",
+ pmsg->flags & I2C_M_RD ? "read" : "write",
+ pmsg->len, pmsg->addr, i + 1, num);
if (pmsg->flags & I2C_M_RD)
ret =
mpc_read(i2c, pmsg->addr, pmsg->buf, pmsg->len, i);
@@ -320,6 +322,8 @@
if (!i2c)
return -ENOMEM;
+ i2c->dev = &op->dev; /* for debug and error output */
+
if (of_get_property(op->node, "dfsrr", NULL))
i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
@@ -331,7 +335,7 @@
i2c->base = of_iomap(op->node, 0);
if (!i2c->base) {
- printk(KERN_ERR "i2c-mpc - failed to map controller\n");
+ dev_err(i2c->dev, "failed to map controller\n");
result = -ENOMEM;
goto fail_map;
}
@@ -341,8 +345,7 @@
result = request_irq(i2c->irq, mpc_i2c_isr,
IRQF_SHARED, "i2c-mpc", i2c);
if (result < 0) {
- printk(KERN_ERR
- "i2c-mpc - failed to attach interrupt\n");
+ dev_err(i2c->dev, "failed to attach interrupt\n");
goto fail_request;
}
}
@@ -357,7 +360,7 @@
result = i2c_add_adapter(&i2c->adap);
if (result < 0) {
- printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
+ dev_err(i2c->dev, "failed to add adapter\n");
goto fail_add;
}
of_register_i2c_devices(&i2c->adap, op->node);
next prev parent reply other threads:[~2009-04-07 8:20 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-07 8:20 [PATCH v3 0/5] i2c: i2c-mpc: make I2C bus speed configurable Wolfgang Grandegger
2009-04-07 8:20 ` [PATCH v3 1/5] i2c: i2c-mpc: various coding style fixes Wolfgang Grandegger
2009-04-07 8:20 ` Wolfgang Grandegger
[not found] ` <20090407082231.177941706-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:36 ` Grant Likely
2009-04-07 15:36 ` Grant Likely
2009-04-07 8:20 ` Wolfgang Grandegger [this message]
2009-04-07 8:20 ` [PATCH v3 2/5] i2c: i2c-mpc: use dev based printout function Wolfgang Grandegger
[not found] ` <20090407082231.335327816-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:37 ` Grant Likely
2009-04-07 15:37 ` Grant Likely
2009-04-07 8:20 ` [PATCH v3 3/5] i2c: i2c-mpc: make I2C bus speed configurable Wolfgang Grandegger
2009-04-07 8:20 ` Wolfgang Grandegger
[not found] ` <20090407082231.500525932-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:36 ` Grant Likely
2009-04-07 15:36 ` Grant Likely
2012-11-01 19:19 ` Tabi Timur-B04825
2012-11-07 16:40 ` Timur Tabi
[not found] ` <509A8F0F.4070806-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-11-16 13:29 ` Wolfram Sang
[not found] ` <20121116132939.GB7313-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-16 16:09 ` Timur Tabi
2009-04-07 8:20 ` [PATCH v3 4/5] powerpc: i2c-mpc: document new FSL I2C bindings and cleanup Wolfgang Grandegger
2009-04-07 8:20 ` Wolfgang Grandegger
[not found] ` <20090407082231.646648985-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:43 ` Grant Likely
2009-04-07 15:43 ` Grant Likely
2009-04-08 5:13 ` Kumar Gala
2009-04-08 5:13 ` Kumar Gala
2009-04-07 8:20 ` [PATCH v3 5/5] powerpc/85xx: i2c-mpc: use new I2C bindings for the Socates board Wolfgang Grandegger
2009-04-07 8:20 ` Wolfgang Grandegger
[not found] ` <20090407082231.803193635-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:43 ` Grant Likely
2009-04-07 15:43 ` Grant Likely
2009-04-08 7:16 ` Wolfgang Grandegger
2009-04-08 14:53 ` Grant Likely
2009-04-08 14:53 ` Grant Likely
[not found] ` <fa686aa40904080753p2b282338r9ba463c47f897fb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-08 18:27 ` Wolfgang Grandegger
2009-04-08 18:27 ` Wolfgang Grandegger
[not found] ` <49DCEC80.2050507-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-04-08 18:43 ` Kumar Gala
2009-04-08 18:43 ` Kumar Gala
[not found] ` <C3323B74-40FE-41BC-A49C-C94D7DB3FF5A-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08 18:53 ` Wolfgang Grandegger
2009-04-08 18:53 ` Wolfgang Grandegger
[not found] ` <20090407082052.477328750-ynQEQJNshbs@public.gmane.org>
2009-04-08 5:11 ` [PATCH v3 0/5] i2c: i2c-mpc: make I2C bus speed configurable Kumar Gala
2009-04-08 5:11 ` Kumar Gala
[not found] ` <53B42D49-C040-442E-8448-7BC3190220A5-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08 5:16 ` Grant Likely
2009-04-08 5:16 ` Grant Likely
2009-04-08 5:22 ` Kumar Gala
2009-04-08 5:32 ` Grant Likely
2009-04-08 5:32 ` Grant Likely
[not found] ` <5FDB097C-7D71-41DF-A4F4-2DE34FD710C5-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08 7:21 ` Wolfgang Grandegger
2009-04-08 7:21 ` Wolfgang Grandegger
2009-04-08 17:03 ` Scott Wood
2009-04-08 17:49 ` Kumar Gala
2009-04-08 5:28 ` Kumar Gala
[not found] ` <F4E3E1FF-C544-460A-AC27-DB9501C13ED3-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08 7:25 ` Wolfgang Grandegger
2009-04-08 7:25 ` Wolfgang Grandegger
[not found] ` <49DC515F.3040100-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-04-08 15:21 ` Kumar Gala
2009-04-08 15:21 ` Kumar Gala
[not found] ` <E9E24C93-F147-49F0-9FBE-FCE4883D11BF-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08 19:55 ` Wolfgang Grandegger
2009-04-08 19:55 ` Wolfgang Grandegger
2009-04-09 9:59 ` Wolfgang Grandegger
2009-04-20 9:01 ` Wolfgang Grandegger
2009-04-20 13:26 ` Grant Likely
2009-04-20 13:26 ` Grant Likely
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=20090407082231.335327816@denx.de \
--to=wg-5yr1bzd7o62+xt7jha+gda@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
--cc=galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.