diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2011-10-20 12:23:01 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2011-10-29 06:20:28 -0400 |
commit | 8abf6fbbd22bc777fd4027cbc55e99cdfb7a8324 (patch) | |
tree | f08b3439d8f4431e54316973c24af3de48d5632f /drivers/i2c | |
parent | 1fdb24e969110fafea36d3b393bea438f702c87f (diff) |
i2c-nomadik: cosmetic coding style corrections
This fixes a number of whitespace and punctuation problems
around the Nomadik I2C driver.
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-nomadik.c | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index b228e09c5d05..ce4fd801a8c2 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c | |||
@@ -63,11 +63,11 @@ | |||
63 | /* Master controller (MCR) register */ | 63 | /* Master controller (MCR) register */ |
64 | #define I2C_MCR_OP (0x1 << 0) /* Operation */ | 64 | #define I2C_MCR_OP (0x1 << 0) /* Operation */ |
65 | #define I2C_MCR_A7 (0x7f << 1) /* 7-bit address */ | 65 | #define I2C_MCR_A7 (0x7f << 1) /* 7-bit address */ |
66 | #define I2C_MCR_EA10 (0x7 << 8) /* 10-bit Extended address */ | 66 | #define I2C_MCR_EA10 (0x7 << 8) /* 10-bit Extended address */ |
67 | #define I2C_MCR_SB (0x1 << 11) /* Extended address */ | 67 | #define I2C_MCR_SB (0x1 << 11) /* Extended address */ |
68 | #define I2C_MCR_AM (0x3 << 12) /* Address type */ | 68 | #define I2C_MCR_AM (0x3 << 12) /* Address type */ |
69 | #define I2C_MCR_STOP (0x1 << 14) /* Stop condition */ | 69 | #define I2C_MCR_STOP (0x1 << 14) /* Stop condition */ |
70 | #define I2C_MCR_LENGTH (0x7ff << 15) /* Transaction length */ | 70 | #define I2C_MCR_LENGTH (0x7ff << 15) /* Transaction length */ |
71 | 71 | ||
72 | /* Status register (SR) */ | 72 | /* Status register (SR) */ |
73 | #define I2C_SR_OP (0x3 << 0) /* Operation */ | 73 | #define I2C_SR_OP (0x3 << 0) /* Operation */ |
@@ -77,7 +77,7 @@ | |||
77 | #define I2C_SR_LENGTH (0x7ff << 9) /* Transfer length */ | 77 | #define I2C_SR_LENGTH (0x7ff << 9) /* Transfer length */ |
78 | 78 | ||
79 | /* Interrupt mask set/clear (IMSCR) bits */ | 79 | /* Interrupt mask set/clear (IMSCR) bits */ |
80 | #define I2C_IT_TXFE (0x1 << 0) | 80 | #define I2C_IT_TXFE (0x1 << 0) |
81 | #define I2C_IT_TXFNE (0x1 << 1) | 81 | #define I2C_IT_TXFNE (0x1 << 1) |
82 | #define I2C_IT_TXFF (0x1 << 2) | 82 | #define I2C_IT_TXFF (0x1 << 2) |
83 | #define I2C_IT_TXFOVR (0x1 << 3) | 83 | #define I2C_IT_TXFOVR (0x1 << 3) |
@@ -135,31 +135,31 @@ struct i2c_nmk_client { | |||
135 | }; | 135 | }; |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * struct nmk_i2c_dev - private data structure of the controller | 138 | * struct nmk_i2c_dev - private data structure of the controller. |
139 | * @pdev: parent platform device | 139 | * @pdev: parent platform device. |
140 | * @adap: corresponding I2C adapter | 140 | * @adap: corresponding I2C adapter. |
141 | * @irq: interrupt line for the controller | 141 | * @irq: interrupt line for the controller. |
142 | * @virtbase: virtual io memory area | 142 | * @virtbase: virtual io memory area. |
143 | * @clk: hardware i2c block clock | 143 | * @clk: hardware i2c block clock. |
144 | * @cfg: machine provided controller configuration | 144 | * @cfg: machine provided controller configuration. |
145 | * @cli: holder of client specific data | 145 | * @cli: holder of client specific data. |
146 | * @stop: stop condition | 146 | * @stop: stop condition. |
147 | * @xfer_complete: acknowledge completion for a I2C message | 147 | * @xfer_complete: acknowledge completion for a I2C message. |
148 | * @result: controller propogated result | 148 | * @result: controller propogated result. |
149 | * @regulator: pointer to i2c regulator | 149 | * @regulator: pointer to i2c regulator. |
150 | * @busy: Busy doing transfer | 150 | * @busy: Busy doing transfer. |
151 | */ | 151 | */ |
152 | struct nmk_i2c_dev { | 152 | struct nmk_i2c_dev { |
153 | struct platform_device *pdev; | 153 | struct platform_device *pdev; |
154 | struct i2c_adapter adap; | 154 | struct i2c_adapter adap; |
155 | int irq; | 155 | int irq; |
156 | void __iomem *virtbase; | 156 | void __iomem *virtbase; |
157 | struct clk *clk; | 157 | struct clk *clk; |
158 | struct nmk_i2c_controller cfg; | 158 | struct nmk_i2c_controller cfg; |
159 | struct i2c_nmk_client cli; | 159 | struct i2c_nmk_client cli; |
160 | int stop; | 160 | int stop; |
161 | struct completion xfer_complete; | 161 | struct completion xfer_complete; |
162 | int result; | 162 | int result; |
163 | struct regulator *regulator; | 163 | struct regulator *regulator; |
164 | bool busy; | 164 | bool busy; |
165 | }; | 165 | }; |
@@ -217,8 +217,9 @@ static int flush_i2c_fifo(struct nmk_i2c_dev *dev) | |||
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | dev_err(&dev->pdev->dev, "flushing operation timed out " | 220 | dev_err(&dev->pdev->dev, |
221 | "giving up after %d attempts", LOOP_ATTEMPTS); | 221 | "flushing operation timed out giving up after %d attempts", |
222 | LOOP_ATTEMPTS); | ||
222 | 223 | ||
223 | return -ETIMEDOUT; | 224 | return -ETIMEDOUT; |
224 | } | 225 | } |
@@ -270,7 +271,7 @@ exit: | |||
270 | } | 271 | } |
271 | 272 | ||
272 | /* enable peripheral, master mode operation */ | 273 | /* enable peripheral, master mode operation */ |
273 | #define DEFAULT_I2C_REG_CR ((1 << 1) | I2C_CR_PE) | 274 | #define DEFAULT_I2C_REG_CR ((1 << 1) | I2C_CR_PE) |
274 | 275 | ||
275 | /** | 276 | /** |
276 | * load_i2c_mcr_reg() - load the MCR register | 277 | * load_i2c_mcr_reg() - load the MCR register |
@@ -363,8 +364,8 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev) | |||
363 | * and high speed (up to 3.4 Mb/s) | 364 | * and high speed (up to 3.4 Mb/s) |
364 | */ | 365 | */ |
365 | if (dev->cfg.sm > I2C_FREQ_MODE_FAST) { | 366 | if (dev->cfg.sm > I2C_FREQ_MODE_FAST) { |
366 | dev_err(&dev->pdev->dev, "do not support this mode " | 367 | dev_err(&dev->pdev->dev, |
367 | "defaulting to std. mode\n"); | 368 | "do not support this mode defaulting to std. mode\n"); |
368 | brcr2 = i2c_clk/(100000 * 2) & 0xffff; | 369 | brcr2 = i2c_clk/(100000 * 2) & 0xffff; |
369 | writel((brcr1 | brcr2), dev->virtbase + I2C_BRCR); | 370 | writel((brcr1 | brcr2), dev->virtbase + I2C_BRCR); |
370 | writel(I2C_FREQ_MODE_STANDARD << 4, | 371 | writel(I2C_FREQ_MODE_STANDARD << 4, |
@@ -423,7 +424,7 @@ static int read_i2c(struct nmk_i2c_dev *dev) | |||
423 | 424 | ||
424 | if (timeout < 0) { | 425 | if (timeout < 0) { |
425 | dev_err(&dev->pdev->dev, | 426 | dev_err(&dev->pdev->dev, |
426 | "wait_for_completion_timeout" | 427 | "wait_for_completion_timeout " |
427 | "returned %d waiting for event\n", timeout); | 428 | "returned %d waiting for event\n", timeout); |
428 | status = timeout; | 429 | status = timeout; |
429 | } | 430 | } |
@@ -556,8 +557,8 @@ static int nmk_i2c_xfer_one(struct nmk_i2c_dev *dev, u16 flags) | |||
556 | if (((i2c_sr >> 2) & 0x3) == 0x3) { | 557 | if (((i2c_sr >> 2) & 0x3) == 0x3) { |
557 | /* get the abort cause */ | 558 | /* get the abort cause */ |
558 | cause = (i2c_sr >> 4) & 0x7; | 559 | cause = (i2c_sr >> 4) & 0x7; |
559 | dev_err(&dev->pdev->dev, "%s\n", cause | 560 | dev_err(&dev->pdev->dev, "%s\n", |
560 | >= ARRAY_SIZE(abort_causes) ? | 561 | cause >= ARRAY_SIZE(abort_causes) ? |
561 | "unknown reason" : | 562 | "unknown reason" : |
562 | abort_causes[cause]); | 563 | abort_causes[cause]); |
563 | } | 564 | } |
@@ -582,13 +583,13 @@ static int nmk_i2c_xfer_one(struct nmk_i2c_dev *dev, u16 flags) | |||
582 | * | 583 | * |
583 | * NOTE: | 584 | * NOTE: |
584 | * READ TRANSFER : We impose a restriction of the first message to be the | 585 | * READ TRANSFER : We impose a restriction of the first message to be the |
585 | * index message for any read transaction. | 586 | * index message for any read transaction. |
586 | * - a no index is coded as '0', | 587 | * - a no index is coded as '0', |
587 | * - 2byte big endian index is coded as '3' | 588 | * - 2byte big endian index is coded as '3' |
588 | * !!! msg[0].buf holds the actual index. | 589 | * !!! msg[0].buf holds the actual index. |
589 | * This is compatible with generic messages of smbus emulator | 590 | * This is compatible with generic messages of smbus emulator |
590 | * that send a one byte index. | 591 | * that send a one byte index. |
591 | * eg. a I2C transation to read 2 bytes from index 0 | 592 | * eg. a I2C transation to read 2 bytes from index 0 |
592 | * idx = 0; | 593 | * idx = 0; |
593 | * msg[0].addr = client->addr; | 594 | * msg[0].addr = client->addr; |
594 | * msg[0].flags = 0x0; | 595 | * msg[0].flags = 0x0; |
@@ -644,8 +645,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
644 | 645 | ||
645 | for (i = 0; i < num_msgs; i++) { | 646 | for (i = 0; i < num_msgs; i++) { |
646 | if (unlikely(msgs[i].flags & I2C_M_TEN)) { | 647 | if (unlikely(msgs[i].flags & I2C_M_TEN)) { |
647 | dev_err(&dev->pdev->dev, "10 bit addressing" | 648 | dev_err(&dev->pdev->dev, |
648 | "not supported\n"); | 649 | "10 bit addressing not supported\n"); |
649 | 650 | ||
650 | status = -EINVAL; | 651 | status = -EINVAL; |
651 | goto out; | 652 | goto out; |
@@ -789,8 +790,9 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg) | |||
789 | 790 | ||
790 | if (dev->cli.count) { | 791 | if (dev->cli.count) { |
791 | dev->result = -EIO; | 792 | dev->result = -EIO; |
792 | dev_err(&dev->pdev->dev, "%lu bytes still remain to be" | 793 | dev_err(&dev->pdev->dev, |
793 | "xfered\n", dev->cli.count); | 794 | "%lu bytes still remain to be xfered\n", |
795 | dev->cli.count); | ||
794 | (void) init_hw(dev); | 796 | (void) init_hw(dev); |
795 | } | 797 | } |
796 | complete(&dev->xfer_complete); | 798 | complete(&dev->xfer_complete); |
@@ -923,7 +925,7 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev) | |||
923 | } | 925 | } |
924 | 926 | ||
925 | if (request_mem_region(res->start, resource_size(res), | 927 | if (request_mem_region(res->start, resource_size(res), |
926 | DRIVER_NAME "I/O region") == NULL) { | 928 | DRIVER_NAME "I/O region") == NULL) { |
927 | ret = -EBUSY; | 929 | ret = -EBUSY; |
928 | goto err_no_region; | 930 | goto err_no_region; |
929 | } | 931 | } |
@@ -980,8 +982,9 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev) | |||
980 | 982 | ||
981 | i2c_set_adapdata(adap, dev); | 983 | i2c_set_adapdata(adap, dev); |
982 | 984 | ||
983 | dev_info(&pdev->dev, "initialize %s on virtual " | 985 | dev_info(&pdev->dev, |
984 | "base %p\n", adap->name, dev->virtbase); | 986 | "initialize %s on virtual base %p\n", |
987 | adap->name, dev->virtbase); | ||
985 | 988 | ||
986 | ret = i2c_add_numbered_adapter(adap); | 989 | ret = i2c_add_numbered_adapter(adap); |
987 | if (ret) { | 990 | if (ret) { |