Skip to contentSkip to conversation

spi: fix spi_sync

RFC PATCH Superseded Marc Pignat 1 participant 1 message Oct 25, 2007 SPI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/2 spi: fix spi_sync

Fix spi_sync calling convention, fix spi_sync users.

---

Regards

Marc

rtc/rtc-max6902.c renamed from rtc/rtc-max6902.c.orig +3 -7
@@ -89,14 +89,12 @@ static int max6902_get_reg(struct device
 
 	/* do the i/o */
 	status = spi_sync(spi, &message);
-	if (status == 0)
-		status = message.status;
-	else
+	if (status)
 		return status;
 
 	*data = chip->rx_buf[1];
 
-	return status;
+	return 0;
 }
 
 static int max6902_get_datetime(struct device *dev, struct rtc_time *dt)
@@ -125,9 +123,7 @@ static int max6902_get_datetime(struct d
 
 	/* do the i/o */
 	status = spi_sync(spi, &message);
-	if (status == 0)
-		status = message.status;
-	else
+	if (status)
 		return status;
 
 	/* The chip sends data in this order:
input/touchscreen/ads7846.c renamed from input/touchscreen/ads7846.c.orig +6 -7
@@ -267,13 +267,12 @@ static int ads7846_read12_ser(struct dev
 	ts->irq_disabled = 0;
 	enable_irq(spi->irq);
 
-	if (req->msg.status)
-		status = req->msg.status;
-
-	/* on-wire is a must-ignore bit, a BE12 value, then padding */
-	sample = be16_to_cpu(req->sample);
-	sample = sample >> 3;
-	sample &= 0x0fff;
+	if (status == 0) {
+		/* on-wire is a must-ignore bit, a BE12 value, then padding */
+		sample = be16_to_cpu(req->sample);
+		sample = sample >> 3;
+		sample &= 0x0fff;
+	}
 
 	kfree(req);
 	return status ? status : sample;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/