[PATCH 1/2] Staging: comedi: introduce outl_1564_* and inl_1564_* helper functions in hwdrv_apci1564.c

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

 



This patch introduces a handful of outl and inl helper functions with the
ultimate goal of improving code readability and allowing several lines
which violate the character limit to be shortened in a sane way.

Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Chase Southwood <chase.southwood@xxxxxxxxx>
---
This patchset serves as a replacement to my previous cleanup patchset for
hwdrv_apci1564.c

Dan,
After spending a little bit more time with this and trying out different
ways of cleaning this up, I decided that making helper functions for all
of the most common register sets would look the best, but I haven't made
a helper for a few of the least common inl/outl calls because if I did,
the sheer number of helper functions would get quite ridiculous.
Let me know if you think my selections of what to make into helper
functions seems appropriate.

Thanks,
Chase

 .../comedi/drivers/addi-data/hwdrv_apci1564.c      | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 2b47fa1..282a744 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -99,6 +99,54 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
 #define APCI1564_TCW_WARN_TIMEVAL			24
 #define APCI1564_TCW_WARN_TIMEBASE			28
 
+static void outl_1564_digital_ip(struct addi_private *devpriv, unsigned int cmd,
+						unsigned int reg)
+{
+	outl(cmd, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + reg);
+}
+
+static unsigned int inl_1564_digital_ip(struct addi_private *devpriv,
+						unsigned int reg)
+{
+	return inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + reg);
+}
+
+static void outl_1564_digital_op(struct addi_private *devpriv, unsigned int cmd,
+						unsigned int reg)
+{
+	outl(cmd, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + reg);
+}
+
+static unsigned int inl_1564_digital_op(struct addi_private *devpriv,
+						unsigned int reg)
+{
+	return inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + reg);
+}
+
+static void outl_1564_digital_op_watchdog(struct addi_private *devpriv,
+						unsigned int cmd, unsigned int reg)
+{
+	outl(cmd, devpriv->IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + reg);
+}
+
+static unsigned int inl_1564_digital_op_watchdog(struct addi_private *devpriv,
+						unsigned int reg)
+{
+	return inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + reg);
+}
+
+static void outl_1564_timer(struct addi_private *devpriv, unsigned int cmd,
+						unsigned int reg)
+{
+	outl(cmd, devpriv->i_IobaseAmcc + APCI1564_TIMER + reg);
+}
+
+static unsigned int inl_1564_timer(struct addi_private *devpriv,
+						unsigned int reg)
+{
+	return inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + reg);
+}
+
 /* Global variables */
 static unsigned int ui_InterruptStatus_1564;
 static unsigned int ui_InterruptData, ui_Type;
-- 
1.8.5.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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