Skip to contentSkip to conversation

iio: bmp280: fix eoc interrupt usage

PATCH Superseded Andreas Klinger 4 participants 8 messages Oct 18, 2023 – Oct 21, 2023 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: bmp280: fix eoc interrupt usage

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the bmp085 and bmp180 share the same chip id. Therefore it's necessary to distinguish the case in which the interrupt is set.

Fix the if statement so that only when the interrupt is set and the chip id is recognized the interrupt is requested.

This bug exists since the support of EOC interrupt was introduced.

Fixes aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

Also add a link to bmp085 datasheet for reference.

---
 drivers/iio/pressure/bmp280-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/pressure/bmp280-core.c +2 -1
index 6089f3f9d8f4..9b7beeb1c088 100644
@@ -9,6 +9,7 @@
  * Driver for Bosch Sensortec BMP180 and BMP280 digital pressure sensor.
  *
  * Datasheet:
+ * https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf
  * https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
  * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp280-ds001.pdf
  * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf
@@ -2179,7 +2180,7 @@ int bmp280_common_probe(struct device *dev,
 	 * however as it happens, the BMP085 shares the chip ID of BMP180
 	 * so we look for an IRQ if we have that.
 	 */
-	if (irq > 0 || (chip_id  == BMP180_CHIP_ID)) {
+	if (irq > 0 && (chip_id  == BMP180_CHIP_ID)) {
 		ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
 		if (ret)
 			return ret;
Signature · 1 line
2.39.2
#1 lore raw
Quoted 11 lines · Andreas Klinger

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the bmp085 and bmp180 share the same chip id. Therefore it's necessary to distinguish the case in which the interrupt is set.

Fix the if statement so that only when the interrupt is set and the chip id is recognized the interrupt is requested.

This bug exists since the support of EOC interrupt was introduced.

Fixes aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

Also add a link to bmp085 datasheet for reference.

...

drivers/iio/pressure/bmp280-core.c int bmp280_common_probe(struct device *dev, · line 2183

Quoted 2 lines
drivers/iio/pressure/bmp280-core.c +1 -1
-	if (irq > 0 || (chip_id  == BMP180_CHIP_ID)) {
+	if (irq > 0 && (chip_id  == BMP180_CHIP_ID)) {

While at it, perhaps drop extra space?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Reviewed-by on v1 1/1
#2 lore raw
In reply to Andreas Klinger
Quoted 7 lines · Andreas Klinger

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the bmp085 and bmp180 share the same chip id. Therefore it's necessary to distinguish the case in which the interrupt is set.

Fix the if statement so that only when the interrupt is set and the chip id is recognized the interrupt is requested.

Quoted 7 lines

This bug exists since the support of EOC interrupt was introduced.

Fixes aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

Also add a link to bmp085 datasheet for reference.

Yours,
Linus Walleij

maintainer
#3 lore raw
In reply to Andreas Klinger
Quoted 4 lines · On Wed, 18 Oct 2023 17:28:16 +0200 Andreas Klinger <[email protected]> wrote:

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the bmp085 and bmp180 share the same chip id. Therefore it's necessary to distinguish the case in which the interrupt is set.

Quoted 8 lines

Fix the if statement so that only when the interrupt is set and the chip id is recognized the interrupt is requested.

This bug exists since the support of EOC interrupt was introduced.

Fixes aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

Also add a link to bmp085 datasheet for reference.

Fixes tag is part of the tags block so needs to be down here.

Quoted 2 lines

However, it's also already fixed upstream I think.
That's not filtered back around to my togreg branch though as that has an outstanding pull request.

Jonathan

Quoted 25 lines
---
 drivers/iio/pressure/bmp280-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/pressure/bmp280-core.c +2 -1
index 6089f3f9d8f4..9b7beeb1c088 100644
@@ -9,6 +9,7 @@
  * Driver for Bosch Sensortec BMP180 and BMP280 digital pressure sensor.
  *
  * Datasheet:
+ * https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf
  * https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
  * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp280-ds001.pdf
  * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf
@@ -2179,7 +2180,7 @@ int bmp280_common_probe(struct device *dev,
 	 * however as it happens, the BMP085 shares the chip ID of BMP180
 	 * so we look for an IRQ if we have that.
 	 */
-	if (irq > 0 || (chip_id  == BMP180_CHIP_ID)) {
+	if (irq > 0 && (chip_id  == BMP180_CHIP_ID)) {
 		ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
 		if (ret)
 			return ret;
#4 lore raw

PATCH v2 1/1 iio: bmp280: fix eoc interrupt usage

In reply to Andreas Klinger

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the bmp085 and bmp180 share the same chip id. Therefore it's necessary to distinguish the case in which the interrupt is set.

Fix the if statement so that only when the interrupt is set and the chip id is recognized the interrupt is requested.

This bug exists since the support of EOC interrupt was introduced.

Fixes aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

Also add a link to bmp085 datasheet for reference.

---
v1 -> v2: Remove extra space (seen by Andy)

 drivers/iio/pressure/bmp280-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/pressure/bmp280-core.c +2 -1
index 6089f3f9d8f4..ef9b3c4f2340 100644
@@ -9,6 +9,7 @@
  * Driver for Bosch Sensortec BMP180 and BMP280 digital pressure sensor.
  *
  * Datasheet:
+ * https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf
  * https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
  * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp280-ds001.pdf
  * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf
@@ -2179,7 +2180,7 @@ int bmp280_common_probe(struct device *dev,
 	 * however as it happens, the BMP085 shares the chip ID of BMP180
 	 * so we look for an IRQ if we have that.
 	 */
-	if (irq > 0 || (chip_id  == BMP180_CHIP_ID)) {
+	if (irq > 0 && (chip_id == BMP180_CHIP_ID)) {
 		ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
 		if (ret)
 			return ret;
Signature · 1 line
2.39.2
#5 lore raw
Quoted 10 lines · Andreas Klinger

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the bmp085 and bmp180 share the same chip id. Therefore it's necessary to distinguish the case in which the interrupt is set.

Fix the if statement so that only when the interrupt is set and the chip id is recognized the interrupt is requested.

This bug exists since the support of EOC interrupt was introduced.

Fixes aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

As Jonathan already commented, this is part of a tag block below...

Quoted 2 lines

Also add a link to bmp085 datasheet for reference.

...somewhere here.

Quoted 5 lines

---
v1 -> v2: Remove extra space (seen by Andy)

And seems Jonathan mentioned that this is already fixed in his tree. Did I understand that correctly?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

Hi Andy,

Andy Shevchenko <[email protected]> schrieb am Do, 19. Okt 19:54:

Quoted 26 lines · Andreas Klinger
Quoted 10 lines

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the bmp085 and bmp180 share the same chip id. Therefore it's necessary to distinguish the case in which the interrupt is set.

Fix the if statement so that only when the interrupt is set and the chip id is recognized the interrupt is requested.

This bug exists since the support of EOC interrupt was introduced.

Fixes aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

As Jonathan already commented, this is part of a tag block below...

Quoted 2 lines

Also add a link to bmp085 datasheet for reference.

...somewhere here.

Quoted 5 lines

---
v1 -> v2: Remove extra space (seen by Andy)

Quoted 2 lines

And seems Jonathan mentioned that this is already fixed in his tree. Did I understand that correctly?

I just read it in the archive. For some reason I didn't get Jonathans mail yesterday. Sorry for the spam.

Andreas

maintainer
#7 lore raw
Quoted 29 lines · On Thu, 19 Oct 2023 19:15:22 +0200 Andreas Klinger <[email protected]> wrote:

Hi Andy,

Andy Shevchenko <[email protected]> schrieb am Do, 19. Okt 19:54:

Quoted 26 lines · Andreas Klinger
Quoted 10 lines

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the bmp085 and bmp180 share the same chip id. Therefore it's necessary to distinguish the case in which the interrupt is set.

Fix the if statement so that only when the interrupt is set and the chip id is recognized the interrupt is requested.

This bug exists since the support of EOC interrupt was introduced.

Fixes aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

As Jonathan already commented, this is part of a tag block below...

Quoted 2 lines

Also add a link to bmp085 datasheet for reference.

...somewhere here.

Quoted 5 lines

---
v1 -> v2: Remove extra space (seen by Andy)

Quoted 5 lines
Quoted 2 lines

And seems Jonathan mentioned that this is already fixed in his tree. Did I understand that correctly?

I just read it in the archive. For some reason I didn't get Jonathans mail yesterday. Sorry for the spam.

btw, don't reply to an earlier version. New version is new email thread. Otherwise things get very tricky to follow once we have lots of versions

Jonathan

Quoted 3 lines

Andreas