From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/7] i2c: mv_i2c.c: cosmetic: Coding style cleanups
Date: Fri, 16 Sep 2016 15:07:49 +0200 [thread overview]
Message-ID: <20160916130755.9883-1-sr@denx.de> (raw)
Some mostly indentation coding style cleanups. Also, move this driver
to use debug() for debug output.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Heiko Schocher <hs@denx.de>
---
drivers/i2c/mv_i2c.c | 68 ++++++++++++++++++++++++++--------------------------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c
index fc02e65..0877c51 100644
--- a/drivers/i2c/mv_i2c.c
+++ b/drivers/i2c/mv_i2c.c
@@ -24,12 +24,6 @@
#include <i2c.h>
#include "mv_i2c.h"
-#ifdef DEBUG_I2C
-#define PRINTD(x) printf x
-#else
-#define PRINTD(x)
-#endif
-
/* All transfers are described by this data structure */
struct mv_i2c_msg {
u8 condition;
@@ -234,33 +228,39 @@ int i2c_transfer(struct mv_i2c_msg *msg)
return 0;
transfer_error_msg_empty:
- PRINTD(("i2c_transfer: error: 'msg' is empty\n"));
- ret = -1; goto i2c_transfer_finish;
+ debug("i2c_transfer: error: 'msg' is empty\n");
+ ret = -1;
+ goto i2c_transfer_finish;
transfer_error_transmit_timeout:
- PRINTD(("i2c_transfer: error: transmit timeout\n"));
- ret = -2; goto i2c_transfer_finish;
+ debug("i2c_transfer: error: transmit timeout\n");
+ ret = -2;
+ goto i2c_transfer_finish;
transfer_error_ack_missing:
- PRINTD(("i2c_transfer: error: ACK missing\n"));
- ret = -3; goto i2c_transfer_finish;
+ debug("i2c_transfer: error: ACK missing\n");
+ ret = -3;
+ goto i2c_transfer_finish;
transfer_error_receive_timeout:
- PRINTD(("i2c_transfer: error: receive timeout\n"));
- ret = -4; goto i2c_transfer_finish;
+ debug("i2c_transfer: error: receive timeout\n");
+ ret = -4;
+ goto i2c_transfer_finish;
transfer_error_illegal_param:
- PRINTD(("i2c_transfer: error: illegal parameters\n"));
- ret = -5; goto i2c_transfer_finish;
+ debug("i2c_transfer: error: illegal parameters\n");
+ ret = -5;
+ goto i2c_transfer_finish;
transfer_error_bus_busy:
- PRINTD(("i2c_transfer: error: bus is busy\n"));
- ret = -6; goto i2c_transfer_finish;
+ debug("i2c_transfer: error: bus is busy\n");
+ ret = -6;
+ goto i2c_transfer_finish;
i2c_transfer_finish:
- PRINTD(("i2c_transfer: ISR: 0x%04x\n", readl(&base->isr)));
- i2c_reset();
- return ret;
+ debug("i2c_transfer: ISR: 0x%04x\n", readl(&base->isr));
+ i2c_reset();
+ return ret;
}
/* ------------------------------------------------------------------------ */
@@ -325,13 +325,13 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
struct mv_i2c_msg msg;
u8 addr_bytes[3]; /* lowest...highest byte of data address */
- PRINTD(("i2c_read(chip=0x%02x, addr=0x%02x, alen=0x%02x, "
- "len=0x%02x)\n", chip, addr, alen, len));
+ debug("i2c_read(chip=0x%02x, addr=0x%02x, alen=0x%02x, "
+ "len=0x%02x)\n", chip, addr, alen, len);
i2c_reset();
/* dummy chip address write */
- PRINTD(("i2c_read: dummy chip address write\n"));
+ debug("i2c_read: dummy chip address write\n");
msg.condition = I2C_COND_START;
msg.acknack = I2C_ACKNAK_WAITACK;
msg.direction = I2C_WRITE;
@@ -350,7 +350,7 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
addr_bytes[2] = (u8)((addr >> 16) & 0x000000FF);
while (--alen >= 0) {
- PRINTD(("i2c_read: send memory word address byte %1d\n", alen));
+ debug("i2c_read: send memory word address byte %1d\n", alen);
msg.condition = I2C_COND_NORMAL;
msg.acknack = I2C_ACKNAK_WAITACK;
msg.direction = I2C_WRITE;
@@ -360,7 +360,7 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
}
/* start read sequence */
- PRINTD(("i2c_read: start read sequence\n"));
+ debug("i2c_read: start read sequence\n");
msg.condition = I2C_COND_START;
msg.acknack = I2C_ACKNAK_WAITACK;
msg.direction = I2C_WRITE;
@@ -385,8 +385,8 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
return -1;
*buffer = msg.data;
- PRINTD(("i2c_read: reading byte (0x%08x)=0x%02x\n",
- (unsigned int)buffer, *buffer));
+ debug("i2c_read: reading byte (0x%08x)=0x%02x\n",
+ (unsigned int)buffer, *buffer);
buffer++;
}
@@ -413,13 +413,13 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
struct mv_i2c_msg msg;
u8 addr_bytes[3]; /* lowest...highest byte of data address */
- PRINTD(("i2c_write(chip=0x%02x, addr=0x%02x, alen=0x%02x, "
- "len=0x%02x)\n", chip, addr, alen, len));
+ debug("i2c_write(chip=0x%02x, addr=0x%02x, alen=0x%02x, "
+ "len=0x%02x)\n", chip, addr, alen, len);
i2c_reset();
/* chip address write */
- PRINTD(("i2c_write: chip address write\n"));
+ debug("i2c_write: chip address write\n");
msg.condition = I2C_COND_START;
msg.acknack = I2C_ACKNAK_WAITACK;
msg.direction = I2C_WRITE;
@@ -437,7 +437,7 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
addr_bytes[2] = (u8)((addr >> 16) & 0x000000FF);
while (--alen >= 0) {
- PRINTD(("i2c_write: send memory word address\n"));
+ debug("i2c_write: send memory word address\n");
msg.condition = I2C_COND_NORMAL;
msg.acknack = I2C_ACKNAK_WAITACK;
msg.direction = I2C_WRITE;
@@ -448,8 +448,8 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
/* write bytes; send NACK at last byte */
while (len--) {
- PRINTD(("i2c_write: writing byte (0x%08x)=0x%02x\n",
- (unsigned int)buffer, *buffer));
+ debug("i2c_write: writing byte (0x%08x)=0x%02x\n",
+ (unsigned int)buffer, *buffer);
if (len == 0)
msg.condition = I2C_COND_STOP;
--
2.9.3
next reply other threads:[~2016-09-16 13:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 13:07 Stefan Roese [this message]
2016-09-16 13:07 ` [U-Boot] [PATCH 2/7] i2c: mv_i2c.c: Remove CONFIG_HARD_I2C Stefan Roese
2016-09-16 13:07 ` [U-Boot] [PATCH 3/7] i2c: mv_i2c.c: Prepare driver for DM conversion Stefan Roese
2016-09-16 13:07 ` [U-Boot] [PATCH 4/7] i2c: mv_i2c.c: Add DM support Stefan Roese
2016-09-16 13:07 ` [U-Boot] [PATCH 5/7] i2c: mv_i2c.c: Enable runtime speed selection (standard vs fast mode) Stefan Roese
2016-09-16 13:07 ` [U-Boot] [PATCH 6/7] i2c: mv_i2c.c: Validate read length in I2C command Stefan Roese
2016-09-16 13:07 ` [U-Boot] [PATCH 7/7] i2c: mvtwsi.c: Add support for Marvell Armada 7K/8K Stefan Roese
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=20160916130755.9883-1-sr@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox