* [PATCH] i2c: mpc: Report correct I2C error codes on Freescale MPC i2c bus driver
@ 2014-10-21 7:05 Danielle Costantino
[not found] ` <CAAVjN7cpGzokOntyyGVBksdvAw7rGt8zvggpCeMqr+g1yHEyzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Danielle Costantino @ 2014-10-21 7:05 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
From: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
This patch enforces correct I2C error returned codes from Freescale's
MPC i2c bus driver, allowing for proper user-space/kernel error
handling.
Signed-off-by: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 0edf630..66bef28 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -124,7 +124,7 @@
static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
{
unsigned long orig_jiffies = jiffies;
- u32 x;
+ u32 cmd_err;
int result = 0;
if (!i2c->irq) {
@@ -137,7 +137,7 @@
break;
}
}
- x = readb(i2c->base + MPC_I2C_SR);
+ cmd_err = readb(i2c->base + MPC_I2C_SR);
writeb(0, i2c->base + MPC_I2C_SR);
} else {
/* Interrupt mode */
@@ -150,30 +150,30 @@
result = -ETIMEDOUT;
}
- x = i2c->interrupt;
+ cmd_err = i2c->interrupt;
i2c->interrupt = 0;
}
- if (result < 0)
- return result;
+ if (result < 0)
+ return result;
- if (!(x & CSR_MCF)) {
- dev_dbg(i2c->dev, "unfinished\n");
- return -EIO;
- }
+ if (!(cmd_err & CSR_MCF)) {
+ dev_dbg(i2c->dev, "unfinished\n");
+ return -EIO;
+ }
- if (x & CSR_MAL) {
- dev_dbg(i2c->dev, "MAL\n");
- return -EIO;
- }
+ if (cmd_err & CSR_MAL) {
+ dev_dbg(i2c->dev, "MAL\n");
+ return -EAGAIN;
+ }
- if (writing && (x & CSR_RXAK)) {
- dev_dbg(i2c->dev, "No RXAK\n");
- /* generate stop */
- writeccr(i2c, CCR_MEN);
- return -EIO;
- }
- return 0;
+ if (writing && (cmd_err & CSR_RXAK)) {
+ dev_dbg(i2c->dev, "No RXAK\n");
+ /* generate stop */
+ writeccr(i2c, CCR_MEN);
+ return -ENXIO;
+ }
+ return 0;
}
#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x)
--
- Danielle Costantino
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <CAAVjN7cpGzokOntyyGVBksdvAw7rGt8zvggpCeMqr+g1yHEyzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] i2c: mpc: Report correct I2C error codes on Freescale MPC i2c bus driver [not found] ` <CAAVjN7cpGzokOntyyGVBksdvAw7rGt8zvggpCeMqr+g1yHEyzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-11-10 14:49 ` Wolfram Sang 2014-11-12 13:08 ` Danielle Costantino 0 siblings, 1 reply; 6+ messages in thread From: Wolfram Sang @ 2014-11-10 14:49 UTC (permalink / raw) To: Danielle Costantino Cc: linux-i2c, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [-- Attachment #1: Type: text/plain, Size: 482 bytes --] On Tue, Oct 21, 2014 at 12:05:44AM -0700, Danielle Costantino wrote: > From: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > This patch enforces correct I2C error returned codes from Freescale's > MPC i2c bus driver, allowing for proper user-space/kernel error > handling. > > Signed-off-by: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Tabs converted to spaces here? Please resend properly. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: mpc: Report correct I2C error codes on Freescale MPC i2c bus driver 2014-11-10 14:49 ` Wolfram Sang @ 2014-11-12 13:08 ` Danielle Costantino [not found] ` <CAAVjN7fsZC6V7bsJQLNmEx=yOmvsDn2ZwfOHNLd_=_jAbYB2dA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Danielle Costantino @ 2014-11-12 13:08 UTC (permalink / raw) To: Wolfram Sang Cc: linux-i2c, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [-- Attachment #1: Type: text/plain, Size: 2318 bytes --] From: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Subject: [PATCH v2] i2c: mpc: report correct I2C error return codes This patch enforces correct I2C error returned codes from Freescale's MPC i2c bus driver, allowing for proper user-space/kernel error handling. Signed-off-by: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 0edf630..4c5d7d9 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -124,7 +124,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) { unsigned long orig_jiffies = jiffies; - u32 x; + u32 cmd_err; int result = 0; if (!i2c->irq) { @@ -133,11 +133,11 @@ if (time_after(jiffies, orig_jiffies + timeout)) { dev_dbg(i2c->dev, "timeout\n"); writeccr(i2c, 0); - result = -EIO; + result = -ETIMEDOUT; break; } } - x = readb(i2c->base + MPC_I2C_SR); + cmd_err = readb(i2c->base + MPC_I2C_SR); writeb(0, i2c->base + MPC_I2C_SR); } else { /* Interrupt mode */ @@ -150,28 +150,28 @@ result = -ETIMEDOUT; } - x = i2c->interrupt; + cmd_err = i2c->interrupt; i2c->interrupt = 0; } if (result < 0) return result; - if (!(x & CSR_MCF)) { + if (!(cmd_err & CSR_MCF)) { dev_dbg(i2c->dev, "unfinished\n"); return -EIO; } - if (x & CSR_MAL) { + if (cmd_err & CSR_MAL) { dev_dbg(i2c->dev, "MAL\n"); - return -EIO; + return -EAGAIN; } - if (writing && (x & CSR_RXAK)) { + if (writing && (cmd_err & CSR_RXAK)) { dev_dbg(i2c->dev, "No RXAK\n"); /* generate stop */ writeccr(i2c, CCR_MEN); - return -EIO; + return -ENXIO; } return 0; } On Mon, Nov 10, 2014 at 6:49 AM, Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> wrote: > On Tue, Oct 21, 2014 at 12:05:44AM -0700, Danielle Costantino wrote: >> From: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> >> This patch enforces correct I2C error returned codes from Freescale's >> MPC i2c bus driver, allowing for proper user-space/kernel error >> handling. >> >> Signed-off-by: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > Tabs converted to spaces here? Please resend properly. > -- - Danielle Costantino [-- Attachment #2: i2c-mpc-report-correct-I2C-error-return-codes.patch --] [-- Type: text/x-patch, Size: 1694 bytes --] From: Danielle Costantino <danielle.costantino@gmail.com> Subject: [PATCH v2] i2c: mpc: report correct I2C error return codes This patch enforces correct I2C error returned codes from Freescale's MPC i2c bus driver, allowing for proper user-space/kernel error handling. Signed-off-by: Danielle Costantino <danielle.costantino@gmail.com> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 0edf630..4c5d7d9 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -124,7 +124,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) { unsigned long orig_jiffies = jiffies; - u32 x; + u32 cmd_err; int result = 0; if (!i2c->irq) { @@ -133,11 +133,11 @@ if (time_after(jiffies, orig_jiffies + timeout)) { dev_dbg(i2c->dev, "timeout\n"); writeccr(i2c, 0); - result = -EIO; + result = -ETIMEDOUT; break; } } - x = readb(i2c->base + MPC_I2C_SR); + cmd_err = readb(i2c->base + MPC_I2C_SR); writeb(0, i2c->base + MPC_I2C_SR); } else { /* Interrupt mode */ @@ -150,28 +150,28 @@ result = -ETIMEDOUT; } - x = i2c->interrupt; + cmd_err = i2c->interrupt; i2c->interrupt = 0; } if (result < 0) return result; - if (!(x & CSR_MCF)) { + if (!(cmd_err & CSR_MCF)) { dev_dbg(i2c->dev, "unfinished\n"); return -EIO; } - if (x & CSR_MAL) { + if (cmd_err & CSR_MAL) { dev_dbg(i2c->dev, "MAL\n"); - return -EIO; + return -EAGAIN; } - if (writing && (x & CSR_RXAK)) { + if (writing && (cmd_err & CSR_RXAK)) { dev_dbg(i2c->dev, "No RXAK\n"); /* generate stop */ writeccr(i2c, CCR_MEN); - return -EIO; + return -ENXIO; } return 0; } ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <CAAVjN7fsZC6V7bsJQLNmEx=yOmvsDn2ZwfOHNLd_=_jAbYB2dA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] i2c: mpc: Report correct I2C error codes on Freescale MPC i2c bus driver [not found] ` <CAAVjN7fsZC6V7bsJQLNmEx=yOmvsDn2ZwfOHNLd_=_jAbYB2dA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-11-12 15:40 ` Wolfram Sang 0 siblings, 0 replies; 6+ messages in thread From: Wolfram Sang @ 2014-11-12 15:40 UTC (permalink / raw) To: Danielle Costantino Cc: linux-i2c, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [-- Attachment #1: Type: text/plain, Size: 834 bytes --] On Wed, Nov 12, 2014 at 05:08:09AM -0800, Danielle Costantino wrote: > From: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Subject: [PATCH v2] i2c: mpc: report correct I2C error return codes > > This patch enforces correct I2C error returned codes from Freescale's > MPC i2c bus driver, allowing for proper user-space/kernel error > handling. > > Signed-off-by: Danielle Costantino <danielle.costantino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c > index 0edf630..4c5d7d9 100644 Applied to for-next, thanks! Still, the attachment worked, not the mail itself. That is OK for now, but not generally acceptable. There is Documentation/email-clients.txt which has some info about GMail. Please check. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] i2c: mpc: Report correct I2C error codes on Freescale MPC i2c bus driver
@ 2014-10-08 19:06 Danielle Costantino
[not found] ` <CAAVjN7fq-czDj5Ga_UC+fzqy3dcYY3bgU7Z5JUY829Va4rbeXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Danielle Costantino @ 2014-10-08 19:06 UTC (permalink / raw)
To: linux-i2c
Report correct I2C error codes on Freescale MPC i2c bus driver
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 0edf630..b56145c 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -124,7 +124,7 @@
static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
{
unsigned long orig_jiffies = jiffies;
- u32 x;
+ u32 cmd_err;
int result = 0;
if (!i2c->irq) {
@@ -133,11 +133,11 @@
if (time_after(jiffies, orig_jiffies + timeout)) {
dev_dbg(i2c->dev, "timeout\n");
writeccr(i2c, 0);
- result = -EIO;
+ result = -ETIMEDOUT;
break;
}
}
- x = readb(i2c->base + MPC_I2C_SR);
+ cmd_err = readb(i2c->base + MPC_I2C_SR);
writeb(0, i2c->base + MPC_I2C_SR);
} else {
/* Interrupt mode */
@@ -150,28 +150,28 @@
result = -ETIMEDOUT;
}
- x = i2c->interrupt;
+ cmd_err = i2c->interrupt;
i2c->interrupt = 0;
}
if (result < 0)
return result;
- if (!(x & CSR_MCF)) {
+ if (!(cmd_err & CSR_MCF)) {
dev_dbg(i2c->dev, "unfinished\n");
return -EIO;
}
- if (x & CSR_MAL) {
+ if (cmd_err & CSR_MAL) {
dev_dbg(i2c->dev, "MAL\n");
- return -EIO;
+ return -EAGAIN;
}
- if (writing && (x & CSR_RXAK)) {
+ if (writing && (cmd_err & CSR_RXAK)) {
dev_dbg(i2c->dev, "No RXAK\n");
/* generate stop */
writeccr(i2c, CCR_MEN);
- return -EIO;
+ return -ENXIO;
}
return 0;
}
@@ -554,7 +554,7 @@
i2c->base + MPC_I2C_SR);
mpc_i2c_fixup(i2c);
}
- return -EIO;
+ return -ETIMEDOUT;
}
schedule();
}
@@ -590,7 +590,7 @@
i2c->base + MPC_I2C_SR);
mpc_i2c_fixup(i2c);
}
- return -EIO;
+ return -ETIMEDOUT;
}
cond_resched();
}
- Danielle Costantino
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <CAAVjN7fq-czDj5Ga_UC+fzqy3dcYY3bgU7Z5JUY829Va4rbeXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] i2c: mpc: Report correct I2C error codes on Freescale MPC i2c bus driver [not found] ` <CAAVjN7fq-czDj5Ga_UC+fzqy3dcYY3bgU7Z5JUY829Va4rbeXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-10-09 13:46 ` Mark Roszko 0 siblings, 0 replies; 6+ messages in thread From: Mark Roszko @ 2014-10-09 13:46 UTC (permalink / raw) To: Danielle Costantino; +Cc: linux-i2c Hi, 1. You are going to want to resend your patch using git-send-mail, you used an email client that destroyed all formatting. gmail in particular is good at breaking things so your patch cannot be applied correctly. 2. You need to add a Signed-off-by line like other patches people submit. 3. You may want to consider CCing Wolfram the i2c subsystem maintainer since there's no bus driver maintainer see: https://www.kernel.org/doc/Documentation/SubmittingPatches ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-11-12 15:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 7:05 [PATCH] i2c: mpc: Report correct I2C error codes on Freescale MPC i2c bus driver Danielle Costantino
[not found] ` <CAAVjN7cpGzokOntyyGVBksdvAw7rGt8zvggpCeMqr+g1yHEyzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-10 14:49 ` Wolfram Sang
2014-11-12 13:08 ` Danielle Costantino
[not found] ` <CAAVjN7fsZC6V7bsJQLNmEx=yOmvsDn2ZwfOHNLd_=_jAbYB2dA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-12 15:40 ` Wolfram Sang
-- strict thread matches above, loose matches on Subject: below --
2014-10-08 19:06 Danielle Costantino
[not found] ` <CAAVjN7fq-czDj5Ga_UC+fzqy3dcYY3bgU7Z5JUY829Va4rbeXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-09 13:46 ` Mark Roszko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox