Title: [9432] trunk/drivers/staging/iio/gyro: staging: iio: adis16251 misc fixes
Revision
9432
Author
hennerich
Date
2010-10-26 11:03:16 -0400 (Tue, 26 Oct 2010)

Log Message

staging: iio: adis16251 misc fixes

adis16251_check_status() return negative value on error
adis16251_self_test() should be static

Modified Paths

Diff

Modified: trunk/drivers/staging/iio/gyro/adis16251.h (9431 => 9432)


--- trunk/drivers/staging/iio/gyro/adis16251.h	2010-10-26 14:19:06 UTC (rev 9431)
+++ trunk/drivers/staging/iio/gyro/adis16251.h	2010-10-26 15:03:16 UTC (rev 9432)
@@ -56,6 +56,15 @@
 #define ADIS16251_DIAG_STAT_POWER_HIGH	(1<<1)
 #define ADIS16251_DIAG_STAT_POWER_LOW	(1<<0)
 
+#define ADIS16251_DIAG_STAT_ERR_MASK (ADIS16261_DIAG_STAT_ALARM2 | \
+				      ADIS16261_DIAG_STAT_ALARM1 | \
+				      ADIS16261_DIAG_STAT_SELF_TEST | \
+				      ADIS16261_DIAG_STAT_OVERFLOW | \
+				      ADIS16261_DIAG_STAT_SPI_FAIL | \
+				      ADIS16261_DIAG_STAT_FLASH_UPT | \
+				      ADIS16261_DIAG_STAT_POWER_HIGH | \
+				      ADIS16261_DIAG_STAT_POWER_LOW)
+
 /* GLOB_CMD */
 #define ADIS16251_GLOB_CMD_SW_RESET	(1<<7)
 #define ADIS16251_GLOB_CMD_FLASH_UPD	(1<<3)

Modified: trunk/drivers/staging/iio/gyro/adis16251_core.c (9431 => 9432)


--- trunk/drivers/staging/iio/gyro/adis16251_core.c	2010-10-26 14:19:06 UTC (rev 9431)
+++ trunk/drivers/staging/iio/gyro/adis16251_core.c	2010-10-26 15:03:16 UTC (rev 9432)
@@ -451,7 +451,7 @@
 	return ret;
 }
 
-int adis16251_self_test(struct device *dev)
+static int adis16251_self_test(struct device *dev)
 {
 	int ret;
 
@@ -480,7 +480,14 @@
 		dev_err(dev, "Reading status failed\n");
 		goto error_ret;
 	}
-	ret = status;
+
+	if (!(status & ADIS16251_DIAG_STAT_ERR_MASK)) {
+		ret = 0;
+		goto error_ret;
+	}
+
+	ret = -EFAULT;
+
 	if (status & ADIS16251_DIAG_STAT_ALARM2)
 		dev_err(dev, "Alarm 2 active\n");
 	if (status & ADIS16251_DIAG_STAT_ALARM1)
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to