[RFC PATCH 07/30] staging: comedi: dt9812: pass the comedi_device * to dt9812_digital_out()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For aesthetic reasons, instead of passing the 'slot' pointer, pass the
comedi_device pointer to this function and rename the local var 'result'
to simply 'ret'.

Also, initialize the 'reg', and 'value' when they are declared.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/dt9812.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c
index 8bd773a..96a1d86 100644
--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -411,23 +411,23 @@ static int dt9812_digital_in(struct comedi_device *dev, u8 *bits)
 	return ret;
 }
 
-static int dt9812_digital_out(struct slot_dt9812 *slot, u8 bits)
+static int dt9812_digital_out(struct comedi_device *dev, u8 bits)
 {
-	int result = -ENODEV;
+	struct dt9812_private *devpriv = dev->private;
+	struct slot_dt9812 *slot = devpriv->slot;
+	int ret = -ENODEV;
 
 	down(&slot->mutex);
 	if (slot->usb) {
-		u8 reg[1];
-		u8 value[1];
+		u8 reg[1] = { F020_SFR_P2 };
+		u8 value[1] = { bits };
 
-		reg[0] = F020_SFR_P2;
-		value[0] = bits;
-		result = dt9812_write_multiple_registers(slot->usb, 1, reg,
-							 value);
+		ret = dt9812_write_multiple_registers(slot->usb, 1, reg, value);
 		slot->usb->digital_out_shadow = bits;
 	}
 	up(&slot->mutex);
-	return result;
+
+	return ret;
 }
 
 static int dt9812_digital_out_shadow(struct slot_dt9812 *slot, u8 *bits)
@@ -671,7 +671,7 @@ static int dt9812_do_winsn(struct comedi_device *dev,
 		if (data[n])
 			bits |= mask;
 	}
-	dt9812_digital_out(devpriv->slot, bits);
+	dt9812_digital_out(dev, bits);
 	return n;
 }
 
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux