Skip to contentSkip to conversation

iio: magnetometer: hmc5843: Replace a return value.

PATCH In review Song Qiang 2 participants 2 messages Sep 20, 2018 – Sep 22, 2018 IIO

lore
Share & tools
lore

Song Qiang

author
#0 lore raw

PATCH 1/1 iio: magnetometer: hmc5843: Replace a return value.

This error apparently is caused by timed out event, so a -ETIMEDOUT should be used instead of a -EIO, and it also tells user what happened , so this dev_err may not be needed anymore.

---
I used ./scripts/get_maintainer.pl to get maintainers about this file, I thought this script searches maintainers with looking up MAINTAINER, is that right?
So I searched MAINTAINER and also found nothing related to hmc5843. In the declearation area I can see Shubhrajyoti Datta <[email protected]> wroted this driver and several other people including Peter Meerwald have contributed. Is this driver now a orphan? Or if it is, I think we may also need to add it to the MAINTAINER file. I'm also familiar with this device, I think I can add interrupt support later.

 drivers/iio/magnetometer/hmc5843_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/magnetometer/hmc5843_core.c +1 -2
index ada142fb7aa3..4fb393c3854c 100644
@@ -170,8 +170,7 @@ static int hmc5843_wait_measurement(struct hmc5843_data *data)
 	}
 
 	if (tries < 0) {
-		dev_err(data->dev, "data not ready\n");
-		return -EIO;
+		return -ETIMEDOUT;
 	}
 
 	return 0;
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 5 lines · On Thu, 20 Sep 2018 21:42:19 +0800 Song Qiang <[email protected]>…

This error apparently is caused by timed out event, so a -ETIMEDOUT should be used instead of a -EIO, and it also tells user what happened , so this dev_err may not be needed anymore.

Quoted 11 lines

---
I used ./scripts/get_maintainer.pl to get maintainers about this file, I thought this script searches maintainers with looking up MAINTAINER, is that right?
So I searched MAINTAINER and also found nothing related to hmc5843. In the declearation area I can see Shubhrajyoti Datta <[email protected]> wroted this driver and several other people including Peter Meerwald have contributed. Is this driver now a orphan? Or if it is, I think we may also need to add it to the MAINTAINER file. I'm also familiar with this device, I think I can add interrupt support later.

Those drivers not covered by more explicit MAINTAINER entries are picked up by the main IIO one. Of course if you are working in a significant way with the driver and want to adopt it, then post a patch adding a MAINTAINERS entry and see if any of the previous significant contributors mind (or potentially want to co-maintain it).

Quoted 9 lines
 drivers/iio/magnetometer/hmc5843_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/magnetometer/hmc5843_core.c +0 -0
index ada142fb7aa3..4fb393c3854c 100644

drivers/iio/magnetometer/hmc5843_core.c static int hmc5843_wait_measurement(struct hmc5843_data *data) · line 173

Quoted 6 lines
drivers/iio/magnetometer/hmc5843_core.c +1 -2
@@ -170,8 +170,7 @@ static int hmc5843_wait_measurement(struct hmc5843_data *data)
 	}
 
 	if (tries < 0) {
-		dev_err(data->dev, "data not ready\n");
-		return -EIO;
+		return -ETIMEDOUT;

I'd say no on this one as I suspect such a timeout only indicates a communication problem, not some delay in the hardware managing to return an answer..

It's certainly not a clear enough reason to my mind to argue for changing the error code (which it is just possible some less than ideal userspace code is relying on).

Jonathan

Quoted 3 lines
drivers/iio/magnetometer/hmc5843_core.c +0 -0
 	}
 
 	return 0;