[PATCH 08/28] staging: comedi: s626: remove I2CR and I2CW macros
Ian Abbott
abbotti at mev.co.uk
Tue Oct 8 18:06:22 UTC 2013
The `I2CR` and `I2CW` macros expand to the I2C read and write addresses,
respectively. They are only used in one place each and include the name
of a local variable `devpriv` in their expansion.
Get rid of the macros and expand them in place.
Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
---
drivers/staging/comedi/drivers/s626.c | 4 ++--
drivers/staging/comedi/drivers/s626.h | 6 ------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index 58f2208..443e954 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -309,7 +309,7 @@ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr)
* Byte1 = EEPROM internal target address.
* Byte0 = Not sent.
*/
- if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CW) |
+ if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, devpriv->I2CAdrs) |
I2C_B1(I2C_ATTRSTOP, addr) |
I2C_B0(I2C_ATTRNOP, 0)))
/* Abort function and declare error if handshake failed. */
@@ -321,7 +321,7 @@ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr)
* Byte1 receives uint8_t from EEPROM.
* Byte0 = Not sent.
*/
- if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CR) |
+ if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, (devpriv->I2CAdrs | 1)) |
I2C_B1(I2C_ATTRSTOP, 0) |
I2C_B0(I2C_ATTRNOP, 0)))
/* Abort function and declare error if handshake failed. */
diff --git a/drivers/staging/comedi/drivers/s626.h b/drivers/staging/comedi/drivers/s626.h
index f7ed4af..939b359 100644
--- a/drivers/staging/comedi/drivers/s626.h
+++ b/drivers/staging/comedi/drivers/s626.h
@@ -384,12 +384,6 @@
#define I2C_ATTRSTOP 0x1 /* I2C attribute STOP. */
#define I2C_ATTRNOP 0x0 /* I2C attribute NOP. */
-/* I2C read command | EEPROM address. */
-#define I2CR (devpriv->I2CAdrs | 1)
-
-/* I2C write command | EEPROM address. */
-#define I2CW (devpriv->I2CAdrs)
-
/* Code macros used for constructing I2C command bytes. */
#define I2C_B2(ATTR, VAL) (((ATTR) << 6) | ((VAL) << 24))
#define I2C_B1(ATTR, VAL) (((ATTR) << 4) | ((VAL) << 16))
--
1.8.3.2
More information about the devel
mailing list