From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: linux-i2c@vger.kernel.org
Cc: Wolfram Sang <wsa@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Jan Dabros <jsd@semihalf.com>, Michael Wu <michael.wu@vatics.com>,
Tian Ye <tianye@sugon.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>
Subject: [PATCH v3 03/12] i2c: designware: Define software status flags with BIT()
Date: Mon, 7 Nov 2022 15:42:39 +0200 [thread overview]
Message-ID: <20221107134248.864890-4-jarkko.nikula@linux.intel.com> (raw)
In-Reply-To: <20221107134248.864890-1-jarkko.nikula@linux.intel.com>
Define software status flags with a BIT() macro. While at it remove
STATUS_IDLE and replace its use with zero initialization and status
flags clearing with a mask.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/i2c/busses/i2c-designware-core.h | 10 +++++-----
drivers/i2c/busses/i2c-designware-master.c | 4 ++--
drivers/i2c/busses/i2c-designware-slave.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 6d1df28dd93b..457e6966f85e 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -123,12 +123,12 @@
#define DW_IC_COMP_PARAM_1_SPEED_MODE_MASK GENMASK(3, 2)
/*
- * status codes
+ * Sofware status flags
*/
-#define STATUS_IDLE 0x0
-#define STATUS_ACTIVE 0x1
-#define STATUS_WRITE_IN_PROGRESS 0x2
-#define STATUS_READ_IN_PROGRESS 0x4
+#define STATUS_ACTIVE BIT(0)
+#define STATUS_WRITE_IN_PROGRESS BIT(1)
+#define STATUS_READ_IN_PROGRESS BIT(2)
+#define STATUS_MASK GENMASK(2, 0)
/*
* operation modes
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index dc3c5a15a95b..1b7db2b58f31 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -574,7 +574,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
dev->msg_write_idx = 0;
dev->msg_read_idx = 0;
dev->msg_err = 0;
- dev->status = STATUS_IDLE;
+ dev->status = 0;
dev->abort_source = 0;
dev->rx_outstanding = 0;
@@ -731,7 +731,7 @@ static int i2c_dw_irq_handler_master(struct dw_i2c_dev *dev)
if (stat & DW_IC_INTR_TX_ABRT) {
dev->cmd_err |= DW_IC_ERR_TX_ABRT;
- dev->status = STATUS_IDLE;
+ dev->status &= ~STATUS_MASK;
dev->rx_outstanding = 0;
/*
diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c
index 295774a69b67..84eb0bec70fa 100644
--- a/drivers/i2c/busses/i2c-designware-slave.c
+++ b/drivers/i2c/busses/i2c-designware-slave.c
@@ -82,7 +82,7 @@ static int i2c_dw_reg_slave(struct i2c_client *slave)
dev->msg_write_idx = 0;
dev->msg_read_idx = 0;
dev->msg_err = 0;
- dev->status = STATUS_IDLE;
+ dev->status = 0;
dev->abort_source = 0;
dev->rx_outstanding = 0;
--
2.35.1
next prev parent reply other threads:[~2022-11-07 13:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 13:42 [PATCH v3 00/12] i2c: designware: Slave fixes and generic cleanups Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 01/12] i2c: designware: Fix slave state machine for sequential reads Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 02/12] i2c: designware: Empty receive FIFO in slave interrupt handler Jarkko Nikula
2022-11-12 6:57 ` Wolfram Sang
2022-11-14 9:53 ` Jarkko Nikula
2022-11-07 13:42 ` Jarkko Nikula [this message]
2022-11-07 13:42 ` [PATCH v3 04/12] i2c: designware: Remove needless initializations from i2c_dw_reg_slave() Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 05/12] i2c: designware: Remove unused completion code from i2c-designware-slave Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 06/12] i2c: designware: Simplify slave interrupt handler nesting Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 07/12] i2c: designware: Do not process interrupt when device is suspended Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 08/12] i2c: designware: Move debug print in i2c_dw_isr() Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 09/12] i2c: designware: Simplify master interrupt handler nesting Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 10/12] i2c: designware: Remove common i2c_dw_disable_int() Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 11/12] i2c: designware: Align defines in i2c-designware-core.h Jarkko Nikula
2022-11-07 13:42 ` [PATCH v3 12/12] i2c: designware: Add comment to custom register value constants Jarkko Nikula
2022-11-12 6:57 ` [PATCH v3 00/12] i2c: designware: Slave fixes and generic cleanups Wolfram Sang
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=20221107134248.864890-4-jarkko.nikula@linux.intel.com \
--to=jarkko.nikula@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jsd@semihalf.com \
--cc=linux-i2c@vger.kernel.org \
--cc=michael.wu@vatics.com \
--cc=mika.westerberg@linux.intel.com \
--cc=tianye@sugon.com \
--cc=wsa@kernel.org \
/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