X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fi2c%2Fbusses%2Fi2c-pxa.c;h=5155010b455e7eb9a094ed520d5bf4fbb25a9ae7;hb=4facfde9f1d7b8a61fb0017460da45e23e60115c;hp=70f7ab829d36f5dee4db91bfd5a8ed80a41d944e;hpb=3d5271f9883cba7b54762bc4fe027d4172f06db7;p=linux-2.6-omap-h63xx.git diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 70f7ab829d3..5155010b455 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -647,7 +647,7 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c) } /* - * We are protected by the adapter bus semaphore. + * We are protected by the adapter bus mutex. */ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) { @@ -861,7 +861,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id, struct pt_regs *r decode_ISR(isr); } - if (i2c->irqlogidx < sizeof(i2c->isrlog)/sizeof(u32)) + if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog)) i2c->isrlog[i2c->irqlogidx++] = isr; show_state(i2c); @@ -899,6 +899,12 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num struct pxa_i2c *i2c = adap->algo_data; int ret, i; + /* If the I2C controller is disabled we need to reset it (probably due + to a suspend/resume destroying state). We do this here as we can then + avoid worrying about resuming the controller before its users. */ + if (!(ICR & ICR_IUE)) + i2c_pxa_reset(i2c); + for (i = adap->retries; i >= 0; i--) { ret = i2c_pxa_do_xfer(i2c, msgs, num); if (ret != I2C_RETRY) @@ -939,7 +945,9 @@ static struct pxa_i2c i2c_pxa = { static int i2c_pxa_probe(struct platform_device *dev) { struct pxa_i2c *i2c = &i2c_pxa; +#ifdef CONFIG_I2C_PXA_SLAVE struct i2c_pxa_platform_data *plat = dev->dev.platform_data; +#endif int ret; #ifdef CONFIG_PXA27x @@ -1024,5 +1032,7 @@ static void i2c_adap_pxa_exit(void) return platform_driver_unregister(&i2c_pxa_driver); } +MODULE_LICENSE("GPL"); + module_init(i2c_adap_pxa_init); module_exit(i2c_adap_pxa_exit);