Commit 4e4b592c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: comedi: hwdrv_apci3xxx.c: loads of sparse cleanups

__iomem pointer fixes, and static cleanups.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a6dc6d0d
...@@ -67,10 +67,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -67,10 +67,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour
| 1 : Conversion started | | 1 : Conversion started |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
{ {
if ((readl((void *)(devpriv->dw_AiBase + 8)) & 0x80000UL) == 0x80000UL) if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL)
return 1; return 1;
else else
return 0; return 0;
...@@ -104,9 +103,10 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) ...@@ -104,9 +103,10 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_TimeBase = 0; unsigned char b_TimeBase = 0;
...@@ -204,19 +204,14 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, ...@@ -204,19 +204,14 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
/* Set the convert timing unit */ /* Set the convert timing unit */
/*******************************/ /*******************************/
writel((unsigned int) writel((unsigned int)b_TimeBase,
b_TimeBase, devpriv->dw_AiBase + 36);
(void *)
(devpriv->
dw_AiBase
+
36));
/**************************/ /**************************/
/* Set the convert timing */ /* Set the convert timing */
/*************************/ /*************************/
writel(dw_ReloadValue, (void *)(devpriv->dw_AiBase + 32)); writel(dw_ReloadValue, devpriv->dw_AiBase + 32);
} else { } else {
/**************************/ /**************************/
/* Any conversion started */ /* Any conversion started */
...@@ -294,9 +289,10 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, ...@@ -294,9 +289,10 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev,
int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
...@@ -354,9 +350,10 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, ...@@ -354,9 +350,10 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec);
...@@ -422,26 +419,20 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, ...@@ -422,26 +419,20 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
/* Clear the FIFO */ /* Clear the FIFO */
/******************/ /******************/
writel(0x10000UL, writel(0x10000UL, devpriv->dw_AiBase + 12);
(void *)(devpriv->dw_AiBase +
12));
/*******************************/ /*******************************/
/* Get and save the delay mode */ /* Get and save the delay mode */
/*******************************/ /*******************************/
dw_Temp = dw_Temp = readl(devpriv->dw_AiBase + 4);
readl((void *)(devpriv->
dw_AiBase + 4));
dw_Temp = dw_Temp & 0xFFFFFEF0UL; dw_Temp = dw_Temp & 0xFFFFFEF0UL;
/***********************************/ /***********************************/
/* Channel configuration selection */ /* Channel configuration selection */
/***********************************/ /***********************************/
writel(dw_Temp, writel(dw_Temp, devpriv->dw_AiBase + 4);
(void *)(devpriv->dw_AiBase +
4));
/**************************/ /**************************/
/* Make the configuration */ /* Make the configuration */
...@@ -458,35 +449,28 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, ...@@ -458,35 +449,28 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
/***************************/ /***************************/
writel(dw_Configuration, writel(dw_Configuration,
(void *)(devpriv->dw_AiBase + devpriv->dw_AiBase + 0);
0));
/*********************/ /*********************/
/* Channel selection */ /* Channel selection */
/*********************/ /*********************/
writel(dw_Temp | 0x100UL, writel(dw_Temp | 0x100UL,
(void *)(devpriv->dw_AiBase + devpriv->dw_AiBase + 4);
4));
writel((unsigned int) b_Channel, writel((unsigned int) b_Channel,
(void *)(devpriv->dw_AiBase + devpriv->dw_AiBase + 0);
0));
/***********************/ /***********************/
/* Restaure delay mode */ /* Restaure delay mode */
/***********************/ /***********************/
writel(dw_Temp, writel(dw_Temp, devpriv->dw_AiBase + 4);
(void *)(devpriv->dw_AiBase +
4));
/***********************************/ /***********************************/
/* Set the number of sequence to 1 */ /* Set the number of sequence to 1 */
/***********************************/ /***********************************/
writel(1, writel(1, devpriv->dw_AiBase + 48);
(void *)(devpriv->dw_AiBase +
48));
/***************************/ /***************************/
/* Save the interrupt flag */ /* Save the interrupt flag */
...@@ -514,50 +498,29 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, ...@@ -514,50 +498,29 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
/* Start the conversion */ /* Start the conversion */
/************************/ /************************/
writel(0x80000UL, writel(0x80000UL, devpriv->dw_AiBase + 8);
(void *)
(devpriv->
dw_AiBase
+ 8));
/****************/ /****************/
/* Wait the EOS */ /* Wait the EOS */
/****************/ /****************/
do { do {
dw_Temp = dw_Temp = readl(devpriv->dw_AiBase + 20);
readl( dw_Temp = dw_Temp & 1;
(void *)
(devpriv->
dw_AiBase
+
20));
dw_Temp =
dw_Temp
& 1;
} while (dw_Temp != 1); } while (dw_Temp != 1);
/*************************/ /*************************/
/* Read the analog value */ /* Read the analog value */
/*************************/ /*************************/
data[dw_AcquisitionCpt] data[dw_AcquisitionCpt] = (unsigned int)readl(devpriv->dw_AiBase + 28);
=
(unsigned int)
readl((void
*)
(devpriv->
dw_AiBase
+ 28));
} }
} else { } else {
/************************/ /************************/
/* Start the conversion */ /* Start the conversion */
/************************/ /************************/
writel(0x180000UL, writel(0x180000UL, devpriv->dw_AiBase + 8);
(void *)(devpriv->
dw_AiBase + 8));
} }
} else { } else {
/**************************/ /**************************/
...@@ -603,7 +566,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, ...@@ -603,7 +566,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
void v_APCI3XXX_Interrupt(int irq, void *d) static void v_APCI3XXX_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
unsigned char b_CopyCpt = 0; unsigned char b_CopyCpt = 0;
...@@ -613,13 +576,13 @@ void v_APCI3XXX_Interrupt(int irq, void *d) ...@@ -613,13 +576,13 @@ void v_APCI3XXX_Interrupt(int irq, void *d)
/* Test if interrupt occur */ /* Test if interrupt occur */
/***************************/ /***************************/
dw_Status = readl((void *)(devpriv->dw_AiBase + 16)); dw_Status = readl(devpriv->dw_AiBase + 16);
if ( (dw_Status & 0x2UL) == 0x2UL) { if ( (dw_Status & 0x2UL) == 0x2UL) {
/***********************/ /***********************/
/* Reset the interrupt */ /* Reset the interrupt */
/***********************/ /***********************/
writel(dw_Status, (void *)(devpriv->dw_AiBase + 16)); writel(dw_Status, devpriv->dw_AiBase + 16);
/*****************************/ /*****************************/
/* Test if interrupt enabled */ /* Test if interrupt enabled */
...@@ -634,8 +597,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d) ...@@ -634,8 +597,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d)
b_CopyCpt < devpriv->ui_AiNbrofChannels; b_CopyCpt < devpriv->ui_AiNbrofChannels;
b_CopyCpt++) { b_CopyCpt++) {
devpriv->ui_AiReadData[b_CopyCpt] = devpriv->ui_AiReadData[b_CopyCpt] =
(unsigned int) readl((void *)(devpriv-> (unsigned int)readl(devpriv->dw_AiBase + 28);
dw_AiBase + 28));
} }
/**************************/ /**************************/
...@@ -682,9 +644,10 @@ void v_APCI3XXX_Interrupt(int irq, void *d) ...@@ -682,9 +644,10 @@ void v_APCI3XXX_Interrupt(int irq, void *d)
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec);
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
...@@ -710,24 +673,21 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, ...@@ -710,24 +673,21 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
/* Set the range selection */ /* Set the range selection */
/***************************/ /***************************/
writel(b_Range, writel(b_Range, devpriv->dw_AiBase + 96);
(void *)(devpriv->dw_AiBase + 96));
/**************************************************/ /**************************************************/
/* Write the analog value to the selected channel */ /* Write the analog value to the selected channel */
/**************************************************/ /**************************************************/
writel((data[0] << 8) | b_Channel, writel((data[0] << 8) | b_Channel,
(void *)(devpriv->dw_AiBase + 100)); devpriv->dw_AiBase + 100);
/****************************/ /****************************/
/* Wait the end of transfer */ /* Wait the end of transfer */
/****************************/ /****************************/
do { do {
dw_Status = dw_Status = readl(devpriv->dw_AiBase + 96);
readl((void *)(devpriv->
dw_AiBase + 96));
} while ((dw_Status & 0x100) != 0x100); } while ((dw_Status & 0x100) != 0x100);
} else { } else {
/***************************/ /***************************/
...@@ -788,9 +748,10 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, ...@@ -788,9 +748,10 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev,
int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Command = 0; unsigned char b_Command = 0;
...@@ -916,9 +877,10 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -916,9 +877,10 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev,
int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_ChannelCpt = 0; unsigned char b_ChannelCpt = 0;
...@@ -1071,9 +1033,10 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, ...@@ -1071,9 +1033,10 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev,
int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
...@@ -1184,9 +1147,10 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, ...@@ -1184,9 +1147,10 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev,
int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
...@@ -1296,8 +1260,10 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, ...@@ -1296,8 +1260,10 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev,
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, static int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
...@@ -1354,8 +1320,10 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, ...@@ -1354,8 +1320,10 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, static int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned int dw_Temp = 0; unsigned int dw_Temp = 0;
...@@ -1407,8 +1375,10 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, ...@@ -1407,8 +1375,10 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, static int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_ChannelCpt = 0; unsigned char b_ChannelCpt = 0;
...@@ -1503,8 +1473,10 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, ...@@ -1503,8 +1473,10 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev,
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev, static int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = CR_CHAN(insn->chanspec); unsigned char b_Channel = CR_CHAN(insn->chanspec);
...@@ -1578,8 +1550,10 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev, ...@@ -1578,8 +1550,10 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev,
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, static int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{ {
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = CR_CHAN(insn->chanspec); unsigned char b_Channel = CR_CHAN(insn->chanspec);
...@@ -1636,7 +1610,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, ...@@ -1636,7 +1610,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev,
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
int i_APCI3XXX_Reset(struct comedi_device *dev) static int i_APCI3XXX_Reset(struct comedi_device *dev)
{ {
unsigned char b_Cpt = 0; unsigned char b_Cpt = 0;
...@@ -1656,27 +1630,26 @@ int i_APCI3XXX_Reset(struct comedi_device *dev) ...@@ -1656,27 +1630,26 @@ int i_APCI3XXX_Reset(struct comedi_device *dev)
/* Clear the start command */ /* Clear the start command */
/***************************/ /***************************/
writel(0, (void *)(devpriv->dw_AiBase + 8)); writel(0, devpriv->dw_AiBase + 8);
/*****************************/ /*****************************/
/* Reset the interrupt flags */ /* Reset the interrupt flags */
/*****************************/ /*****************************/
writel(readl((void *)(devpriv->dw_AiBase + 16)), writel(readl(devpriv->dw_AiBase + 16), devpriv->dw_AiBase + 16);
(void *)(devpriv->dw_AiBase + 16));
/*****************/ /*****************/
/* clear the EOS */ /* clear the EOS */
/*****************/ /*****************/
readl((void *)(devpriv->dw_AiBase + 20)); readl(devpriv->dw_AiBase + 20);
/******************/ /******************/
/* Clear the FIFO */ /* Clear the FIFO */
/******************/ /******************/
for (b_Cpt = 0; b_Cpt < 16; b_Cpt++) { for (b_Cpt = 0; b_Cpt < 16; b_Cpt++) {
readl((void *)(devpriv->dw_AiBase + 28)); readl(devpriv->dw_AiBase + 28);
} }
/************************/ /************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment