i2c: i801: Drop needless bit-wise OR
PATCH 1/1 i2c: i801: Drop needless bit-wise OR
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
---
Daniel, was there any reason for this bit-wise OR, which I may be missing?
drivers/i2c/busses/i2c-i801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-i801.c +1 -1
@@ -548,7 +548,7 @@ static irqreturn_t i801_isr(int irq, voi status &=SMBHSTSTS_INTR |STATUS_ERROR_FLAGS ;if (status) {outb_p (status,SMBHSTSTS (priv)); - priv->status |= status; + priv->status = status;wake_up (&priv->waitq); }
Signature · 2 lines
Jean Delvare SUSE L3 Support
Quoted 9 lines · Jean Delvare
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
Signed-off-by Jean Delvare <[email protected]>Cc Daniel Kurtz <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Mika Westerberg <[email protected]>
Hi Jean,
Quoted 5 lines · Jean Delvare
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
Quoted 8 lines
Signed-off-by Jean Delvare <[email protected]>Cc Daniel Kurtz <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Mika Westerberg <[email protected]>Cc Wolfram Sang <[email protected]>---
Daniel, was there any reason for this bit-wise OR, which I may be missing?
The only thing I can think of is that I didn't want to assume that we would always clear priv->status before another interrupt arrived.
Quoted 20 lines
drivers/i2c/busses/i2c-i801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-i801.c 2016-05-24 11:05:40.564642488 +0200 renamed from drivers/i2c/busses/i2c-i801.c 2016-05-24 11:04:33.169026906 +0200 +1
-2@@ -548,7 +548,7 @@ static irqreturn_t i801_isr(int irq, voi status &= SMBHSTSTS_INTR | STATUS_ERROR_FLAGS; if (status) { outb_p(status, SMBHSTSTS(priv)); - priv->status |= status; + priv->status = status; wake_up(&priv->waitq); } --Jean Delvare
SUSE L3 Support
Hi Daniel,
Quoted 15 lines · Daniel Kurtz
Quoted 5 lines · Jean Delvare
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
Quoted 8 lines
Signed-off-by Jean Delvare <[email protected]>Cc Daniel Kurtz <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Mika Westerberg <[email protected]>Cc Wolfram Sang <[email protected]>---
Daniel, was there any reason for this bit-wise OR, which I may be missing?
Quoted 2 lines
The only thing I can think of is that I didn't want to assume that we would always clear
priv->statusbefore another interrupt arrived.
Well my question is quite clear: can this actually happen? I can't see how.
Quoted 13 lines
Quoted 13 lines
drivers/i2c/busses/i2c-i801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-i801.c 2016-05-24 11:05:40.564642488 +0200 renamed from drivers/i2c/busses/i2c-i801.c 2016-05-24 11:04:33.169026906 +0200 +1
-1@@ -548,7 +548,7 @@ static irqreturn_t i801_isr(int irq, voi status &= SMBHSTSTS_INTR | STATUS_ERROR_FLAGS; if (status) { outb_p(status, SMBHSTSTS(priv)); - priv->status |= status; + priv->status = status; wake_up(&priv->waitq); }
Signature · 2 lines
Jean Delvare SUSE L3 Support
Quoted 19 lines · Jean Delvare
Hi Daniel,
Quoted 15 lines · Daniel Kurtz
Quoted 13 lines · Jean Delvare
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
Signed-off-by Jean Delvare <[email protected]>Cc Daniel Kurtz <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Mika Westerberg <[email protected]>Cc Wolfram Sang <[email protected]>---
Daniel, was there any reason for this bit-wise OR, which I may be missing?
Quoted 5 lines
Quoted 2 lines
The only thing I can think of is that I didn't want to assume that we would always clear
priv->statusbefore another interrupt arrived.Well my question is quite clear: can this actually happen? I can't see how.
I have no idea. You'd have to ask Intel, I guess.
Quoted 19 lines
Quoted 5 lines
Quoted 5 lines
drivers/i2c/busses/i2c-i801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 10 lines
drivers/i2c/busses/i2c-i801.c 2016-05-24 11:05:40.564642488 +0200 static irqreturn_t i801_isr(int irq, voi · line 553
Quoted 10 lines
drivers/i2c/busses/i2c-i801.c 2016-05-24 11:05:40.564642488 +0200 renamed from drivers/i2c/busses/i2c-i801.c 2016-05-24 11:04:33.169026906 +0200 +1
-1@@ -548,7 +548,7 @@ static irqreturn_t i801_isr(int irq, voi status &= SMBHSTSTS_INTR | STATUS_ERROR_FLAGS; if (status) { outb_p(status, SMBHSTSTS(priv)); - priv->status |= status; + priv->status = status; wake_up(&priv->waitq); }--
Jean Delvare
SUSE L3 Support
Quoted 20 lines · Daniel Kurtz
Quoted 19 lines · Jean Delvare
Hi Daniel,
Quoted 15 lines · Daniel Kurtz
Quoted 13 lines · Jean Delvare
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
Signed-off-by Jean Delvare <[email protected]>Cc Daniel Kurtz <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Mika Westerberg <[email protected]>Cc Wolfram Sang <[email protected]>---
Daniel, was there any reason for this bit-wise OR, which I may be missing?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
The only thing I can think of is that I didn't want to assume that we would always clear
priv->statusbefore another interrupt arrived.Well my question is quite clear: can this actually happen? I can't see how.
I have no idea. You'd have to ask Intel, I guess.
You wrote the code based on public documentation, I thought you would know. But if you can't be bothered, never mind, I'll trust my understanding of the code.
Signature · 2 lines
Jean Delvare SUSE L3 Support
Daniel Kurtz
Reviewed-byQuoted 25 lines · Jean Delvare
Quoted 23 lines · Daniel Kurtz
Quoted 22 lines · Jean Delvare
Hi Daniel,
Quoted 17 lines · Daniel Kurtz
Quoted 5 lines · Jean Delvare
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
Quoted 8 lines
Signed-off-by Jean Delvare <[email protected]>Cc Daniel Kurtz <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Mika Westerberg <[email protected]>Cc Wolfram Sang <[email protected]>---
Daniel, was there any reason for this bit-wise OR, which I may be missing?The only thing I can think of is that I didn't want to assume that we would always clear
priv->statusbefore another interrupt arrived.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Well my question is quite clear: can this actually happen? I can't see how.
I have no idea. You'd have to ask Intel, I guess.
You wrote the code based on public documentation, I thought you would know. But if you can't be bothered, never mind, I'll trust my understanding of the code.
Here is the documentation:
http://www.intel.com/content/dam/doc/datasheet/io-controller-hub-6-datasheet.pdf
Page 570
I thought maybe there were situations where you could get INTR and an error condition, but I don't see anything like that in the documentation, so I think you are right and only one bit will be set at a time.
Quoted 3 lines
--
Jean Delvare
SUSE L3 Support
Quoted 5 lines · Jean Delvare
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
Quoted 8 lines
Signed-off-by Jean Delvare <[email protected]>Cc Daniel Kurtz <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Mika Westerberg <[email protected]>Cc Wolfram Sang <[email protected]>Reviewed-by Mika Westerberg <[email protected]>Reviewed-by Daniel Kurtz <[email protected]>---
Looks good to me:
Cheers,
Benjamin
Quoted 17 lines
Daniel, was there any reason for this bit-wise OR, which I may be missing?
drivers/i2c/busses/i2c-i801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-i801.c +1
-1@@ -548,7 +548,7 @@ static irqreturn_t i801_isr(int irq, voi status &=SMBHSTSTS_INTR |STATUS_ERROR_FLAGS ;if (status) {outb_p (status,SMBHSTSTS (priv)); - priv->status |= status; + priv->status = status;wake_up (&priv->waitq); }
Wolfram Sang
AppliedQuoted 10 lines · Jean Delvare
The interrupt handling code makes it look like several status values may be merged together before being processed, while this will never happen. Change from bit-wise OR to simple assignment to make it more obvious and avoid misunderstanding.
Signed-off-by Jean Delvare <[email protected]>Cc Daniel Kurtz <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Mika Westerberg <[email protected]>Cc Wolfram Sang <[email protected]>
Applied to for-next, thanks!