Commit 68ad0ae0 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: s626: remove 'allocatedBuf' from private data

This variable is only used to count the number of dma buffers
allocated during the attach. If an allocation fails, the attach
function exits with -ENOMEM. When this variable is checked later
it will always be == 2. Just remove the variable and the check.

This allows bringing the code back an indent level in
s626_initialize(). Note, coding style issues in this function
are not addressed yet.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f996ab29
......@@ -80,7 +80,6 @@ INSN_CONFIG instructions:
struct s626_private {
void __iomem *base_addr;
short allocatedBuf;
uint8_t ai_cmd_running; /* ai_cmd is running */
uint8_t ai_continous; /* continous acquisition */
int ai_sample_count; /* number of samples to acquire */
......@@ -2443,24 +2442,18 @@ static int s626_allocate_dma_buffers(struct comedi_device *dev)
void *addr;
dma_addr_t appdma;
devpriv->allocatedBuf = 0;
addr = pci_alloc_consistent(pcidev, DMABUF_SIZE, &appdma);
if (!addr)
return -ENOMEM;
devpriv->ANABuf.LogicalBase = addr;
devpriv->ANABuf.PhysicalBase = appdma;
devpriv->allocatedBuf++;
addr = pci_alloc_consistent(pcidev, DMABUF_SIZE, &appdma);
if (!addr)
return -ENOMEM;
devpriv->RPSBuf.LogicalBase = addr;
devpriv->RPSBuf.PhysicalBase = appdma;
devpriv->allocatedBuf++;
return 0;
}
......@@ -2471,11 +2464,10 @@ static void s626_initialize(struct comedi_device *dev)
/* uint16_t StartVal; */
/* uint16_t index; */
/* unsigned int data[16]; */
int i;
if (devpriv->allocatedBuf == 2) {
dma_addr_t pPhysBuf;
uint16_t chan;
int i;
/* enab DEBI and audio pins, enable I2C interface. */
MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C);
......@@ -2623,8 +2615,7 @@ static void s626_initialize(struct comedi_device *dev)
* single DWORD will be transferred each time a DMA transfer is
* enabled. */
pPhysBuf =
devpriv->ANABuf.PhysicalBase +
pPhysBuf = devpriv->ANABuf.PhysicalBase +
(DAC_WDMABUF_OS * sizeof(uint32_t));
WR7146(P_BASEA2_OUT, (uint32_t) pPhysBuf); /* Buffer base adrs. */
......@@ -2632,8 +2623,8 @@ static void s626_initialize(struct comedi_device *dev)
/* Cache Audio2's output DMA buffer logical address. This is
* where DAC data is buffered for A2 output DMA transfers. */
devpriv->pDacWBuf =
(uint32_t *) devpriv->ANABuf.LogicalBase + DAC_WDMABUF_OS;
devpriv->pDacWBuf = (uint32_t *)devpriv->ANABuf.LogicalBase +
DAC_WDMABUF_OS;
/* Audio2's output channels does not use paging. The protection
* violation handling bit is set so that the DMAC will
......@@ -2717,8 +2708,7 @@ static void s626_initialize(struct comedi_device *dev)
* standard DIO (vs. counter overflow) mode, disable the battery
* charger, and reset the watchdog interval selector to zero.
*/
WriteMISC2(dev, (uint16_t) (DEBIread(dev,
LP_RDMISC2) &
WriteMISC2(dev, (uint16_t)(DEBIread(dev, LP_RDMISC2) &
MISC2_BATT_ENABLE));
/* Initialize the digital I/O subsystem. */
......@@ -2726,7 +2716,6 @@ static void s626_initialize(struct comedi_device *dev)
/* enable interrupt test */
/* writel(IRQ_GPIO3 | IRQ_RPS1,devpriv->base_addr+P_IER); */
}
}
static int s626_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev)
......
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