lkml.org 
[lkml]   [2014]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] Staging: comedi: introduce outl_1564_* and inl_1564_* helper functions in hwdrv_apci1564.c
Date
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@oracle.com>
Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
---
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


\
 
 \ /
  Last update: 2014-03-01 12:01    [W:0.106 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site