diff options
author | Wolfgang Grandegger <wg@grandegger.com> | 2009-04-07 04:20:54 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-04-07 05:18:47 -0400 |
commit | 54377cd059061637b627e236a459c58e274f35c6 (patch) | |
tree | b407884f50068667f521ae547b24208c268670f7 /drivers | |
parent | 8101a30095e4fbbe1ffc1dc8f8e6928b9e1ea1de (diff) |
i2c: i2c-mpc: use dev based printout function
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>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 1215686bd3c2..9b38c9236464 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #define CSR_RXAK 0x01 | 50 | #define CSR_RXAK 0x01 |
51 | 51 | ||
52 | struct mpc_i2c { | 52 | struct mpc_i2c { |
53 | struct device *dev; | ||
53 | void __iomem *base; | 54 | void __iomem *base; |
54 | u32 interrupt; | 55 | u32 interrupt; |
55 | wait_queue_head_t queue; | 56 | wait_queue_head_t queue; |
@@ -104,7 +105,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
104 | while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) { | 105 | while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) { |
105 | schedule(); | 106 | schedule(); |
106 | if (time_after(jiffies, orig_jiffies + timeout)) { | 107 | if (time_after(jiffies, orig_jiffies + timeout)) { |
107 | pr_debug("I2C: timeout\n"); | 108 | dev_dbg(i2c->dev, "timeout\n"); |
108 | writeccr(i2c, 0); | 109 | writeccr(i2c, 0); |
109 | result = -EIO; | 110 | result = -EIO; |
110 | break; | 111 | break; |
@@ -118,7 +119,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
118 | (i2c->interrupt & CSR_MIF), timeout); | 119 | (i2c->interrupt & CSR_MIF), timeout); |
119 | 120 | ||
120 | if (unlikely(!(i2c->interrupt & CSR_MIF))) { | 121 | if (unlikely(!(i2c->interrupt & CSR_MIF))) { |
121 | pr_debug("I2C: wait timeout\n"); | 122 | dev_dbg(i2c->dev, "wait timeout\n"); |
122 | writeccr(i2c, 0); | 123 | writeccr(i2c, 0); |
123 | result = -ETIMEDOUT; | 124 | result = -ETIMEDOUT; |
124 | } | 125 | } |
@@ -131,17 +132,17 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
131 | return result; | 132 | return result; |
132 | 133 | ||
133 | if (!(x & CSR_MCF)) { | 134 | if (!(x & CSR_MCF)) { |
134 | pr_debug("I2C: unfinished\n"); | 135 | dev_dbg(i2c->dev, "unfinished\n"); |
135 | return -EIO; | 136 | return -EIO; |
136 | } | 137 | } |
137 | 138 | ||
138 | if (x & CSR_MAL) { | 139 | if (x & CSR_MAL) { |
139 | pr_debug("I2C: MAL\n"); | 140 | dev_dbg(i2c->dev, "MAL\n"); |
140 | return -EIO; | 141 | return -EIO; |
141 | } | 142 | } |
142 | 143 | ||
143 | if (writing && (x & CSR_RXAK)) { | 144 | if (writing && (x & CSR_RXAK)) { |
144 | pr_debug("I2C: No RXAK\n"); | 145 | dev_dbg(i2c->dev, "No RXAK\n"); |
145 | /* generate stop */ | 146 | /* generate stop */ |
146 | writeccr(i2c, CCR_MEN); | 147 | writeccr(i2c, CCR_MEN); |
147 | return -EIO; | 148 | return -EIO; |
@@ -263,12 +264,12 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
263 | /* Allow bus up to 1s to become not busy */ | 264 | /* Allow bus up to 1s to become not busy */ |
264 | while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { | 265 | while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { |
265 | if (signal_pending(current)) { | 266 | if (signal_pending(current)) { |
266 | pr_debug("I2C: Interrupted\n"); | 267 | dev_dbg(i2c->dev, "Interrupted\n"); |
267 | writeccr(i2c, 0); | 268 | writeccr(i2c, 0); |
268 | return -EINTR; | 269 | return -EINTR; |
269 | } | 270 | } |
270 | if (time_after(jiffies, orig_jiffies + HZ)) { | 271 | if (time_after(jiffies, orig_jiffies + HZ)) { |
271 | pr_debug("I2C: timeout\n"); | 272 | dev_dbg(i2c->dev, "timeout\n"); |
272 | if (readb(i2c->base + MPC_I2C_SR) == | 273 | if (readb(i2c->base + MPC_I2C_SR) == |
273 | (CSR_MCF | CSR_MBB | CSR_RXAK)) | 274 | (CSR_MCF | CSR_MBB | CSR_RXAK)) |
274 | mpc_i2c_fixup(i2c); | 275 | mpc_i2c_fixup(i2c); |
@@ -279,9 +280,10 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
279 | 280 | ||
280 | for (i = 0; ret >= 0 && i < num; i++) { | 281 | for (i = 0; ret >= 0 && i < num; i++) { |
281 | pmsg = &msgs[i]; | 282 | pmsg = &msgs[i]; |
282 | pr_debug("Doing %s %d bytes to 0x%02x - %d of %d messages\n", | 283 | dev_dbg(i2c->dev, |
283 | pmsg->flags & I2C_M_RD ? "read" : "write", | 284 | "Doing %s %d bytes to 0x%02x - %d of %d messages\n", |
284 | pmsg->len, pmsg->addr, i + 1, num); | 285 | pmsg->flags & I2C_M_RD ? "read" : "write", |
286 | pmsg->len, pmsg->addr, i + 1, num); | ||
285 | if (pmsg->flags & I2C_M_RD) | 287 | if (pmsg->flags & I2C_M_RD) |
286 | ret = | 288 | ret = |
287 | mpc_read(i2c, pmsg->addr, pmsg->buf, pmsg->len, i); | 289 | mpc_read(i2c, pmsg->addr, pmsg->buf, pmsg->len, i); |
@@ -320,6 +322,8 @@ static int __devinit fsl_i2c_probe(struct of_device *op, | |||
320 | if (!i2c) | 322 | if (!i2c) |
321 | return -ENOMEM; | 323 | return -ENOMEM; |
322 | 324 | ||
325 | i2c->dev = &op->dev; /* for debug and error output */ | ||
326 | |||
323 | if (of_get_property(op->node, "dfsrr", NULL)) | 327 | if (of_get_property(op->node, "dfsrr", NULL)) |
324 | i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR; | 328 | i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR; |
325 | 329 | ||
@@ -331,7 +335,7 @@ static int __devinit fsl_i2c_probe(struct of_device *op, | |||
331 | 335 | ||
332 | i2c->base = of_iomap(op->node, 0); | 336 | i2c->base = of_iomap(op->node, 0); |
333 | if (!i2c->base) { | 337 | if (!i2c->base) { |
334 | printk(KERN_ERR "i2c-mpc - failed to map controller\n"); | 338 | dev_err(i2c->dev, "failed to map controller\n"); |
335 | result = -ENOMEM; | 339 | result = -ENOMEM; |
336 | goto fail_map; | 340 | goto fail_map; |
337 | } | 341 | } |
@@ -341,8 +345,7 @@ static int __devinit fsl_i2c_probe(struct of_device *op, | |||
341 | result = request_irq(i2c->irq, mpc_i2c_isr, | 345 | result = request_irq(i2c->irq, mpc_i2c_isr, |
342 | IRQF_SHARED, "i2c-mpc", i2c); | 346 | IRQF_SHARED, "i2c-mpc", i2c); |
343 | if (result < 0) { | 347 | if (result < 0) { |
344 | printk(KERN_ERR | 348 | dev_err(i2c->dev, "failed to attach interrupt\n"); |
345 | "i2c-mpc - failed to attach interrupt\n"); | ||
346 | goto fail_request; | 349 | goto fail_request; |
347 | } | 350 | } |
348 | } | 351 | } |
@@ -357,7 +360,7 @@ static int __devinit fsl_i2c_probe(struct of_device *op, | |||
357 | 360 | ||
358 | result = i2c_add_adapter(&i2c->adap); | 361 | result = i2c_add_adapter(&i2c->adap); |
359 | if (result < 0) { | 362 | if (result < 0) { |
360 | printk(KERN_ERR "i2c-mpc - failed to add adapter\n"); | 363 | dev_err(i2c->dev, "failed to add adapter\n"); |
361 | goto fail_add; | 364 | goto fail_add; |
362 | } | 365 | } |
363 | of_register_i2c_devices(&i2c->adap, op->node); | 366 | of_register_i2c_devices(&i2c->adap, op->node); |